> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corsair.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Chargebee API reference

> API reference for the Chargebee plugin in Corsair: every `chargebee.api.*` operation with its input and output types, taken from the plugin's Zod schemas.

> [!NOTE]
>
> **New to Corsair?** See [API access](https://docs.corsair.dev/concepts/api.md), [authentication](https://docs.corsair.dev/concepts/auth.md), and [error handling](https://docs.corsair.dev/concepts/error-handling).

## Addons

### copy

`addons.copy`

Copy an addon. Creates an addon in this site by copying its configurations from another site. Copying of archived addons is not supported. Note: The attribute *tax\_profile\_id* is not copied. In effect, if the plan is taxable, it will be mapped to the *Primary* tax profile. Product Catalog 1.0 sites only.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.addons.copy({ from_site: 'example', id_at_from_site: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `from_site` | `string` | Yes | Your Chargebee site name having the addon to be copied. **Note:** Unless you are copying from a twin site (acme \\& acme-test are twin sites), [contact 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 have this allow-listed. |
| `id_at_from_site` | `string` | Yes | Id of the addon to be copied. The new addon created in this site will have the same Id. |
| `id` | `string` | No | Id of copied addon in this site. |
| `for_site_merging` | `boolean` | No | If copy action is performed as part of Chargebee site merge action, pass the value as true. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `addon` | `object \| null` | No | Addons are additional charges applied to a subscription apart from the base plan charge. The addons can be recurring or non-recurring. A recurring addon included in a subscription is charged as per billing frequency of subscription. A non-recurring addon included in subscription will be charged immediately and only once. And a non-recurring addon is NOT pro-rated based on billing cycle, whereas a recurring addon is automatically pro-rated based on billing cycle. |

> [accordion] addon full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   invoice_name?: string | null,
>   description?: string | null,
>   pricing_model?: string | null,
>   charge_type?: string | null,
>   price?: number | null,
>   currency_code?: string | null,
>   period?: number | null,
>   period_unit?: string | null,
>   unit?: string | null,
>   status?: string | null,
>   archived_at?: number | null,
>   enabled_in_portal?: boolean | null,
>   tax_code?: string | null,
>   hsn_code?: string | null,
>   taxjar_product_code?: string | null,
>   avalara_sale_type?: string | null,
>   avalara_transaction_type?: number | null,
>   avalara_service_type?: number | null,
>   sku?: string | null,
>   accounting_code?: string | null,
>   accounting_category1?: string | null,
>   accounting_category2?: string | null,
>   accounting_category3?: string | null,
>   accounting_category4?: string | null,
>   is_shippable?: boolean | null,
>   shipping_frequency_period?: number | null,
>   shipping_frequency_period_unit?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   price_in_decimal?: string | null,
>   included_in_mrr?: boolean | null,
>   channel?: string | null,
>   proration_type?: string | null,
>   invoice_notes?: string | null,
>   taxable?: boolean | null,
>   tax_profile_id?: string | null,
>   meta_data?: {
>   } | null,
>   show_description_in_invoices?: boolean | null,
>   show_description_in_quotes?: boolean | null,
>   tiers?: {
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null
> } | null
> ```

***

### create

`addons.create`

Create an addon. Create a new addon. Product Catalog 1.0 sites only.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.addons.create({ charge_type: 'recurring', id: 'cust_8gsnbYfsMLds', name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `id` | `string` | Yes | A unique ID for your system to identify the addon. |
| `name` | `string` | Yes | The display name used in web interface for identifying the addon. |
| `invoice_name` | `string` | No | Display name used in invoice. If it is not configured then name is used in invoice. |
| `description` | `string` | No | Description about the addon to show in the hosted pages \\& customer portal. This description will not be shown if multiple addons are added. **Note:** If your input contains characters that are subjected to sanitization (like incomplete HTML tags), the sanitization process might increase the length of your input. If the sanitized input exceeds the limit, your request will be rejected. |
| `charge_type` | `recurring \| non_recurring` | Yes | Type of charge. \* non\_recurring - Charged immediately and only once every time it is applied. \* recurring - Charges are automatically applied in sync with the billing frequency of subscription. |
| `price` | `number` | No | Addon price is calculated based on the addon type and charge type. [Learn more](https://www.chargebee.com/docs/addons.html#charge-type-and-pricing). The unit depends on the [type of currency](https://docs.corsair.dev/docs/api/getting-started) . |
| `currency_code` | `string` | No | The currency code (ISO 4217 format) of the addon. |
| `period` | `number` | No | Applicable only for recurring-addons. Along with 'period\_unit' decides the term-price of this addon. |
| `period_unit` | `day \| week \| month \| year \| not_applicable` | No | Applicable only for recurring-addons. Along with 'period' decides the term-price of this addon. \* month - Charge based on month(s) \* week - Charge based on week(s) \* not\_applicable - not applicable for this addon \* year - Charge based on year(s) \* day - Charge based on Day(S) |
| `pricing_model` | `flat_fee \| per_unit \| tiered \| volume \| stairstep` | No | Defines how the charges for the addons are calculated. \* tiered - There are quantity tiers for which per unit prices are set. Quantities are purchased from successive tiers. \* per\_unit - A fixed price per unit quantity. \* flat\_fee - A fixed price that is not quantity-based. \* volume - The per unit price is based on the tier that the total quantity falls in. \* stairstep - A quantity-based pricing scheme. The item is charged a fixed price based on the tier that the total quantity falls in. |
| `unit` | `string` | No | Specifies the type of quantity. For example, if the addon price is $10 and 'agent' is the unit of measure, the addon will be $10/agent. Applicable only for quantity type addons. |
| `enabled_in_portal` | `boolean` | No | If enabled, customers can select this addon using the 'Change Subscription' option in the customer portal. |
| `taxable` | `boolean` | No | Specifies whether taxes apply to this addon. This value is set and returned even if [Taxes](https://www.chargebee.com/docs/tax.html) have been disabled in Chargebee. However, the value is effective only while Taxes are enabled. |
| `tax_profile_id` | `string` | No | Tax profile of the addon. |
| `avalara_sale_type` | `wholesale \| retail \| consumed \| vendor_use` | No | Indicates the type of sale carried out. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. \* retail - Transaction is a sale to an end user \* vendor\_use - Transaction is for an item that is subject to vendor use tax \* wholesale - Transaction is a sale to another company that will resell your product or service to another consumer \* consumed - Transaction is for an item that is consumed directly |
| `avalara_transaction_type` | `number` | No | Indicates the type of product to be taxed. Values for this field can be taken from Avalara. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. |
| `avalara_service_type` | `number` | No | Indicates the type of service for the product to be taxed. Values for this field can be taken from Avalara. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. |
| `tax_code` | `string` | No | The Avalara tax codes to which items are mapped to should be provided here. Applicable only if you use Chargebee's [AvaTax for Sales integration](https://www.chargebee.com/docs/avalara.html) . |
| `hsn_code` | `string` | No | The [HSN code](https://cbic-gst.gov.in/gst-goods-services-rates.html) to which the item is mapped for calculating the customer's tax in India. Applicable only when both of the following conditions are true: \* [**India**](https://www.chargebee.com/docs/indian-gst.html#configuring-indian-gst) has been enabled as a **Tax Region**. (An error is returned when this condition is not true.) \* The [**AvaTax for Sales** integration](https://www.chargebee.com/docs/avalara.html) has been enabled in Chargebee. |
| `taxjar_product_code` | `string` | No | The TaxJar product codes to which items are mapped to should be provided here. Applicable only if you use Chargebee's [TaxJar integration](https://www.chargebee.com/docs/taxjar.html) . |
| `invoice_notes` | `string` | No | A customer-facing note added to all invoices associated with this API resource. This note becomes one among [all the notes](https://docs.corsair.dev/docs/api/invoices/invoice-object#notes) displayed on the invoice PDF. |
| `meta_data` | `object` | No | A collection of key-value pairs that provides extra information about the addon. **Note:** There's a character limit of 65,535. [Learn more](https://docs.corsair.dev/docs/api/v2/pcv-1/advanced-features) . |
| `sku` | `string` | No | The field is used as Product name/code in your third party accounting application. Chargebee will use it as an alternate name in your accounting application. |
| `accounting_code` | `string` | No | This field is to capture the Account code setup in your Accounting system for integration purposes only. |
| `accounting_category1` | `string` | No | Used exclusively with the following [accounting integrations](https://www.chargebee.com/docs/1.0/finance-integration-index.html) \* [**Xero:**](https://www.chargebee.com/docs/1.0/xero.html) If you've categorized your products in Xero, provide the category name and option. Use the format: `:` . For example:`Location: Singapore.` \* [**QuickBooks:**](https://www.chargebee.com/docs/1.0/quickbooks.html) If you've categorized your product sales in QuickBooks according to Classes, provide the class name here. Use the following format: `::...` \* [**NetSuite:**](https://www.chargebee.com/docs/1.0/netsuite.html) If you've categorized your products in NetSuite under Classes, provide the class name here. Use the following format: `: : ....` For example: `Services : Plan.` \* [**Intacct:**](https://www.chargebee.com/docs/1.0/intacct.html) If you've classified your products in Intacct under Locations, provide the name of the Location here. |
| `accounting_category2` | `string` | No | Used exclusively with the following [accounting integrations](https://www.chargebee.com/docs/1.0/finance-integration-index.html) \* [**Xero:**](https://www.chargebee.com/docs/1.0/xero.html) If you've categorized your products in Xero, then provide the second category name and option here. Use the format: `: ....` For example, `Region: South` \* [**QuickBooks:**](https://www.chargebee.com/docs/1.0/quickbooks.html) If you've categorized your product sales in QuickBooks according to Location, provide the Location name here. Use the following format: `::....` For example: `Location: North America: Canada` \* [**NetSuite:**](https://www.chargebee.com/docs/1.0/netsuite.html) If you've categorized your products in NetSuite under Locations, provide the location name here. Use the following format `: : ....` For example: `NA:US:CA` \* [**Intacct:**](https://www.chargebee.com/docs/1.0/intacct.html) If you've classified your products in Intacct under Dimensions, provide the value of the Dimension here. |
| `accounting_category3` | `string` | No | Used exclusively with the following [accounting integrations](https://www.chargebee.com/docs/1.0/finance-integration-index.html) \* [**NetSuite:**](https://www.chargebee.com/docs/1.0/netsuite.html) If you've categorized your products in NetSuite under Departments, pass the department name here. Use the following format: `: : ....` For example: `Production: Assembly.` \* [**Intacct:**](https://www.chargebee.com/docs/1.0/intacct.html) If you've classified your products in Intacct under multiple Dimensions, provide the value of the second Dimension here. . |
| `accounting_category4` | `string` | No | Used exclusively with the following [accounting integrations](https://www.chargebee.com/docs/1.0/finance-integration-index.html) \* [**NetSuite:**](https://www.chargebee.com/docs/1.0/netsuite.html) Provide the "Revenue Recognition Rule Id" for the product from NetSuite. \* [**Intacct:**](https://www.chargebee.com/docs/1.0/intacct.html) If you have configured "Revenue Recognition Templates" for products in Intacct, provide the template ID for the product. . |
| `is_shippable` | `boolean` | No | If enabled, charges for this plan/addon will be added to orders. |
| `shipping_frequency_period` | `number` | No | Defines the shipping frequency. Example: to bill customer every 2 weeks, provide "2" here. |
| `shipping_frequency_period_unit` | `year \| month \| week \| day` | No | Defines the shipping frequency in association with shipping period. \* day - Ship based on day(s) \* week - Ship based on week(s) \* month - Ship based on month(s) \* year - Ship based on year(s) |
| `included_in_mrr` | `boolean` | No | The addon is included in MRR calculations for your site. This attribute is only applicable for addons of `charge_type = non_recurring` and when the feature is enabled in Chargebee. Note: If the site-level setting is to exclude non-recurring addons from MRR calculations, this value is always returned `false` . |
| `show_description_in_invoices` | `boolean` | No | Whether the [addon description](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object) should be shown on [invoice PDFs](https://docs.corsair.dev/docs/api/invoices/retrieve-invoice-as-pdf). If this Boolean is changed, only invoices generated (or [regenerated](https://www.chargebee.com/docs/invoice-operations.html#actions-for-payment-due-not-paid-invoices_regenerate-invoice) ) after the change are affected; past invoices are not. |
| `show_description_in_quotes` | `boolean` | No | Whether the [addon description](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object) should be shown on [quote PDFs](https://docs.corsair.dev/docs/api/quotes/retrieve-quote-as-pdf). If this Boolean is changed, only quotes created after the change are affected; past quotes are not. |
| `price_in_decimal` | `string` | No | The price of the addon when the `pricing_model` is `flat_fee`. When the pricing model is `per_unit` , it is the price per unit quantity of the item. Not applicable for the other pricing models. The value is in decimal and in major units of the currency. Also, this is only applicable when [multi-decimal pricing](https://docs.corsair.dev/docs/api/v2/pcv-1/currencies) is enabled. This price is for the `period` of the addon. When attached to a plan, the addon is billed for the billing period of the plan. Learn more. |
| `proration_type` | `site_default \| partial_term \| full_term` | No | **Note** Applicable only for addons with [pricing\_model](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object#pricing_model) = `per_unit`. Specifies how to manage charges or credits for the addon during a [subscription update](https://docs.corsair.dev/docs/api/v2/pcv-1/subscriptions/update-a-subscription) or [estimating](https://docs.corsair.dev/docs/api/v2/pcv-1/estimates/update-subscription-estimate) a subscription update. \* full\_term - Charge the full price of the addon item price or give the full credit. Don't apply any proration. \* site\_default - Use the [site-wide proration setting](https://www.chargebee.com/docs/1.0/proration.html#proration-for-subscription-change) . \* partial\_term - Prorate the charges or credits for the rest of the current term. |
| `status` | `active \| archived` | No | Status of the addon. \* archived - No new associations with subscriptions are allowed. Existing associations for recurring addons remain as-is and can be removed if required. \* active - Only active addons can be applied to subscriptions |
| `tiers` | `object` | No | Parameters for tiers |
| `tax_providers_fields` | `object` | No | Parameters for tax\_providers\_fields |

> [accordion] meta\_data full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] tiers full type
>
> ```ts theme={null}
> {
>   starting_unit?: number[],
>   ending_unit?: number[],
>   price?: number[],
>   starting_unit_in_decimal?: string[],
>   ending_unit_in_decimal?: string[],
>   price_in_decimal?: string[]
> }
> ```

> [accordion] tax\_providers\_fields full type
>
> ```ts theme={null}
> {
>   provider_name: string[],
>   field_id: string[],
>   field_value: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `addon` | `object \| null` | No | Addons are additional charges applied to a subscription apart from the base plan charge. The addons can be recurring or non-recurring. A recurring addon included in a subscription is charged as per billing frequency of subscription. A non-recurring addon included in subscription will be charged immediately and only once. And a non-recurring addon is NOT pro-rated based on billing cycle, whereas a recurring addon is automatically pro-rated based on billing cycle. |

> [accordion] addon full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   invoice_name?: string | null,
>   description?: string | null,
>   pricing_model?: string | null,
>   charge_type?: string | null,
>   price?: number | null,
>   currency_code?: string | null,
>   period?: number | null,
>   period_unit?: string | null,
>   unit?: string | null,
>   status?: string | null,
>   archived_at?: number | null,
>   enabled_in_portal?: boolean | null,
>   tax_code?: string | null,
>   hsn_code?: string | null,
>   taxjar_product_code?: string | null,
>   avalara_sale_type?: string | null,
>   avalara_transaction_type?: number | null,
>   avalara_service_type?: number | null,
>   sku?: string | null,
>   accounting_code?: string | null,
>   accounting_category1?: string | null,
>   accounting_category2?: string | null,
>   accounting_category3?: string | null,
>   accounting_category4?: string | null,
>   is_shippable?: boolean | null,
>   shipping_frequency_period?: number | null,
>   shipping_frequency_period_unit?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   price_in_decimal?: string | null,
>   included_in_mrr?: boolean | null,
>   channel?: string | null,
>   proration_type?: string | null,
>   invoice_notes?: string | null,
>   taxable?: boolean | null,
>   tax_profile_id?: string | null,
>   meta_data?: {
>   } | null,
>   show_description_in_invoices?: boolean | null,
>   show_description_in_quotes?: boolean | null,
>   tiers?: {
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null
> } | null
> ```

***

### delete

`addons.delete`

Delete an addon. When an addon that already has subscriptions/invoices linked to it is deleted, it does not get completely purged but is instead moved to "Archived" state. No other subscriptions can use this addon but subscriptions already on it will continue to renew. Product Catalog 1.0 sites only.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.addons.delete({ addonId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `addonId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `addon` | `object \| null` | No | Addons are additional charges applied to a subscription apart from the base plan charge. The addons can be recurring or non-recurring. A recurring addon included in a subscription is charged as per billing frequency of subscription. A non-recurring addon included in subscription will be charged immediately and only once. And a non-recurring addon is NOT pro-rated based on billing cycle, whereas a recurring addon is automatically pro-rated based on billing cycle. |

> [accordion] addon full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   invoice_name?: string | null,
>   description?: string | null,
>   pricing_model?: string | null,
>   charge_type?: string | null,
>   price?: number | null,
>   currency_code?: string | null,
>   period?: number | null,
>   period_unit?: string | null,
>   unit?: string | null,
>   status?: string | null,
>   archived_at?: number | null,
>   enabled_in_portal?: boolean | null,
>   tax_code?: string | null,
>   hsn_code?: string | null,
>   taxjar_product_code?: string | null,
>   avalara_sale_type?: string | null,
>   avalara_transaction_type?: number | null,
>   avalara_service_type?: number | null,
>   sku?: string | null,
>   accounting_code?: string | null,
>   accounting_category1?: string | null,
>   accounting_category2?: string | null,
>   accounting_category3?: string | null,
>   accounting_category4?: string | null,
>   is_shippable?: boolean | null,
>   shipping_frequency_period?: number | null,
>   shipping_frequency_period_unit?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   price_in_decimal?: string | null,
>   included_in_mrr?: boolean | null,
>   channel?: string | null,
>   proration_type?: string | null,
>   invoice_notes?: string | null,
>   taxable?: boolean | null,
>   tax_profile_id?: string | null,
>   meta_data?: {
>   } | null,
>   show_description_in_invoices?: boolean | null,
>   show_description_in_quotes?: boolean | null,
>   tiers?: {
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null
> } | null
> ```

***

### get

`addons.get`

Retrieve an addon. Retrieve a specific addon using the ID. Product Catalog 1.0 sites only.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.addons.get({ addonId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `addonId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `addon` | `object \| null` | No | Addons are additional charges applied to a subscription apart from the base plan charge. The addons can be recurring or non-recurring. A recurring addon included in a subscription is charged as per billing frequency of subscription. A non-recurring addon included in subscription will be charged immediately and only once. And a non-recurring addon is NOT pro-rated based on billing cycle, whereas a recurring addon is automatically pro-rated based on billing cycle. |

> [accordion] addon full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   invoice_name?: string | null,
>   description?: string | null,
>   pricing_model?: string | null,
>   charge_type?: string | null,
>   price?: number | null,
>   currency_code?: string | null,
>   period?: number | null,
>   period_unit?: string | null,
>   unit?: string | null,
>   status?: string | null,
>   archived_at?: number | null,
>   enabled_in_portal?: boolean | null,
>   tax_code?: string | null,
>   hsn_code?: string | null,
>   taxjar_product_code?: string | null,
>   avalara_sale_type?: string | null,
>   avalara_transaction_type?: number | null,
>   avalara_service_type?: number | null,
>   sku?: string | null,
>   accounting_code?: string | null,
>   accounting_category1?: string | null,
>   accounting_category2?: string | null,
>   accounting_category3?: string | null,
>   accounting_category4?: string | null,
>   is_shippable?: boolean | null,
>   shipping_frequency_period?: number | null,
>   shipping_frequency_period_unit?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   price_in_decimal?: string | null,
>   included_in_mrr?: boolean | null,
>   channel?: string | null,
>   proration_type?: string | null,
>   invoice_notes?: string | null,
>   taxable?: boolean | null,
>   tax_profile_id?: string | null,
>   meta_data?: {
>   } | null,
>   show_description_in_invoices?: boolean | null,
>   show_description_in_quotes?: boolean | null,
>   tiers?: {
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null
> } | null
> ```

***

### list

`addons.list`

List addons. List the addons. This returns all your current active and archived addons. Product Catalog 1.0 sites only.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.addons.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `id` | `object` | No | optional, string filter A unique ID for your system to identify the addon. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *id\\\[is\\] = "support\_charge"* |
| `name` | `object` | No | optional, string filter The display name used in web interface for identifying the addon. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *name\\\[is\\] = "Support Charge"* |
| `pricing_model` | `object` | No | optional, enumerated string filter Defines how the charges for the addons are calculated. Possible values are : flat\_fee, per\_unit, tiered, volume, stairstep. **Supported operators :** is, is\_not, in, not\_in **Example →** *pricing\_model\\\[is\\] = "flat\_fee"* |
| `charge_type` | `object` | No | optional, enumerated string filter Type of charge. Possible values are : recurring, non\_recurring. **Supported operators :** is, is\_not, in, not\_in **Example →** *charge\_type\\\[is\_not\\] = "recurring"* |
| `price` | `object` | No | optional, in cents filter Addon price is calculated based on the addon type and charge type. [Learn more](https://www.chargebee.com/docs/addons.html#charge-type-and-pricing). The unit depends on the [type of currency](https://docs.corsair.dev/docs/api/getting-started) . **Supported operators :** is, is\_not, lt, lte, gt, gte, between **Example →** *price\\\[gte\\] = "1300"* |
| `period` | `object` | No | optional, integer filter Applicable only for recurring-addons. Along with 'period\_unit' decides the term-price of this addon. **Supported operators :** is, is\_not, lt, lte, gt, gte, between **Example →** *period\\\[is\\] = "3"* |
| `period_unit` | `object` | No | optional, enumerated string filter Applicable only for recurring-addons. Along with 'period' decides the term-price of this addon. Possible values are : day, week, month, year, not\_applicable. **Supported operators :** is, is\_not, in, not\_in **Example →** *period\_unit\\\[is\_not\\] = "month"* |
| `status` | `object` | No | optional, enumerated string filter Status of the addon. Possible values are : active, archived, deleted. **Supported operators :** is, is\_not, in, not\_in **Example →** *status\\\[is\_not\\] = "active"* |
| `updated_at` | `object` | No | optional, timestamp(UTC) in seconds filter To filter based on updated at. This attribute will be present only if the resource has been updated after 2016-11-09. **Supported operators :** after, before, on, between **Example →** *updated\_at\\\[on\\] = "1243545465"* |
| `currency_code` | `object` | No | optional, string filter The currency code (ISO 4217 format) of the addon. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *currency\_code\\\[is\\] = "USD"* |
| `channel` | `object` | No | optional, enumerated string filter The subscription channel this object originated from and is maintained in. Possible values are : web, app\_store, play\_store. **Supported operators :** is, is\_not, in, not\_in **Example →** *channel\\\[is\\] = "APP STORE"* |
| `include_deleted` | `boolean` | No | If set to true, includes the deleted resources in the response. For the deleted resources in the response, the '**deleted** ' attribute will be '**true** '. |

> [accordion] id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] name full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] pricing\_model full type
>
> ```ts theme={null}
> {
>   is?: flat_fee | per_unit | tiered | volume | stairstep,
>   is_not?: flat_fee | per_unit | tiered | volume | stairstep,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] charge\_type full type
>
> ```ts theme={null}
> {
>   is?: recurring | non_recurring,
>   is_not?: recurring | non_recurring,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] price full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   lt?: string,
>   lte?: string,
>   gt?: string,
>   gte?: string,
>   between?: string
> }
> ```

> [accordion] period full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   lt?: string,
>   lte?: string,
>   gt?: string,
>   gte?: string,
>   between?: string
> }
> ```

> [accordion] period\_unit full type
>
> ```ts theme={null}
> {
>   is?: day | week | month | year | not_applicable,
>   is_not?: day | week | month | year | not_applicable,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] status full type
>
> ```ts theme={null}
> {
>   is?: active | archived | deleted,
>   is_not?: active | archived | deleted,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] updated\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] currency\_code full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] channel full type
>
> ```ts theme={null}
> {
>   is?: web | app_store | play_store,
>   is_not?: web | app_store | play_store,
>   in?: string,
>   not_in?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   addon?: {
>     id?: string | null,
>     name?: string | null,
>     invoice_name?: string | null,
>     description?: string | null,
>     pricing_model?: string | null,
>     charge_type?: string | null,
>     price?: number | null,
>     currency_code?: string | null,
>     period?: number | null,
>     period_unit?: string | null,
>     unit?: string | null,
>     status?: string | null,
>     archived_at?: number | null,
>     enabled_in_portal?: boolean | null,
>     tax_code?: string | null,
>     hsn_code?: string | null,
>     taxjar_product_code?: string | null,
>     avalara_sale_type?: string | null,
>     avalara_transaction_type?: number | null,
>     avalara_service_type?: number | null,
>     sku?: string | null,
>     accounting_code?: string | null,
>     accounting_category1?: string | null,
>     accounting_category2?: string | null,
>     accounting_category3?: string | null,
>     accounting_category4?: string | null,
>     is_shippable?: boolean | null,
>     shipping_frequency_period?: number | null,
>     shipping_frequency_period_unit?: string | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     price_in_decimal?: string | null,
>     included_in_mrr?: boolean | null,
>     channel?: string | null,
>     proration_type?: string | null,
>     invoice_notes?: string | null,
>     taxable?: boolean | null,
>     tax_profile_id?: string | null,
>     meta_data?: {
>     } | null,
>     show_description_in_invoices?: boolean | null,
>     show_description_in_quotes?: boolean | null,
>     tiers?: {
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       price?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       price_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     tax_providers_fields?: {
>       provider_name?: string | null,
>       field_id?: string | null,
>       field_value?: string | null
>     }[] | null
>   } | null
> }[] | null
> ```

***

### unarchive

`addons.unarchive`

Unarchive an addon. Unarchives a specific addon using the id. Product Catalog 1.0 sites only.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.addons.unarchive({ addonId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `addonId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `addon` | `object \| null` | No | Addons are additional charges applied to a subscription apart from the base plan charge. The addons can be recurring or non-recurring. A recurring addon included in a subscription is charged as per billing frequency of subscription. A non-recurring addon included in subscription will be charged immediately and only once. And a non-recurring addon is NOT pro-rated based on billing cycle, whereas a recurring addon is automatically pro-rated based on billing cycle. |

> [accordion] addon full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   invoice_name?: string | null,
>   description?: string | null,
>   pricing_model?: string | null,
>   charge_type?: string | null,
>   price?: number | null,
>   currency_code?: string | null,
>   period?: number | null,
>   period_unit?: string | null,
>   unit?: string | null,
>   status?: string | null,
>   archived_at?: number | null,
>   enabled_in_portal?: boolean | null,
>   tax_code?: string | null,
>   hsn_code?: string | null,
>   taxjar_product_code?: string | null,
>   avalara_sale_type?: string | null,
>   avalara_transaction_type?: number | null,
>   avalara_service_type?: number | null,
>   sku?: string | null,
>   accounting_code?: string | null,
>   accounting_category1?: string | null,
>   accounting_category2?: string | null,
>   accounting_category3?: string | null,
>   accounting_category4?: string | null,
>   is_shippable?: boolean | null,
>   shipping_frequency_period?: number | null,
>   shipping_frequency_period_unit?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   price_in_decimal?: string | null,
>   included_in_mrr?: boolean | null,
>   channel?: string | null,
>   proration_type?: string | null,
>   invoice_notes?: string | null,
>   taxable?: boolean | null,
>   tax_profile_id?: string | null,
>   meta_data?: {
>   } | null,
>   show_description_in_invoices?: boolean | null,
>   show_description_in_quotes?: boolean | null,
>   tiers?: {
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null
> } | null
> ```

***

### update

`addons.update`

Update an addon. When updating addons that already have an invoice or a subscription linked to it, you can only update the following parameters: \* name \* invoice\_name \* price \* included\_in\_mrr \* meta\_data. Product Catalog 1.0 sites only.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.addons.update({ addonId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `addonId` | `string` | Yes | — |
| `name` | `string` | No | The display name used in web interface for identifying the addon. |
| `invoice_name` | `string` | No | Display name used in invoice. If it is not configured then name is used in invoice. |
| `description` | `string` | No | Description about the addon to show in the hosted pages \\& customer portal. This description will not be shown if multiple addons are added. **Note:** If your input contains characters that are subjected to sanitization (like incomplete HTML tags), the sanitization process might increase the length of your input. If the sanitized input exceeds the limit, your request will be rejected. |
| `charge_type` | `recurring \| non_recurring` | No | Type of charge. \* non\_recurring - Charged immediately and only once every time it is applied. \* recurring - Charges are automatically applied in sync with the billing frequency of subscription. |
| `price` | `number` | No | Addon price is calculated based on the addon type and charge type. [Learn more](https://www.chargebee.com/docs/addons.html#charge-type-and-pricing). The unit depends on the [type of currency](https://docs.corsair.dev/docs/api/getting-started) . |
| `currency_code` | `string` | No | The currency code (ISO 4217 format) of the addon. Applicable if Multicurrency is enabled. |
| `period` | `number` | No | Applicable only for recurring-addons. Along with 'period\_unit' decides the term-price of this addon. |
| `period_unit` | `day \| week \| month \| year \| not_applicable` | No | Applicable only for recurring-addons. Along with 'period' decides the term-price of this addon. \* month - Charge based on month(s) \* week - Charge based on week(s) \* not\_applicable - not applicable for this addon \* year - Charge based on year(s) \* day - Charge based on Day(S) |
| `pricing_model` | `flat_fee \| per_unit \| tiered \| volume \| stairstep` | No | Defines how the charges for the addons are calculated. \* tiered - There are quantity tiers for which per unit prices are set. Quantities are purchased from successive tiers. \* per\_unit - A fixed price per unit quantity. \* flat\_fee - A fixed price that is not quantity-based. \* volume - The per unit price is based on the tier that the total quantity falls in. \* stairstep - A quantity-based pricing scheme. The item is charged a fixed price based on the tier that the total quantity falls in. |
| `unit` | `string` | No | Specifies the type of quantity. For example, if the addon price is $10 and 'agent' is the unit of measure, the addon will be $10/agent. Applicable only for quantity type addons. |
| `enabled_in_portal` | `boolean` | No | If enabled, customers can select this addon using the 'Change Subscription' option in the customer portal. |
| `taxable` | `boolean` | No | Specifies whether taxes apply to this addon. This value is set and returned even if [Taxes](https://www.chargebee.com/docs/tax.html) have been disabled in Chargebee. However, the value is effective only while Taxes are enabled. |
| `tax_profile_id` | `string` | No | Tax profile of the addon. |
| `avalara_sale_type` | `wholesale \| retail \| consumed \| vendor_use` | No | Indicates the type of sale carried out. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. \* retail - Transaction is a sale to an end user \* vendor\_use - Transaction is for an item that is subject to vendor use tax \* wholesale - Transaction is a sale to another company that will resell your product or service to another consumer \* consumed - Transaction is for an item that is consumed directly |
| `avalara_transaction_type` | `number` | No | Indicates the type of product to be taxed. Values for this field can be taken from Avalara. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. |
| `avalara_service_type` | `number` | No | Indicates the type of service for the product to be taxed. Values for this field can be taken from Avalara. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. |
| `tax_code` | `string` | No | The Avalara tax codes to which items are mapped to should be provided here. Applicable only if you use Chargebee's [AvaTax for Sales integration](https://www.chargebee.com/docs/avalara.html) . |
| `hsn_code` | `string` | No | The [HSN code](https://cbic-gst.gov.in/gst-goods-services-rates.html) to which the item is mapped for calculating the customer's tax in India. Applicable only when both of the following conditions are true: \* [**India**](https://www.chargebee.com/docs/indian-gst.html#configuring-indian-gst) has been enabled as a **Tax Region**. (An error is returned when this condition is not true.) \* The [**AvaTax for Sales** integration](https://www.chargebee.com/docs/avalara.html) has been enabled in Chargebee. |
| `taxjar_product_code` | `string` | No | The TaxJar product codes to which items are mapped to should be provided here. Applicable only if you use Chargebee's [TaxJar integration](https://www.chargebee.com/docs/taxjar.html) . |
| `invoice_notes` | `string` | No | A customer-facing note added to all invoices associated with this API resource. This note becomes one among [all the notes](https://docs.corsair.dev/docs/api/invoices/invoice-object#notes) displayed on the invoice PDF. |
| `meta_data` | `object` | No | A collection of key-value pairs that provides extra information about the addon. **Note:** There's a character limit of 65,535. [Learn more](https://docs.corsair.dev/docs/api/v2/pcv-1/advanced-features) . |
| `sku` | `string` | No | The field is used as Product name/code in your third party accounting application. Chargebee will use it as an alternate name in your accounting application. |
| `accounting_code` | `string` | No | This field is to capture the Account code setup in your Accounting system for integration purposes only. |
| `accounting_category1` | `string` | No | Used exclusively with the following [accounting integrations](https://www.chargebee.com/docs/1.0/finance-integration-index.html) \* [**Xero:**](https://www.chargebee.com/docs/1.0/xero.html) If you've categorized your products in Xero, provide the category name and option. Use the format: `:` . For example:`Location: Singapore.` \* [**QuickBooks:**](https://www.chargebee.com/docs/1.0/quickbooks.html) If you've categorized your product sales in QuickBooks according to Classes, provide the class name here. Use the following format: `::...` \* [**NetSuite:**](https://www.chargebee.com/docs/1.0/netsuite.html) If you've categorized your products in NetSuite under Classes, provide the class name here. Use the following format: `: : ....` For example: `Services : Plan.` \* [**Intacct:**](https://www.chargebee.com/docs/1.0/intacct.html) If you've classified your products in Intacct under Locations, provide the name of the Location here. |
| `accounting_category2` | `string` | No | Used exclusively with the following [accounting integrations](https://www.chargebee.com/docs/1.0/finance-integration-index.html) \* [**Xero:**](https://www.chargebee.com/docs/1.0/xero.html) If you've categorized your products in Xero, then provide the second category name and option here. Use the format: `: ....` For example, `Region: South` \* [**QuickBooks:**](https://www.chargebee.com/docs/1.0/quickbooks.html) If you've categorized your product sales in QuickBooks according to Location, provide the Location name here. Use the following format: `::....` For example: `Location: North America: Canada` \* [**NetSuite:**](https://www.chargebee.com/docs/1.0/netsuite.html) If you've categorized your products in NetSuite under Locations, provide the location name here. Use the following format `: : ....` For example: `NA:US:CA` \* [**Intacct:**](https://www.chargebee.com/docs/1.0/intacct.html) If you've classified your products in Intacct under Dimensions, provide the value of the Dimension here. |
| `accounting_category3` | `string` | No | Used exclusively with the following [accounting integrations](https://www.chargebee.com/docs/1.0/finance-integration-index.html) \* [**NetSuite:**](https://www.chargebee.com/docs/1.0/netsuite.html) If you've categorized your products in NetSuite under Departments, pass the department name here. Use the following format: `: : ....` For example: `Production: Assembly.` \* [**Intacct:**](https://www.chargebee.com/docs/1.0/intacct.html) If you've classified your products in Intacct under multiple Dimensions, provide the value of the second Dimension here. . |
| `accounting_category4` | `string` | No | Used exclusively with the following [accounting integrations](https://www.chargebee.com/docs/1.0/finance-integration-index.html) \* [**NetSuite:**](https://www.chargebee.com/docs/1.0/netsuite.html) Provide the "Revenue Recognition Rule Id" for the product from NetSuite. \* [**Intacct:**](https://www.chargebee.com/docs/1.0/intacct.html) If you have configured "Revenue Recognition Templates" for products in Intacct, provide the template ID for the product. . |
| `is_shippable` | `boolean` | No | If enabled, charges for this plan/addon will be added to orders. |
| `shipping_frequency_period` | `number` | No | Defines the shipping frequency. Example: to bill customer every 2 weeks, provide "2" here. |
| `shipping_frequency_period_unit` | `year \| month \| week \| day` | No | Defines the shipping frequency in association with shipping period. \* day - Ship based on day(s) \* week - Ship based on week(s) \* month - Ship based on month(s) \* year - Ship based on year(s) |
| `included_in_mrr` | `boolean` | No | The addon is included in MRR calculations for your site. This attribute is only applicable for addons of `charge_type = non_recurring` and when the feature is enabled in Chargebee. Note: If the site-level setting is to exclude non-recurring addons from MRR calculations, this value is always returned `false` . |
| `show_description_in_invoices` | `boolean` | No | Whether the [addon description](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object) should be shown on [invoice PDFs](https://docs.corsair.dev/docs/api/invoices/retrieve-invoice-as-pdf). If this Boolean is changed, only invoices generated (or [regenerated](https://www.chargebee.com/docs/invoice-operations.html#actions-for-payment-due-not-paid-invoices_regenerate-invoice) ) after the change are affected; past invoices are not. |
| `show_description_in_quotes` | `boolean` | No | Whether the [addon description](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object) should be shown on [quote PDFs](https://docs.corsair.dev/docs/api/quotes/retrieve-quote-as-pdf). If this Boolean is changed, only quotes created after the change are affected; past quotes are not. |
| `price_in_decimal` | `string` | No | The price of the addon when the `pricing_model` is `flat_fee`. When the pricing model is `per_unit` , it is the price per unit quantity of the item. Not applicable for the other pricing models. The value is in decimal and in major units of the currency. Also, this is only applicable when [multi-decimal pricing](https://docs.corsair.dev/docs/api/v2/pcv-1/currencies) is enabled. This price is for the `period` of the addon. When attached to a plan, the addon is billed for the billing period of the plan. Learn more. |
| `proration_type` | `site_default \| partial_term \| full_term` | No | **Note** Applicable only for addons with [pricing\_model](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object#pricing_model) = `per_unit`. Specifies how to manage charges or credits for the addon during a [subscription update](https://docs.corsair.dev/docs/api/v2/pcv-1/subscriptions/update-a-subscription) or [estimating](https://docs.corsair.dev/docs/api/v2/pcv-1/estimates/update-subscription-estimate) a subscription update. \* full\_term - Charge the full price of the addon item price or give the full credit. Don't apply any proration. \* site\_default - Use the [site-wide proration setting](https://www.chargebee.com/docs/1.0/proration.html#proration-for-subscription-change) . \* partial\_term - Prorate the charges or credits for the rest of the current term. |
| `tiers` | `object` | No | Parameters for tiers |
| `tax_providers_fields` | `object` | No | Parameters for tax\_providers\_fields |

> [accordion] meta\_data full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] tiers full type
>
> ```ts theme={null}
> {
>   starting_unit?: number[],
>   ending_unit?: number[],
>   price?: number[],
>   starting_unit_in_decimal?: string[],
>   ending_unit_in_decimal?: string[],
>   price_in_decimal?: string[]
> }
> ```

> [accordion] tax\_providers\_fields full type
>
> ```ts theme={null}
> {
>   provider_name: string[],
>   field_id: string[],
>   field_value: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `addon` | `object \| null` | No | Addons are additional charges applied to a subscription apart from the base plan charge. The addons can be recurring or non-recurring. A recurring addon included in a subscription is charged as per billing frequency of subscription. A non-recurring addon included in subscription will be charged immediately and only once. And a non-recurring addon is NOT pro-rated based on billing cycle, whereas a recurring addon is automatically pro-rated based on billing cycle. |

> [accordion] addon full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   invoice_name?: string | null,
>   description?: string | null,
>   pricing_model?: string | null,
>   charge_type?: string | null,
>   price?: number | null,
>   currency_code?: string | null,
>   period?: number | null,
>   period_unit?: string | null,
>   unit?: string | null,
>   status?: string | null,
>   archived_at?: number | null,
>   enabled_in_portal?: boolean | null,
>   tax_code?: string | null,
>   hsn_code?: string | null,
>   taxjar_product_code?: string | null,
>   avalara_sale_type?: string | null,
>   avalara_transaction_type?: number | null,
>   avalara_service_type?: number | null,
>   sku?: string | null,
>   accounting_code?: string | null,
>   accounting_category1?: string | null,
>   accounting_category2?: string | null,
>   accounting_category3?: string | null,
>   accounting_category4?: string | null,
>   is_shippable?: boolean | null,
>   shipping_frequency_period?: number | null,
>   shipping_frequency_period_unit?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   price_in_decimal?: string | null,
>   included_in_mrr?: boolean | null,
>   channel?: string | null,
>   proration_type?: string | null,
>   invoice_notes?: string | null,
>   taxable?: boolean | null,
>   tax_profile_id?: string | null,
>   meta_data?: {
>   } | null,
>   show_description_in_invoices?: boolean | null,
>   show_description_in_quotes?: boolean | null,
>   tiers?: {
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null
> } | null
> ```

***

## Addresses

### create

`addresses.create`

Update an address. Adds or replaces the address for a subscription. If an address is already present for the specified label, it will be replaced otherwise new address is added with that label.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.addresses.create({ label: 'example', subscription_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscription_id` | `string` | Yes | A unique and immutable identifier for the subscription. If not provided, it is autogenerated. |
| `label` | `string` | Yes | Label to identify the address. This is unique for all the address for a subscription. |
| `first_name` | `string` | No | First name. |
| `last_name` | `string` | No | Last name. |
| `email` | `string` | No | Email. |
| `company` | `string` | No | Company name. |
| `phone` | `string` | No | Phone number. |
| `addr` | `string` | No | Address line 1. |
| `extended_addr` | `string` | No | Address line 2. |
| `extended_addr2` | `string` | No | Address line 3. |
| `city` | `string` | No | Name of the city. |
| `state_code` | `string` | No | The [ISO 3166-2 state/province code](https://www.iso.org/obp/ui/#search/code) without the country prefix. Currently supported for USA, Canada, India and UAE. 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` ). For Dubai (UAE), set as `DU` (not `AE-DU` ). |
| `state` | `string` | No | The state/province name. Is set by Chargebee automatically for US, Canada, India and UAE, if `state_code` is provided. |
| `zip` | `string` | No | Zip or postal code. The number of characters is validated according to the rules [specified here](https://chromium-i18n.appspot.com/ssl-address) . |
| `country` | `string` | No | 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` | `not_validated \| valid \| partially_valid \| invalid` | No | The address verification status. \* partially\_valid - The address is valid for taxability but has not been validated for shipping. \* not\_validated - Address is not yet validated. \* invalid - Address is invalid. \* valid - Address was validated successfully. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `address` | `object \| null` | No | Subscriptions can have addresses like "Shipping Address" associated with them. This is apart from the billing address as part of credit card information. |

> [accordion] address full type
>
> ```ts theme={null}
> {
>   label?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   company?: string | null,
>   phone?: string | null,
>   addr?: string | null,
>   extended_addr?: string | null,
>   extended_addr2?: string | null,
>   city?: string | null,
>   state_code?: string | null,
>   state?: string | null,
>   country?: string | null,
>   zip?: string | null,
>   validation_status?: string | null,
>   subscription_id?: string | null
> } | null
> ```

***

### list

`addresses.list`

Retrieve an address. Retrieves an address resource for a subscription and the specified label.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.addresses.list({ subscription_id: 'example', label: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `subscription_id` | `string` | Yes | A unique and immutable identifier for the subscription. If not provided, it is autogenerated. |
| `label` | `string` | Yes | Label to identify the address. This is unique for all the address for a subscription. |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `address` | `object \| null` | No | Subscriptions can have addresses like "Shipping Address" associated with them. This is apart from the billing address as part of credit card information. |

> [accordion] address full type
>
> ```ts theme={null}
> {
>   label?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   company?: string | null,
>   phone?: string | null,
>   addr?: string | null,
>   extended_addr?: string | null,
>   extended_addr2?: string | null,
>   city?: string | null,
>   state_code?: string | null,
>   state?: string | null,
>   country?: string | null,
>   zip?: string | null,
>   validation_status?: string | null,
>   subscription_id?: string | null
> } | null
> ```

***

## Alerts

### create

`alerts.create`

Create an alert. Creates a new alert configuration. Depending on type, the alert can monitor usage, spend, or credit balance, and it can be global or subscription-scoped depending on whether subscription\_id is provided. Note: Creating an alert defines the threshold rule only.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.alerts.create({ name: 'example', type: 'usage_exceeded' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `type` | `usage_exceeded \| spend_exceeded \| credit_balance_dropped` | Yes | The type of alert to create. Determines what the alert measures, which input it requires, and how the `threshold` is interpreted. \* credit\_balance\_dropped - The alert fires when the [credit balance](https://docs.corsair.dev/docs/api/ledger_account_balances) for the configured credit unit drops to or below the configured threshold. The `threshold` mode is always `absolute`. \* usage\_exceeded - The alert fires when usage of the [metered feature](https://docs.corsair.dev/docs/api/usages) (identified by `metered_feature_id`) reaches or exceeds the configured threshold. Supports both `percentage` and `absolute` threshold modes. \* spend\_exceeded - The alert fires when the total usage-based spend accumulated from metered addons reaches or exceeds the configured threshold. Only spend from usage beyond the included entitlement is counted. See [usage charges](https://docs.corsair.dev/docs/api/usage_charges) for how overage spend is computed. The `threshold` mode is always `absolute`. |
| `name` | `string` | Yes | A human-readable name for the alert. Maximum 50 characters. |
| `description` | `string` | No | An optional description providing additional context about the alert. Maximum 65,000 characters. |
| `metered_feature_id` | `string` | No | Identifier of the [metered feature](https://docs.corsair.dev/docs/api/usages) that the alert should monitor. Required when `type` is `usage_exceeded`; do not set it for other alert types. |
| `currency_code` | `string` | No | The ISO [currency code](https://docs.corsair.dev/docs/api/currencies/currency-object#currency_code) in which the metered-addon overage spend is measured. Required when `type` is `spend_exceeded`; do not set it for other alert types. |
| `unit_id` | `string` | No | Identifier of the credit unit that the alert should monitor. Required when `type` is `credit_balance_dropped`; do not set it for other alert types. |
| `subscription_id` | `string` | No | The identifier of the [subscription](https://docs.corsair.dev/docs/api/subscriptions) to scope this alert to. If omitted, the alert is created as a global alert. If provided, `filter_conditions` must not be set. |
| `meta` | `string` | No | An optional string field for storing custom metadata with the alert (for example, JSON serialized by your integration). Maximum 65,000 characters. |
| `threshold` | `object` | No | The threshold configuration that defines when this alert fires. |
| `filter_conditions` | `object` | No | An array of conditions that restrict which subscriptions a global alert applies to. Multiple conditions are evaluated with OR logic. Cannot be set when `subscription_id` is provided. |

> [accordion] threshold full type
>
> ```ts theme={null}
> {
>   mode?: absolute | percentage,
>   value: number
> }
> ```

> [accordion] filter\_conditions full type
>
> ```ts theme={null}
> {
>   field?: plan_price_id[],
>   operator?: (equals | not_equals)[],
>   value?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `alert` | `object \| null` | No | An alert defines a threshold rule for usage, spend, or credit balance. When the configured threshold is crossed, Chargebee triggers a webhook notification so that you can take action such as notifying the customer, upgrading the plan, or pausing further consumption. Common examples of alerts include: \* Notifying a customer when they have consumed 90% of their monthly API call quota. \* Alerting your operations team when a customer's spend exceeds a monthly limit. \* Warning a customer when their prepaid credit balance drops to or below a replenishment threshold. The alert resource represents configuration only. To check the current runtime state of an alert for a subscription (whether it is `within_limit` or `in_alarm`), use the [Alert Status](https://docs.corsair.dev/docs/api/alert_statuses) endpoints. #### Global vs. subscription-scoped alerts Alerts can be created at two levels: \* **Global alerts** apply across all relevant subscriptions. To restrict a global alert to specific plans, use `filter_conditions` with the `plan_price_id` field. When multiple filter conditions are provided, they are evaluated with OR semantics: the alert applies if any condition matches. \* **Subscription-scoped alerts** apply to a single subscription only. Set `subscription_id` when creating the alert. Subscription-scoped alerts cannot have `filter_conditions`. **Important** A global alert and a subscription-scoped alert are mutually exclusive in their parameters: if `subscription_id` is set, `filter_conditions` must not be provided, and vice versa. #### Alert types The `type` attribute determines what an alert measures, which input it requires, and how the threshold is interpreted. usage\_exceeded Monitors consumption of a [metered feature](https://docs.corsair.dev/docs/api/usages) for a subscription. \* **Required input:** `metered_feature_id`. \* **Fires when:** measured usage reaches or exceeds the configured threshold. \* **Threshold modes:** `percentage` (of the plan or feature quota) or `absolute` (a usage quantity). \* **Example:** notify a customer when they reach 90% of their monthly API-call quota. Usage alerts are evaluated as [usage data](https://docs.corsair.dev/docs/api/usage_events) is processed for the subscription. spend\_exceeded Monitors the total usage-based spend accumulated from metered addons on a subscription. This is the same overage concept surfaced by [usage charges](https://docs.corsair.dev/docs/api/usage_charges): the monetary overage spend corresponds to the [amount](https://docs.corsair.dev/docs/api/usage_charges/usage-charge-object#amount) field on the usage charge object (in major units of the currency). \* **Required input:** `currency_code` --- the ISO [currency code](https://docs.corsair.dev/docs/api/currencies/currency-object#currency_code) in which overage spend is tracked. \* **Fires when:** accumulated overage spend reaches or exceeds the configured threshold. \* **Threshold mode:** always `absolute` (an amount in `currency_code`). \* **Example:** alert the customer when their spending exceeds a 500 USD limit during the current usage cycle. Spend alerts are evaluated as usage and overage charge data is processed for the subscription. credit\_balance\_dropped Monitors the prepaid credit balance of a subscription for a specific credit unit. See [ledger account balances](https://docs.corsair.dev/docs/api/ledger_account_balances) for how credit balances are tracked. \* **Required input:** `unit_id` --- the [credit unit](https://docs.corsair.dev/docs/api/ledger_account_balances/ledger-account-balance-object#unit_id) the alert applies to (for example, `ai_credits`). \* **Fires when:** the credit balance drops to or below the configured threshold. This is the opposite direction to the `usage_exceeded` and `spend_exceeded` types, which fire when a value rises. \* **Threshold mode:** always `absolute` (a credit-balance floor). `percentage` mode is not supported. \* **Example:** warn a customer when their remaining AI credits drop to or below 10. Credit-balance alerts are evaluated as [ledger operations](https://docs.corsair.dev/docs/api/ledger_operations) update the balance. #### Threshold modes The `threshold` object defines when the alert should fire. It has two fields: \* `mode`: Either `percentage` or `absolute`. \* `percentage`: The alert fires when the measured value reaches the specified percentage threshold. The `value` must be between 0 and 100 (inclusive). Supported only for `usage_exceeded` alerts. \* `absolute`: The alert fires when the measured value reaches an absolute quantity. The `value` must be \\>= 0. \* `value`: The numeric threshold at which the alert triggers. The supported modes depend on the alert `type`: \* `usage_exceeded`: `percentage` or `absolute`. \* `spend_exceeded`: `absolute` only. \* `credit_balance_dropped`: `absolute` only. **See also** \* [Alert Statuses](https://docs.corsair.dev/docs/api/alert_statuses) --- runtime state of alerts per subscription. \* [Usage Events](https://docs.corsair.dev/docs/api/usage_events) --- usage ingestion for `usage_exceeded` alerts. \* [Ledger account balances](https://docs.corsair.dev/docs/api/ledger_account_balances) --- credit balances for `credit_balance_dropped` alerts. |

> [accordion] alert full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   type?: string | null,
>   name?: string | null,
>   description?: string | null,
>   metered_feature_id?: string | null,
>   currency_code?: string | null,
>   unit_id?: string | null,
>   subscription_id?: string | null,
>   status?: string | null,
>   meta?: string | null,
>   created_at?: number | null,
>   updated_at?: number | null,
>   threshold?: {
>     mode?: string | null,
>     value?: number | null
>   } | null,
>   filter_conditions?: {
>     field?: string | null,
>     operator?: string | null,
>     value?: string | null
>   }[] | null
> } | null
> ```

***

### delete

`alerts.delete`

Delete an alert. Deletes an alert configuration. Only subscription-scoped alerts can be deleted using this endpoint. Important This operation cannot delete global alerts. To stop a global alert from firing, update the alert and set status to disabled instead.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.alerts.delete({ alertId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `alertId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `alert` | `object \| null` | No | An alert defines a threshold rule for usage, spend, or credit balance. When the configured threshold is crossed, Chargebee triggers a webhook notification so that you can take action such as notifying the customer, upgrading the plan, or pausing further consumption. Common examples of alerts include: \* Notifying a customer when they have consumed 90% of their monthly API call quota. \* Alerting your operations team when a customer's spend exceeds a monthly limit. \* Warning a customer when their prepaid credit balance drops to or below a replenishment threshold. The alert resource represents configuration only. To check the current runtime state of an alert for a subscription (whether it is `within_limit` or `in_alarm`), use the [Alert Status](https://docs.corsair.dev/docs/api/alert_statuses) endpoints. #### Global vs. subscription-scoped alerts Alerts can be created at two levels: \* **Global alerts** apply across all relevant subscriptions. To restrict a global alert to specific plans, use `filter_conditions` with the `plan_price_id` field. When multiple filter conditions are provided, they are evaluated with OR semantics: the alert applies if any condition matches. \* **Subscription-scoped alerts** apply to a single subscription only. Set `subscription_id` when creating the alert. Subscription-scoped alerts cannot have `filter_conditions`. **Important** A global alert and a subscription-scoped alert are mutually exclusive in their parameters: if `subscription_id` is set, `filter_conditions` must not be provided, and vice versa. #### Alert types The `type` attribute determines what an alert measures, which input it requires, and how the threshold is interpreted. usage\_exceeded Monitors consumption of a [metered feature](https://docs.corsair.dev/docs/api/usages) for a subscription. \* **Required input:** `metered_feature_id`. \* **Fires when:** measured usage reaches or exceeds the configured threshold. \* **Threshold modes:** `percentage` (of the plan or feature quota) or `absolute` (a usage quantity). \* **Example:** notify a customer when they reach 90% of their monthly API-call quota. Usage alerts are evaluated as [usage data](https://docs.corsair.dev/docs/api/usage_events) is processed for the subscription. spend\_exceeded Monitors the total usage-based spend accumulated from metered addons on a subscription. This is the same overage concept surfaced by [usage charges](https://docs.corsair.dev/docs/api/usage_charges): the monetary overage spend corresponds to the [amount](https://docs.corsair.dev/docs/api/usage_charges/usage-charge-object#amount) field on the usage charge object (in major units of the currency). \* **Required input:** `currency_code` --- the ISO [currency code](https://docs.corsair.dev/docs/api/currencies/currency-object#currency_code) in which overage spend is tracked. \* **Fires when:** accumulated overage spend reaches or exceeds the configured threshold. \* **Threshold mode:** always `absolute` (an amount in `currency_code`). \* **Example:** alert the customer when their spending exceeds a 500 USD limit during the current usage cycle. Spend alerts are evaluated as usage and overage charge data is processed for the subscription. credit\_balance\_dropped Monitors the prepaid credit balance of a subscription for a specific credit unit. See [ledger account balances](https://docs.corsair.dev/docs/api/ledger_account_balances) for how credit balances are tracked. \* **Required input:** `unit_id` --- the [credit unit](https://docs.corsair.dev/docs/api/ledger_account_balances/ledger-account-balance-object#unit_id) the alert applies to (for example, `ai_credits`). \* **Fires when:** the credit balance drops to or below the configured threshold. This is the opposite direction to the `usage_exceeded` and `spend_exceeded` types, which fire when a value rises. \* **Threshold mode:** always `absolute` (a credit-balance floor). `percentage` mode is not supported. \* **Example:** warn a customer when their remaining AI credits drop to or below 10. Credit-balance alerts are evaluated as [ledger operations](https://docs.corsair.dev/docs/api/ledger_operations) update the balance. #### Threshold modes The `threshold` object defines when the alert should fire. It has two fields: \* `mode`: Either `percentage` or `absolute`. \* `percentage`: The alert fires when the measured value reaches the specified percentage threshold. The `value` must be between 0 and 100 (inclusive). Supported only for `usage_exceeded` alerts. \* `absolute`: The alert fires when the measured value reaches an absolute quantity. The `value` must be \\>= 0. \* `value`: The numeric threshold at which the alert triggers. The supported modes depend on the alert `type`: \* `usage_exceeded`: `percentage` or `absolute`. \* `spend_exceeded`: `absolute` only. \* `credit_balance_dropped`: `absolute` only. **See also** \* [Alert Statuses](https://docs.corsair.dev/docs/api/alert_statuses) --- runtime state of alerts per subscription. \* [Usage Events](https://docs.corsair.dev/docs/api/usage_events) --- usage ingestion for `usage_exceeded` alerts. \* [Ledger account balances](https://docs.corsair.dev/docs/api/ledger_account_balances) --- credit balances for `credit_balance_dropped` alerts. |

> [accordion] alert full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   type?: string | null,
>   name?: string | null,
>   description?: string | null,
>   metered_feature_id?: string | null,
>   currency_code?: string | null,
>   unit_id?: string | null,
>   subscription_id?: string | null,
>   status?: string | null,
>   meta?: string | null,
>   created_at?: number | null,
>   updated_at?: number | null,
>   threshold?: {
>     mode?: string | null,
>     value?: number | null
>   } | null,
>   filter_conditions?: {
>     field?: string | null,
>     operator?: string | null,
>     value?: string | null
>   }[] | null
> } | null
> ```

***

### get

`alerts.get`

Retrieve an alert. Retrieves a single alert configuration by alert\_id. This returns the rule definition only and does not include runtime evaluation state. Note: To check whether a subscription is currently within\_limit or in\_alarm for this alert, use List alert statuses for an alert.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.alerts.get({ alertId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `alertId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `alert` | `object \| null` | No | An alert defines a threshold rule for usage, spend, or credit balance. When the configured threshold is crossed, Chargebee triggers a webhook notification so that you can take action such as notifying the customer, upgrading the plan, or pausing further consumption. Common examples of alerts include: \* Notifying a customer when they have consumed 90% of their monthly API call quota. \* Alerting your operations team when a customer's spend exceeds a monthly limit. \* Warning a customer when their prepaid credit balance drops to or below a replenishment threshold. The alert resource represents configuration only. To check the current runtime state of an alert for a subscription (whether it is `within_limit` or `in_alarm`), use the [Alert Status](https://docs.corsair.dev/docs/api/alert_statuses) endpoints. #### Global vs. subscription-scoped alerts Alerts can be created at two levels: \* **Global alerts** apply across all relevant subscriptions. To restrict a global alert to specific plans, use `filter_conditions` with the `plan_price_id` field. When multiple filter conditions are provided, they are evaluated with OR semantics: the alert applies if any condition matches. \* **Subscription-scoped alerts** apply to a single subscription only. Set `subscription_id` when creating the alert. Subscription-scoped alerts cannot have `filter_conditions`. **Important** A global alert and a subscription-scoped alert are mutually exclusive in their parameters: if `subscription_id` is set, `filter_conditions` must not be provided, and vice versa. #### Alert types The `type` attribute determines what an alert measures, which input it requires, and how the threshold is interpreted. usage\_exceeded Monitors consumption of a [metered feature](https://docs.corsair.dev/docs/api/usages) for a subscription. \* **Required input:** `metered_feature_id`. \* **Fires when:** measured usage reaches or exceeds the configured threshold. \* **Threshold modes:** `percentage` (of the plan or feature quota) or `absolute` (a usage quantity). \* **Example:** notify a customer when they reach 90% of their monthly API-call quota. Usage alerts are evaluated as [usage data](https://docs.corsair.dev/docs/api/usage_events) is processed for the subscription. spend\_exceeded Monitors the total usage-based spend accumulated from metered addons on a subscription. This is the same overage concept surfaced by [usage charges](https://docs.corsair.dev/docs/api/usage_charges): the monetary overage spend corresponds to the [amount](https://docs.corsair.dev/docs/api/usage_charges/usage-charge-object#amount) field on the usage charge object (in major units of the currency). \* **Required input:** `currency_code` --- the ISO [currency code](https://docs.corsair.dev/docs/api/currencies/currency-object#currency_code) in which overage spend is tracked. \* **Fires when:** accumulated overage spend reaches or exceeds the configured threshold. \* **Threshold mode:** always `absolute` (an amount in `currency_code`). \* **Example:** alert the customer when their spending exceeds a 500 USD limit during the current usage cycle. Spend alerts are evaluated as usage and overage charge data is processed for the subscription. credit\_balance\_dropped Monitors the prepaid credit balance of a subscription for a specific credit unit. See [ledger account balances](https://docs.corsair.dev/docs/api/ledger_account_balances) for how credit balances are tracked. \* **Required input:** `unit_id` --- the [credit unit](https://docs.corsair.dev/docs/api/ledger_account_balances/ledger-account-balance-object#unit_id) the alert applies to (for example, `ai_credits`). \* **Fires when:** the credit balance drops to or below the configured threshold. This is the opposite direction to the `usage_exceeded` and `spend_exceeded` types, which fire when a value rises. \* **Threshold mode:** always `absolute` (a credit-balance floor). `percentage` mode is not supported. \* **Example:** warn a customer when their remaining AI credits drop to or below 10. Credit-balance alerts are evaluated as [ledger operations](https://docs.corsair.dev/docs/api/ledger_operations) update the balance. #### Threshold modes The `threshold` object defines when the alert should fire. It has two fields: \* `mode`: Either `percentage` or `absolute`. \* `percentage`: The alert fires when the measured value reaches the specified percentage threshold. The `value` must be between 0 and 100 (inclusive). Supported only for `usage_exceeded` alerts. \* `absolute`: The alert fires when the measured value reaches an absolute quantity. The `value` must be \\>= 0. \* `value`: The numeric threshold at which the alert triggers. The supported modes depend on the alert `type`: \* `usage_exceeded`: `percentage` or `absolute`. \* `spend_exceeded`: `absolute` only. \* `credit_balance_dropped`: `absolute` only. **See also** \* [Alert Statuses](https://docs.corsair.dev/docs/api/alert_statuses) --- runtime state of alerts per subscription. \* [Usage Events](https://docs.corsair.dev/docs/api/usage_events) --- usage ingestion for `usage_exceeded` alerts. \* [Ledger account balances](https://docs.corsair.dev/docs/api/ledger_account_balances) --- credit balances for `credit_balance_dropped` alerts. |

> [accordion] alert full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   type?: string | null,
>   name?: string | null,
>   description?: string | null,
>   metered_feature_id?: string | null,
>   currency_code?: string | null,
>   unit_id?: string | null,
>   subscription_id?: string | null,
>   status?: string | null,
>   meta?: string | null,
>   created_at?: number | null,
>   updated_at?: number | null,
>   threshold?: {
>     mode?: string | null,
>     value?: number | null
>   } | null,
>   filter_conditions?: {
>     field?: string | null,
>     operator?: string | null,
>     value?: string | null
>   }[] | null
> } | null
> ```

***

### list

`alerts.list`

List alerts. Returns a list of alert configurations meeting all the conditions specified in the filter parameters below. Results include both global and subscription-scoped alerts.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.alerts.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | optional, integer Maximum number of results to return. **Example →** *limit = 10* |
| `offset` | `string` | No | optional, string Pagination cursor returned by a previous list call. Use the `next_offset` value from the previous response. **Example →** *offset = "MjAyNC0xMi0yMFQxMjozMjo1MSswMDowMHw5OTk5OTk5OTk="* |
| `id` | `object` | No | optional, string filter Filter alerts by [id](https://docs.corsair.dev/docs/api/alerts/alert-object#id). **Example →** *id\\\[in\\] = "alert\_\_\_dev\_\_3Nl7purV3LwbKYH"* |
| `type` | `object` | No | optional, enumerated string filter Filter by [type](https://docs.corsair.dev/docs/api/alerts/alert-object#type). Supported values are `usage_exceeded`, `spend_exceeded`, and `credit_balance_dropped`. **Example →** *type\\\[is\\] = "credit\_balance\_dropped"* |
| `subscription_id` | `object` | No | optional, string filter Filter by [subscription\_id](https://docs.corsair.dev/docs/api/alerts/alert-object#subscription_id) to find alerts scoped to a specific subscription. **Example →** *subscription\_id\\\[is\\] = "sub\_KyV2S7Qm8tL7p"* |
| `status` | `object` | No | optional, enumerated string filter Filter by [status](https://docs.corsair.dev/docs/api/alerts/alert-object#status). **Example →** *status\\\[is\\] = "enabled"* |

> [accordion] id full type
>
> ```ts theme={null}
> {
>   in?: string
> }
> ```

> [accordion] type full type
>
> ```ts theme={null}
> {
>   is?: usage_exceeded | spend_exceeded | credit_balance_dropped
> }
> ```

> [accordion] subscription\_id full type
>
> ```ts theme={null}
> {
>   is?: string
> }
> ```

> [accordion] status full type
>
> ```ts theme={null}
> {
>   is?: enabled | disabled
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | Returned only if more results are available. Pass this value as `offset` in the next request to fetch the next page. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   alert?: {
>     id?: string | null,
>     type?: string | null,
>     name?: string | null,
>     description?: string | null,
>     metered_feature_id?: string | null,
>     currency_code?: string | null,
>     unit_id?: string | null,
>     subscription_id?: string | null,
>     status?: string | null,
>     meta?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     threshold?: {
>       mode?: string | null,
>       value?: number | null
>     } | null,
>     filter_conditions?: {
>       field?: string | null,
>       operator?: string | null,
>       value?: string | null
>     }[] | null
>   } | null
> }[] | null
> ```

***

### listStatuses

`alerts.listStatuses`

List alert statuses for an alert. Returns the runtime state of a specific alert across all impacted subscriptions. Each entry indicates whether a subscription is within\_limit or in\_alarm for the given alert.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.alerts.listStatuses({ alertId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `alertId` | `string` | Yes | — |
| `limit` | `number` | No | optional, integer Maximum number of results to return. **Example →** *limit = 25* |
| `offset` | `string` | No | optional, string Pagination cursor returned by a previous list call. Use the `next_offset` value from the previous response. |
| `alarm_status` | `object` | No | optional, enumerated string filter Filter by [alarm\_status](https://docs.corsair.dev/docs/api/alert_statuses/alert-status-object#alarm_status) to find subscriptions in a specific runtime state. **Example →** *alarm\_status\\\[is\\] = "in\_alarm"* |

> [accordion] alarm\_status full type
>
> ```ts theme={null}
> {
>   is?: within_limit | in_alarm
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | Returned only if more results are available. Pass this value as `offset` in the next request to fetch the next page. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   alert_status?: {
>     alert_id?: string | null,
>     subscription_id?: string | null,
>     alarm_status?: string | null,
>     alarm_triggered_at?: number | null
>   } | null
> }[] | null
> ```

***

### update

`alerts.update`

Update an alert. Updates an existing alert configuration. Use this to change the threshold values or toggle the status between enabled and disabled. ### Impacts Alert status on threshold change When the threshold is updated for an alert, the alarm\_status for all impacted subscriptions is reset to within\_limit.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.alerts.update({ alertId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `alertId` | `string` | Yes | — |
| `status` | `enabled \| disabled` | No | Set to `enabled` to activate the alert or `disabled` to deactivate it. \* enabled - The alert is active and will trigger when the threshold is breached. \* disabled - The alert is inactive and will not trigger. |
| `threshold` | `object` | No | The threshold configuration that defines when this alert fires. Only the fields provided are updated. |

> [accordion] threshold full type
>
> ```ts theme={null}
> {
>   mode?: absolute | percentage,
>   value?: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `alert` | `object \| null` | No | An alert defines a threshold rule for usage, spend, or credit balance. When the configured threshold is crossed, Chargebee triggers a webhook notification so that you can take action such as notifying the customer, upgrading the plan, or pausing further consumption. Common examples of alerts include: \* Notifying a customer when they have consumed 90% of their monthly API call quota. \* Alerting your operations team when a customer's spend exceeds a monthly limit. \* Warning a customer when their prepaid credit balance drops to or below a replenishment threshold. The alert resource represents configuration only. To check the current runtime state of an alert for a subscription (whether it is `within_limit` or `in_alarm`), use the [Alert Status](https://docs.corsair.dev/docs/api/alert_statuses) endpoints. #### Global vs. subscription-scoped alerts Alerts can be created at two levels: \* **Global alerts** apply across all relevant subscriptions. To restrict a global alert to specific plans, use `filter_conditions` with the `plan_price_id` field. When multiple filter conditions are provided, they are evaluated with OR semantics: the alert applies if any condition matches. \* **Subscription-scoped alerts** apply to a single subscription only. Set `subscription_id` when creating the alert. Subscription-scoped alerts cannot have `filter_conditions`. **Important** A global alert and a subscription-scoped alert are mutually exclusive in their parameters: if `subscription_id` is set, `filter_conditions` must not be provided, and vice versa. #### Alert types The `type` attribute determines what an alert measures, which input it requires, and how the threshold is interpreted. usage\_exceeded Monitors consumption of a [metered feature](https://docs.corsair.dev/docs/api/usages) for a subscription. \* **Required input:** `metered_feature_id`. \* **Fires when:** measured usage reaches or exceeds the configured threshold. \* **Threshold modes:** `percentage` (of the plan or feature quota) or `absolute` (a usage quantity). \* **Example:** notify a customer when they reach 90% of their monthly API-call quota. Usage alerts are evaluated as [usage data](https://docs.corsair.dev/docs/api/usage_events) is processed for the subscription. spend\_exceeded Monitors the total usage-based spend accumulated from metered addons on a subscription. This is the same overage concept surfaced by [usage charges](https://docs.corsair.dev/docs/api/usage_charges): the monetary overage spend corresponds to the [amount](https://docs.corsair.dev/docs/api/usage_charges/usage-charge-object#amount) field on the usage charge object (in major units of the currency). \* **Required input:** `currency_code` --- the ISO [currency code](https://docs.corsair.dev/docs/api/currencies/currency-object#currency_code) in which overage spend is tracked. \* **Fires when:** accumulated overage spend reaches or exceeds the configured threshold. \* **Threshold mode:** always `absolute` (an amount in `currency_code`). \* **Example:** alert the customer when their spending exceeds a 500 USD limit during the current usage cycle. Spend alerts are evaluated as usage and overage charge data is processed for the subscription. credit\_balance\_dropped Monitors the prepaid credit balance of a subscription for a specific credit unit. See [ledger account balances](https://docs.corsair.dev/docs/api/ledger_account_balances) for how credit balances are tracked. \* **Required input:** `unit_id` --- the [credit unit](https://docs.corsair.dev/docs/api/ledger_account_balances/ledger-account-balance-object#unit_id) the alert applies to (for example, `ai_credits`). \* **Fires when:** the credit balance drops to or below the configured threshold. This is the opposite direction to the `usage_exceeded` and `spend_exceeded` types, which fire when a value rises. \* **Threshold mode:** always `absolute` (a credit-balance floor). `percentage` mode is not supported. \* **Example:** warn a customer when their remaining AI credits drop to or below 10. Credit-balance alerts are evaluated as [ledger operations](https://docs.corsair.dev/docs/api/ledger_operations) update the balance. #### Threshold modes The `threshold` object defines when the alert should fire. It has two fields: \* `mode`: Either `percentage` or `absolute`. \* `percentage`: The alert fires when the measured value reaches the specified percentage threshold. The `value` must be between 0 and 100 (inclusive). Supported only for `usage_exceeded` alerts. \* `absolute`: The alert fires when the measured value reaches an absolute quantity. The `value` must be \\>= 0. \* `value`: The numeric threshold at which the alert triggers. The supported modes depend on the alert `type`: \* `usage_exceeded`: `percentage` or `absolute`. \* `spend_exceeded`: `absolute` only. \* `credit_balance_dropped`: `absolute` only. **See also** \* [Alert Statuses](https://docs.corsair.dev/docs/api/alert_statuses) --- runtime state of alerts per subscription. \* [Usage Events](https://docs.corsair.dev/docs/api/usage_events) --- usage ingestion for `usage_exceeded` alerts. \* [Ledger account balances](https://docs.corsair.dev/docs/api/ledger_account_balances) --- credit balances for `credit_balance_dropped` alerts. |

> [accordion] alert full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   type?: string | null,
>   name?: string | null,
>   description?: string | null,
>   metered_feature_id?: string | null,
>   currency_code?: string | null,
>   unit_id?: string | null,
>   subscription_id?: string | null,
>   status?: string | null,
>   meta?: string | null,
>   created_at?: number | null,
>   updated_at?: number | null,
>   threshold?: {
>     mode?: string | null,
>     value?: number | null
>   } | null,
>   filter_conditions?: {
>     field?: string | null,
>     operator?: string | null,
>     value?: string | null
>   }[] | null
> } | null
> ```

***

## Attached Items

### delete

`attachedItems.delete`

Delete an attached item. Deletes an attached addon or a charge item.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.attachedItems.delete({ attachedItemId: 'example', parent_item_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `attachedItemId` | `string` | Yes | — |
| `parent_item_id` | `string` | Yes | The id of the addon or charge that is being attached to the plan-item. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `attached_item` | `object \| null` | No | Addon-item and charge-item prices are purchased with plan-item prices in subscriptions. You can automate this process by configuring certain addons and charges as "attached" to certain plans. This is done at the "item" level. In other words, addon- and charge-items can be attached to plan-items. Once the attachment is defined, while creating or updating a subscription, the addon- or charge-item prices are selected automatically based on the plan-item price selected . Let's look at the details: ### Addons Addons can be attached to plans as `recommended`, `mandatory` or `optional`. \* When an addon is attached as `recommended` for a plan, the addon is suggested to be applied to subscriptions for the plan in [Checkout](https://www.chargebee.com/docs/2.0/configure-inapp.html#fundamental-settings_recommending-addons-in-checkout) and [Self-Serve Portal](https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html#allow-change-subscription). Alternatively, if you build your own payment pages or have a sales team, you can suggest recommended addons to your customers or salespeople on your website or CRM respectively \* When an addon is attached as `mandatory` for a plan, the addon gets applied to subscriptions for the plan compulsorily, unless [removed explicitly](https://docs.corsair.dev/docs/api/subscriptions). If you do not pass an item price for a mandatory addon when including the plan in a subscription, an addon-item price is automatically applied as explained below. \* Attaching an addon as `optional` neither marks it as recommended or mandatory but allows you a way to set a `quantity` and `billing_cycles` for the addon, for when it is applied to subscriptions with the plan. How auto-selection of the addon-item price works ------------------------------------------------ Once an addon has been attached as mandatory, the addon-item price to be applied to the plan-item price is selected based on the following rule: The addon-item price with the same currency as that of the plan-item price and the longest compatible period is selected. Here's an example: Consider a plan **Standard Cloud Storage** has an addon **Extra Storage** attached to it. Note that each of the two are items. Now consider that they have item prices with the following periods and currencies: **Item price for "Standard Cloud Storage" plan-item:** \* Standard Cloud Storage, 3 years, AUD. **Item prices for "Extra Storage" addon-item:** \* Extra Storage, 1 year, EUR. \* Extra Storage, 1 year, USD. \* Extra Storage, 1 year, AUD. \* Extra Storage, 18 months, AUD. \* Extra Storage, 2 years, AUD. \* Extra Storage, 30 months, AUD. For the plan-item price (Standard Cloud Storage, 3 years, AUD), the addon-item prices with matching currencies are the last 4 from the above list: \* Extra Storage, 1 year, AUD. \* Extra Storage, 18 months, AUD. \* Extra Storage, 2 years, AUD. \* Extra Storage, 30 months, AUD. From among them, the last two have periods that are incompatible with the plan-item price period of 3 years. From the remaining 2 addon-item prices, the one with the longest period is of 18 months. So, "Extra Storage, 18 months, AUD" is selected for mandatory application to the plan item price. ### Charges Charges can also be attached to plans. When doing so, you specify [the event](https://docs.corsair.dev/docs/api/attached_items/attached_item-object#charge_on_event) at which the charge is to be applied to the subscription. For some events that can occur multiple times in a subscription lifetime, you can also set whether to apply the charge each time the event occurs or just once. There may be multiple item prices for a given attached charge. The item price that matches the currency of the plan-item price is automatically selected for application. Here's an example: Consider a plan **Standard Cloud Storage** has a charge named **Implementation Fee** attached to it. Now consider their item prices below, with the following periods and currencies: **Item price for "Standard Cloud Storage" plan-item:** \* Standard Cloud Storage, 3 years, AUD. **Item prices for "Implementation Fee" charge-item:** \* Implementation Fee, USD. \* Implementation Fee, AUD. \* Implementation Fee, EUR. From among the charge-item prices above, the one compatible with the plan-item price is "Implementation Fee, AUD" since it has the same currency as the plan-item price. |

> [accordion] attached\_item full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   parent_item_id?: string | null,
>   item_id?: string | null,
>   type?: string | null,
>   status?: string | null,
>   quantity?: number | null,
>   quantity_in_decimal?: string | null,
>   billing_cycles?: number | null,
>   charge_on_event?: string | null,
>   charge_once?: boolean | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null
> } | null
> ```

***

### get

`attachedItems.get`

Retrieve an attached item. Retrieves details of an attached addon or a charge item.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.attachedItems.get({ parent_item_id: 'example', attachedItemId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `parent_item_id` | `string` | Yes | The `id` of the plan-item to which the item is attached. |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `attachedItemId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `attached_item` | `object \| null` | No | Addon-item and charge-item prices are purchased with plan-item prices in subscriptions. You can automate this process by configuring certain addons and charges as "attached" to certain plans. This is done at the "item" level. In other words, addon- and charge-items can be attached to plan-items. Once the attachment is defined, while creating or updating a subscription, the addon- or charge-item prices are selected automatically based on the plan-item price selected . Let's look at the details: ### Addons Addons can be attached to plans as `recommended`, `mandatory` or `optional`. \* When an addon is attached as `recommended` for a plan, the addon is suggested to be applied to subscriptions for the plan in [Checkout](https://www.chargebee.com/docs/2.0/configure-inapp.html#fundamental-settings_recommending-addons-in-checkout) and [Self-Serve Portal](https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html#allow-change-subscription). Alternatively, if you build your own payment pages or have a sales team, you can suggest recommended addons to your customers or salespeople on your website or CRM respectively \* When an addon is attached as `mandatory` for a plan, the addon gets applied to subscriptions for the plan compulsorily, unless [removed explicitly](https://docs.corsair.dev/docs/api/subscriptions). If you do not pass an item price for a mandatory addon when including the plan in a subscription, an addon-item price is automatically applied as explained below. \* Attaching an addon as `optional` neither marks it as recommended or mandatory but allows you a way to set a `quantity` and `billing_cycles` for the addon, for when it is applied to subscriptions with the plan. How auto-selection of the addon-item price works ------------------------------------------------ Once an addon has been attached as mandatory, the addon-item price to be applied to the plan-item price is selected based on the following rule: The addon-item price with the same currency as that of the plan-item price and the longest compatible period is selected. Here's an example: Consider a plan **Standard Cloud Storage** has an addon **Extra Storage** attached to it. Note that each of the two are items. Now consider that they have item prices with the following periods and currencies: **Item price for "Standard Cloud Storage" plan-item:** \* Standard Cloud Storage, 3 years, AUD. **Item prices for "Extra Storage" addon-item:** \* Extra Storage, 1 year, EUR. \* Extra Storage, 1 year, USD. \* Extra Storage, 1 year, AUD. \* Extra Storage, 18 months, AUD. \* Extra Storage, 2 years, AUD. \* Extra Storage, 30 months, AUD. For the plan-item price (Standard Cloud Storage, 3 years, AUD), the addon-item prices with matching currencies are the last 4 from the above list: \* Extra Storage, 1 year, AUD. \* Extra Storage, 18 months, AUD. \* Extra Storage, 2 years, AUD. \* Extra Storage, 30 months, AUD. From among them, the last two have periods that are incompatible with the plan-item price period of 3 years. From the remaining 2 addon-item prices, the one with the longest period is of 18 months. So, "Extra Storage, 18 months, AUD" is selected for mandatory application to the plan item price. ### Charges Charges can also be attached to plans. When doing so, you specify [the event](https://docs.corsair.dev/docs/api/attached_items/attached_item-object#charge_on_event) at which the charge is to be applied to the subscription. For some events that can occur multiple times in a subscription lifetime, you can also set whether to apply the charge each time the event occurs or just once. There may be multiple item prices for a given attached charge. The item price that matches the currency of the plan-item price is automatically selected for application. Here's an example: Consider a plan **Standard Cloud Storage** has a charge named **Implementation Fee** attached to it. Now consider their item prices below, with the following periods and currencies: **Item price for "Standard Cloud Storage" plan-item:** \* Standard Cloud Storage, 3 years, AUD. **Item prices for "Implementation Fee" charge-item:** \* Implementation Fee, USD. \* Implementation Fee, AUD. \* Implementation Fee, EUR. From among the charge-item prices above, the one compatible with the plan-item price is "Implementation Fee, AUD" since it has the same currency as the plan-item price. |

> [accordion] attached\_item full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   parent_item_id?: string | null,
>   item_id?: string | null,
>   type?: string | null,
>   status?: string | null,
>   quantity?: number | null,
>   quantity_in_decimal?: string | null,
>   billing_cycles?: number | null,
>   charge_on_event?: string | null,
>   charge_once?: boolean | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null
> } | null
> ```

***

### update

`attachedItems.update`

Update an attached item. Updates an attached addon or a charge item for a plan.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.attachedItems.update({ attachedItemId: 'example', parent_item_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `attachedItemId` | `string` | Yes | — |
| `parent_item_id` | `string` | Yes | The id of the parent item in the attachment relationship. |
| `type` | `recommended \| mandatory \| optional` | No | The type of attachment for the addon. Only applicable for addon-items and is a required parameter as well for addon-items. \* recommended - The addon is recommended to go with the plan-item when using [Checkout](https://www.chargebee.com/docs/2.0/configure-inapp.html#fundamental-settings_recommending-addons-in-checkout) or [Portal](https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html#allow-change-subscription) . \* optional - The addon is neither mandatory, nor recommended. This allows you to attach an addon so you can specify a `quantity` and `billing_cycles` for the addon, for when it is applied to subscriptions with the plan. \* mandatory - The addon is attached automatically to the subscription for the plan-item unless [explicitly removed](https://docs.corsair.dev/docs/api/subscriptions) via API. |
| `billing_cycles` | `number` | No | The number of subscription billing cycles for which this item is attached when applied to a subscription. Applicable only for items of type addon. Requires [addon billing cycles](https://www.chargebee.com/docs/2.0/addons-billingcycle.html) to be enabled for the site. The value set explicitly for `billing_cycles` while [applying the addon to a subscription](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#subscription_items) takes precedence over this parameter. This parameter, in turn, has a higher precedence than [the value set for the addon-item price](https://docs.corsair.dev/docs/api/item_prices) . |
| `quantity` | `number` | No | The default quantity of the addon to be attached when the quantity is not specified while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) /[updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) the subscription. |
| `quantity_in_decimal` | `string` | No | The decimal representation of the quantity of the addon. Returned for quantity-based addons when [multi-decimal pricing](https://docs.corsair.dev/docs/api/getting-started) is enabled. |
| `charge_on_event` | `subscription_creation \| subscription_trial_start \| plan_activation \| subscription_activation \| contract_termination \| on_demand` | No | Indicates when the item is charged. This parameter only applies to charge-items. \* contract\_termination - when a contract term is [terminated](https://docs.corsair.dev/docs/api/subscriptions/cancel-subscription-for-items#contract_term_cancel_option) . \* subscription\_creation - the time of creation of the subscription. \* subscription\_trial\_start - the time when the trial period of the subscription begins. \* on\_demand - Item can be charged on demand \* 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. |
| `charge_once` | `boolean` | No | 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. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `attached_item` | `object \| null` | No | Addon-item and charge-item prices are purchased with plan-item prices in subscriptions. You can automate this process by configuring certain addons and charges as "attached" to certain plans. This is done at the "item" level. In other words, addon- and charge-items can be attached to plan-items. Once the attachment is defined, while creating or updating a subscription, the addon- or charge-item prices are selected automatically based on the plan-item price selected . Let's look at the details: ### Addons Addons can be attached to plans as `recommended`, `mandatory` or `optional`. \* When an addon is attached as `recommended` for a plan, the addon is suggested to be applied to subscriptions for the plan in [Checkout](https://www.chargebee.com/docs/2.0/configure-inapp.html#fundamental-settings_recommending-addons-in-checkout) and [Self-Serve Portal](https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html#allow-change-subscription). Alternatively, if you build your own payment pages or have a sales team, you can suggest recommended addons to your customers or salespeople on your website or CRM respectively \* When an addon is attached as `mandatory` for a plan, the addon gets applied to subscriptions for the plan compulsorily, unless [removed explicitly](https://docs.corsair.dev/docs/api/subscriptions). If you do not pass an item price for a mandatory addon when including the plan in a subscription, an addon-item price is automatically applied as explained below. \* Attaching an addon as `optional` neither marks it as recommended or mandatory but allows you a way to set a `quantity` and `billing_cycles` for the addon, for when it is applied to subscriptions with the plan. How auto-selection of the addon-item price works ------------------------------------------------ Once an addon has been attached as mandatory, the addon-item price to be applied to the plan-item price is selected based on the following rule: The addon-item price with the same currency as that of the plan-item price and the longest compatible period is selected. Here's an example: Consider a plan **Standard Cloud Storage** has an addon **Extra Storage** attached to it. Note that each of the two are items. Now consider that they have item prices with the following periods and currencies: **Item price for "Standard Cloud Storage" plan-item:** \* Standard Cloud Storage, 3 years, AUD. **Item prices for "Extra Storage" addon-item:** \* Extra Storage, 1 year, EUR. \* Extra Storage, 1 year, USD. \* Extra Storage, 1 year, AUD. \* Extra Storage, 18 months, AUD. \* Extra Storage, 2 years, AUD. \* Extra Storage, 30 months, AUD. For the plan-item price (Standard Cloud Storage, 3 years, AUD), the addon-item prices with matching currencies are the last 4 from the above list: \* Extra Storage, 1 year, AUD. \* Extra Storage, 18 months, AUD. \* Extra Storage, 2 years, AUD. \* Extra Storage, 30 months, AUD. From among them, the last two have periods that are incompatible with the plan-item price period of 3 years. From the remaining 2 addon-item prices, the one with the longest period is of 18 months. So, "Extra Storage, 18 months, AUD" is selected for mandatory application to the plan item price. ### Charges Charges can also be attached to plans. When doing so, you specify [the event](https://docs.corsair.dev/docs/api/attached_items/attached_item-object#charge_on_event) at which the charge is to be applied to the subscription. For some events that can occur multiple times in a subscription lifetime, you can also set whether to apply the charge each time the event occurs or just once. There may be multiple item prices for a given attached charge. The item price that matches the currency of the plan-item price is automatically selected for application. Here's an example: Consider a plan **Standard Cloud Storage** has a charge named **Implementation Fee** attached to it. Now consider their item prices below, with the following periods and currencies: **Item price for "Standard Cloud Storage" plan-item:** \* Standard Cloud Storage, 3 years, AUD. **Item prices for "Implementation Fee" charge-item:** \* Implementation Fee, USD. \* Implementation Fee, AUD. \* Implementation Fee, EUR. From among the charge-item prices above, the one compatible with the plan-item price is "Implementation Fee, AUD" since it has the same currency as the plan-item price. |

> [accordion] attached\_item full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   parent_item_id?: string | null,
>   item_id?: string | null,
>   type?: string | null,
>   status?: string | null,
>   quantity?: number | null,
>   quantity_in_decimal?: string | null,
>   billing_cycles?: number | null,
>   charge_on_event?: string | null,
>   charge_once?: boolean | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null
> } | null
> ```

***

## Batch

### ingestUsages

`batch.ingestUsages`

Ingest usage events in batch. This endpoint ingests a batch of usage events into Chargebee. Note : - You can ingest 500 events in a batch ingestion. See also \* Limits for Usage-based Billing in Chargebee.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.batch.ingestUsages({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `events` | `object` | No | Parameters for batch usage events |

> [accordion] events full type
>
> ```ts theme={null}
> {
>   deduplication_id: string[],
>   subscription_id: string[],
>   usage_timestamp: number[],
>   properties: {
>   }[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `batch_id` | `string \| null` | No | The unique identifier for the batch of usage events processed. |
| `failed_events` | `any[] \| null` | No | — |

***

## Business Entities

### create

`businessEntities.create`

Create a business entity. Creates a business\_entity resource for the site. Use this endpoint to set up an additional business unit or brand under your organization, each with its own configuration and data. Note This endpoint is available only when multiple business entities are enabled for your site.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.businessEntities.create({ name: 'example', status: 'active' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `name` | `string` | Yes | A human-friendly name for the business entity. |
| `status` | `active \| inactive` | Yes | The status to set for the business entity. \* active - The business entity is active and can be used. \* inactive - The business entity is inactive and cannot be used. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `business_entity` | `object \| null` | No | The `business_entity` resource represents a business unit or brand under your organization. Key resources in Chargebee Billing (such as [customer](https://docs.corsair.dev/docs/api/customers), [subscriptions](https://docs.corsair.dev/docs/api/subscriptions), [invoices](https://docs.corsair.dev/docs/api/invoices), and [transactions](https://docs.corsair.dev/docs/api/transactions)) along with the associated site configurations, fall under a [business entity](https://www.chargebee.com/docs/2.0/mbe.html). Each Chargebee Billing [site](https://www.chargebee.com/docs/2.0/sites-intro.html) has one business entity by default. You may create multiple business entities in the following scenarios: \* **Multiple Business Units**: You may be running your business under different regional units with different "invoice-from" addresses. This is usually done to manage taxation and bookkeeping. In such a case, you may create a business entity for each business unit. \* **Multiple Brands**: You may have multiple brands within your business, such as those acquired via mergers and acquisitions. You may create a business entity for each brand. Creating multiple business entities lets you separate configuration and data for your business units or brands so that you can manage their billing and revenue operations independently. **See also** [More information](https://www.chargebee.com/docs/2.0/mbe.html) on business entities and the configuration options available. Specifying business entity in API operations All API operations in Chargebee have site [context](https://docs.corsair.dev/docs/api/business_entities). Context restrictions cannot be assigned to [API keys](https://www.chargebee.com/docs/2.0/api_keys.html). However, if your site has multiple business entities, you can specify the business entity [context](https://docs.corsair.dev/docs/api/business_entities) for an API call by passing a [custom HTTP request header](https://docs.corsair.dev/docs/api/advanced-features). API behavior based on business entity specified The table below explains how Chargebee responds to various API calls depending on whether the business entity ID is specified as part of the API call. **Note** Some of the words used here are defined in the [Terminology section](https://docs.corsair.dev/docs/api/business_entities). \| **Operation/Type of operation** \| **Behavior** \| **Examples** \| \|--------------------------------------------------\|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| Any operation that creates a `customer` resource \| \* If `business_entity_id` **is provided** , the `customer` resource is created and linked to it. \* If `business_entity_id` **is not provided** , the `customer` resource is created under the [default business entity](https://docs.corsair.dev/docs/api/business_entities) of the site. \| \* [Create a customer](https://docs.corsair.dev/docs/api/customers/create-a-customer) \* When [Create a checkout for charge items and quick charge](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges)s or [Create checkout for a new subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription) is called, providing a value for `customer[id]` that is not already present in the site. This creates a new `customer` resource. \| \| Create a resource other than `customer` \| \* If `business_entity_id` **is provided** , and it is the same as that [linked](https://docs.corsair.dev/docs/api/business_entities) to the [target resource](https://docs.corsair.dev/docs/api/business_entities): the resource is created and linked to the business entity provided. \* If `business_entity_id` **is provided** , and it is not the same as that linked to the target resource, a `404 Not Found` response is sent because the resource cannot be found in the [context](https://docs.corsair.dev/docs/api/business_entities) of the business entity specified. \* If `business_entity_id` **is not provided**, the resource is created and linked to the business entity of the target resource. \| \* [Create a subscription](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items): the target resource is a `customer`. \* [Create a comment](https://docs.corsair.dev/docs/api/comments/create-a-comment): the target resource is specified in the value provided for `entity_type`. \* [Create an invoice for items and one-time charges](https://docs.corsair.dev/docs/api/invoices/create-invoice-for-items-and-one-time-charges): depending on the ID specified, the target resource is either a `customer` or a `subscription`. \| \| Update/delete a resource \| \* If `business_entity_id` **is provided** , and it is the same as that [linked](https://docs.corsair.dev/docs/api/business_entities) to the resource, the operation proceeds successfully. \* If `business_entity_id` **is provided** , and it is not the same as that [linked](https://docs.corsair.dev/docs/api/business_entities) to the resource, a `404 Not Found` response is sent because the resource cannot be found in the [context](https://docs.corsair.dev/docs/api/business_entities) of the business entity specified. \* If `business_entity_id` **is not provided**, the operation proceeds successfully. \| \* [Update a customer](https://docs.corsair.dev/docs/api/customers/update-a-customer) \* [Update a subscription](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) \* [Update a card payment source](https://docs.corsair.dev/docs/api/payment_sources/update-a-card-payment-source) \| \| List resources \| \* If `business_entity_id` **is provided,** then only those resources linked to the business entity are returned since the [context](https://docs.corsair.dev/docs/api/business_entities) of the operation is now restricted to the business entity specified. \* If `business_entity_id` **is not provided**, then all resources in the site are returned. \| \* [List customers](https://docs.corsair.dev/docs/api/customers/list-customers) \* [List payment sources](https://docs.corsair.dev/docs/api/payment_sources/list-payment-sources) \| \| Retreive a resource \| \* If `business_entity_id` **is provided** , and it is the same as that [linked](https://docs.corsair.dev/docs/api/business_entities) to the resource, the resource is retrieved successfully. \* If `business_entity_id` **is provided** , and it is not the same as that [linked](https://docs.corsair.dev/docs/api/business_entities) to the resource, a `404 Not Found` response is sent because the resource cannot be found in the [context](https://docs.corsair.dev/docs/api/business_entities) of the business entity specified. \* If `business_entity_id` **is not provided**, the resource is retrieved successfully. \| \* [Retrieve a customer](https://docs.corsair.dev/docs/api/customers/retrieve-a-customer) \* [Retrieve a comment](https://docs.corsair.dev/docs/api/comments/retrieve-a-comment) \| Terminology This section defines some useful terms for describing how business entities work. #### Linked business entity \{#mbe-terms-content} Any resource is always associated with precisely one and only one business entity. We call it the linked business entity of the resource, or simply, the business entity of the resource. #### Default business entity When `customer` resource is created and no business entity is specified, it is linked to the business entity designated as the default business entity of the site. A site always has a default business entity. Please choose the first business entity details carefully, as it can't be changed later, and this will be your default entity when no business entity is specified. #### Context of an operation Any site has data in it. This includes all the various resources such as customers, subscriptions, invoices, comments, and so on. The "context" of an API operation is the subset of site data it has access to. An API operation can only read or write data within its context. By default, an API operation has "site context", which means it has access to the entire site's data. However, when a business entity is [specified](https://docs.corsair.dev/docs/api/business_entities) in an API operation, it has "business entity context", which means that the operation only has access to the data linked to the business entity. **Example** Consider the [List customers API](https://docs.corsair.dev/docs/api/customers/list-customers). When you call the API without specifying a business entity, its context is that of the site and therefore returns customer resources for the entire site. However, when you specify a business entity, the context is only that of the business entity, and therefore the customer resources of only the selected business entity are returned. Let's look at the [Create checkout for a new subscription API](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription). Say you're calling this API and providing the `customer[id]` parameter. When no business entity is specified, the operation has *site context* and therefore looks up the ID among all the customer resources in the site. However, when a business entity is provided, the operation has *business entity context* and looks up the ID only among the customers linked to that business entity. #### Target resource While creating an API resource other than a `customer`, you specify a target resource under which it should be created. For example: \* While [creating an `invoice` resource for a one-time charge](https://docs.corsair.dev/docs/api/invoices/create-invoice-for-items-and-one-time-charges), you must specify either the `customer` or the `subscription` resource to which it belongs. The `customer` or `subscription` resource, in this case, is the target resource of the `invoice`. \* While [creating a `subscription`](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items), the target resource of a `subscription` resource is always a `customer` resource. \* While [creating a `quote` resource of `type` `change_subscription`](https://docs.corsair.dev/docs/api/quotes/create-a-quote-for-update-subscription-items), the target resource is a `subscription` resource. |

> [accordion] business\_entity full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   status?: string | null,
>   deleted?: boolean | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null
> } | null
> ```

***

### get

`businessEntities.get`

Retrieve a business entity. Retrieves the business\_entity resource identified by the specified unique identifier.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.businessEntities.get({ businessEntityId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `businessEntityId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `business_entity` | `object \| null` | No | The `business_entity` resource represents a business unit or brand under your organization. Key resources in Chargebee Billing (such as [customer](https://docs.corsair.dev/docs/api/customers), [subscriptions](https://docs.corsair.dev/docs/api/subscriptions), [invoices](https://docs.corsair.dev/docs/api/invoices), and [transactions](https://docs.corsair.dev/docs/api/transactions)) along with the associated site configurations, fall under a [business entity](https://www.chargebee.com/docs/2.0/mbe.html). Each Chargebee Billing [site](https://www.chargebee.com/docs/2.0/sites-intro.html) has one business entity by default. You may create multiple business entities in the following scenarios: \* **Multiple Business Units**: You may be running your business under different regional units with different "invoice-from" addresses. This is usually done to manage taxation and bookkeeping. In such a case, you may create a business entity for each business unit. \* **Multiple Brands**: You may have multiple brands within your business, such as those acquired via mergers and acquisitions. You may create a business entity for each brand. Creating multiple business entities lets you separate configuration and data for your business units or brands so that you can manage their billing and revenue operations independently. **See also** [More information](https://www.chargebee.com/docs/2.0/mbe.html) on business entities and the configuration options available. Specifying business entity in API operations All API operations in Chargebee have site [context](https://docs.corsair.dev/docs/api/business_entities). Context restrictions cannot be assigned to [API keys](https://www.chargebee.com/docs/2.0/api_keys.html). However, if your site has multiple business entities, you can specify the business entity [context](https://docs.corsair.dev/docs/api/business_entities) for an API call by passing a [custom HTTP request header](https://docs.corsair.dev/docs/api/advanced-features). API behavior based on business entity specified The table below explains how Chargebee responds to various API calls depending on whether the business entity ID is specified as part of the API call. **Note** Some of the words used here are defined in the [Terminology section](https://docs.corsair.dev/docs/api/business_entities). \| **Operation/Type of operation** \| **Behavior** \| **Examples** \| \|--------------------------------------------------\|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| Any operation that creates a `customer` resource \| \* If `business_entity_id` **is provided** , the `customer` resource is created and linked to it. \* If `business_entity_id` **is not provided** , the `customer` resource is created under the [default business entity](https://docs.corsair.dev/docs/api/business_entities) of the site. \| \* [Create a customer](https://docs.corsair.dev/docs/api/customers/create-a-customer) \* When [Create a checkout for charge items and quick charge](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges)s or [Create checkout for a new subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription) is called, providing a value for `customer[id]` that is not already present in the site. This creates a new `customer` resource. \| \| Create a resource other than `customer` \| \* If `business_entity_id` **is provided** , and it is the same as that [linked](https://docs.corsair.dev/docs/api/business_entities) to the [target resource](https://docs.corsair.dev/docs/api/business_entities): the resource is created and linked to the business entity provided. \* If `business_entity_id` **is provided** , and it is not the same as that linked to the target resource, a `404 Not Found` response is sent because the resource cannot be found in the [context](https://docs.corsair.dev/docs/api/business_entities) of the business entity specified. \* If `business_entity_id` **is not provided**, the resource is created and linked to the business entity of the target resource. \| \* [Create a subscription](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items): the target resource is a `customer`. \* [Create a comment](https://docs.corsair.dev/docs/api/comments/create-a-comment): the target resource is specified in the value provided for `entity_type`. \* [Create an invoice for items and one-time charges](https://docs.corsair.dev/docs/api/invoices/create-invoice-for-items-and-one-time-charges): depending on the ID specified, the target resource is either a `customer` or a `subscription`. \| \| Update/delete a resource \| \* If `business_entity_id` **is provided** , and it is the same as that [linked](https://docs.corsair.dev/docs/api/business_entities) to the resource, the operation proceeds successfully. \* If `business_entity_id` **is provided** , and it is not the same as that [linked](https://docs.corsair.dev/docs/api/business_entities) to the resource, a `404 Not Found` response is sent because the resource cannot be found in the [context](https://docs.corsair.dev/docs/api/business_entities) of the business entity specified. \* If `business_entity_id` **is not provided**, the operation proceeds successfully. \| \* [Update a customer](https://docs.corsair.dev/docs/api/customers/update-a-customer) \* [Update a subscription](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) \* [Update a card payment source](https://docs.corsair.dev/docs/api/payment_sources/update-a-card-payment-source) \| \| List resources \| \* If `business_entity_id` **is provided,** then only those resources linked to the business entity are returned since the [context](https://docs.corsair.dev/docs/api/business_entities) of the operation is now restricted to the business entity specified. \* If `business_entity_id` **is not provided**, then all resources in the site are returned. \| \* [List customers](https://docs.corsair.dev/docs/api/customers/list-customers) \* [List payment sources](https://docs.corsair.dev/docs/api/payment_sources/list-payment-sources) \| \| Retreive a resource \| \* If `business_entity_id` **is provided** , and it is the same as that [linked](https://docs.corsair.dev/docs/api/business_entities) to the resource, the resource is retrieved successfully. \* If `business_entity_id` **is provided** , and it is not the same as that [linked](https://docs.corsair.dev/docs/api/business_entities) to the resource, a `404 Not Found` response is sent because the resource cannot be found in the [context](https://docs.corsair.dev/docs/api/business_entities) of the business entity specified. \* If `business_entity_id` **is not provided**, the resource is retrieved successfully. \| \* [Retrieve a customer](https://docs.corsair.dev/docs/api/customers/retrieve-a-customer) \* [Retrieve a comment](https://docs.corsair.dev/docs/api/comments/retrieve-a-comment) \| Terminology This section defines some useful terms for describing how business entities work. #### Linked business entity \{#mbe-terms-content} Any resource is always associated with precisely one and only one business entity. We call it the linked business entity of the resource, or simply, the business entity of the resource. #### Default business entity When `customer` resource is created and no business entity is specified, it is linked to the business entity designated as the default business entity of the site. A site always has a default business entity. Please choose the first business entity details carefully, as it can't be changed later, and this will be your default entity when no business entity is specified. #### Context of an operation Any site has data in it. This includes all the various resources such as customers, subscriptions, invoices, comments, and so on. The "context" of an API operation is the subset of site data it has access to. An API operation can only read or write data within its context. By default, an API operation has "site context", which means it has access to the entire site's data. However, when a business entity is [specified](https://docs.corsair.dev/docs/api/business_entities) in an API operation, it has "business entity context", which means that the operation only has access to the data linked to the business entity. **Example** Consider the [List customers API](https://docs.corsair.dev/docs/api/customers/list-customers). When you call the API without specifying a business entity, its context is that of the site and therefore returns customer resources for the entire site. However, when you specify a business entity, the context is only that of the business entity, and therefore the customer resources of only the selected business entity are returned. Let's look at the [Create checkout for a new subscription API](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription). Say you're calling this API and providing the `customer[id]` parameter. When no business entity is specified, the operation has *site context* and therefore looks up the ID among all the customer resources in the site. However, when a business entity is provided, the operation has *business entity context* and looks up the ID only among the customers linked to that business entity. #### Target resource While creating an API resource other than a `customer`, you specify a target resource under which it should be created. For example: \* While [creating an `invoice` resource for a one-time charge](https://docs.corsair.dev/docs/api/invoices/create-invoice-for-items-and-one-time-charges), you must specify either the `customer` or the `subscription` resource to which it belongs. The `customer` or `subscription` resource, in this case, is the target resource of the `invoice`. \* While [creating a `subscription`](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items), the target resource of a `subscription` resource is always a `customer` resource. \* While [creating a `quote` resource of `type` `change_subscription`](https://docs.corsair.dev/docs/api/quotes/create-a-quote-for-update-subscription-items), the target resource is a `subscription` resource. |

> [accordion] business\_entity full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   status?: string | null,
>   deleted?: boolean | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null
> } | null
> ```

***

### list

`businessEntities.list`

List business entities. Returns a list of business\_entity resources configured for the site, meeting all the conditions specified in the filter parameters below. By default, this list is sorted by id in ascending order.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.businessEntities.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `include_deleted` | `boolean` | No | If set to `true`, the list of business entities returned includes those that have been deleted. |
| `name` | `object` | No | optional, string filter Filter business entities based on their `name`. **Supported operators :** is, is\_not, starts\_with, in, not\_in, is\_present **Example →** *name\\\[is\\] = "Acme Inc"* |

> [accordion] name full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   is_present?: true | false
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   business_entity?: {
>     id?: string | null,
>     name?: string | null,
>     status?: string | null,
>     deleted?: boolean | null,
>     created_at?: number | null,
>     resource_version?: number | null,
>     updated_at?: number | null
>   } | null
> }[] | null
> ```

***

### listTransfers

`businessEntities.listTransfers`

List business entity transfers. Returns a list of business\_entity\_transfer resources meeting all the conditions specified in the filter parameters below. By default, this list is sorted by created\_at in descending order (latest first).

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.businessEntities.listTransfers({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `resource_type` | `object` | No | Filter [business\_entity\_transfer](https://docs.corsair.dev/docs/api/business_entity_transfers) resources based on [resource\_type](https://docs.corsair.dev/docs/api/business_entity_transfers/business_entity_transfer-object#resource_type). **Tip** Use this filter along with [active\_resource\_id\[is\]](https://docs.corsair.dev/docs/api/business_entities/list-the-business-entity-transfers) to retrieve the history of all the business entity transfers for a resource. |
| `resource_id` | `object` | No | Filter [business\_entity\_transfer](https://docs.corsair.dev/docs/api/business_entity_transfers) resources based on [resource\_id](https://docs.corsair.dev/docs/api/business_entity_transfers/business_entity_transfer-object#resource_id) . |
| `active_resource_id` | `object` | No | Filter [business\_entity\_transfer](https://docs.corsair.dev/docs/api/business_entity_transfers) resources based on [active\_resource\_id](https://docs.corsair.dev/docs/api/business_entity_transfers/business_entity_transfer-object#active_resource_id). **Tip** Use this filter along with [resource\_type\[\]](https://docs.corsair.dev/docs/api/business_entities/list-the-business-entity-transfers) to retrieve the history of all the business entity transfers for a resource. |
| `created_at` | `object` | No | optional, timestamp(UTC) in seconds filter To filter based on Created At. **Supported operators :** after, before, on, between **Example →** *created\_at\\\[on\\] = "1702022464"* |
| `sort_by` | `object` | No | optional, string filter Sorts based on the specified attribute. **Supported attributes :** created\_at **Supported sort-orders :** asc, desc **Example →** *sort\_by\\\[asc\\] = "created\_at"* This will sort the result based on the 'created\_at' attribute in ascending(earliest first) order. |

> [accordion] resource\_type full type
>
> ```ts theme={null}
> {
>   is?: string
> }
> ```

> [accordion] resource\_id full type
>
> ```ts theme={null}
> {
>   is?: string
> }
> ```

> [accordion] active\_resource\_id full type
>
> ```ts theme={null}
> {
>   is?: string
> }
> ```

> [accordion] created\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] sort\_by full type
>
> ```ts theme={null}
> {
>   asc?: created_at,
>   desc?: created_at
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   business_entity_transfer?: {
>     id?: string | null,
>     resource_type?: string | null,
>     resource_id?: string | null,
>     active_resource_id?: string | null,
>     destination_business_entity_id?: string | null,
>     source_business_entity_id?: string | null,
>     reason_code?: string | null,
>     created_at?: number | null
>   } | null
> }[] | null
> ```

***

### transfer

`businessEntities.transfer`

Transfer a customer to another business entity. Important This API will not work if you have specified a business entity in the custom HTTP header. Transfers one or more customer resources from one business entity to another. The transfer is executed by creating a copy of the customer resource.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.businessEntities.transfer({
	active_resource_ids: ['example'],
	destination_business_entity_ids: ['example'],
	reason_codes: ['example'],
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `active_resource_ids` | `string[]` | Yes | The list of unique identifiers of the `customer` resources to be transferred. Each `id` must belong to an active `customer` resource. **Note** If a `customer` resource was deprecated because it was moved previously, you cannot move it again. Instead, move the active version of the resource. Do this by passing the `active_id` of the deprecated resource. |
| `destination_business_entity_ids` | `string[]` | Yes | The list of unique identifiers of the `business_entity` resources to which the corresponding `customer` resource must be transferred. |
| `reason_codes` | `string[]` | Yes | The list of [reasons](https://docs.corsair.dev/docs/api/business_entity_transfers/business_entity_transfer-object#reason_code) for changing the business entity of the corresponding `customer` resources. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `business_entity_transfer` | `object \| null` | No | `business_entity_transfer` encapsulates the details of the movement of a resource (such as [customer](https://docs.corsair.dev/docs/api/customers) and [subscription](https://docs.corsair.dev/docs/api/subscriptions) ) from one [business\_entity](https://docs.corsair.dev/docs/api/business_entities) to another. **Related Endpoints** \* [Transfer resource to another business entity](https://docs.corsair.dev/docs/api/business_entities/transfer-resources-to-another-business-entity) \* [List business entity transfers](https://docs.corsair.dev/docs/api/business_entities/list-the-business-entity-transfers) |

> [accordion] business\_entity\_transfer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   resource_type?: string | null,
>   resource_id?: string | null,
>   active_resource_id?: string | null,
>   destination_business_entity_id?: string | null,
>   source_business_entity_id?: string | null,
>   reason_code?: string | null,
>   created_at?: number | null
> } | null
> ```

***

### update

`businessEntities.update`

Update business entity. Updates the business\_entity resource identified by the specified unique identifier. You can change the name and the status of the business entity.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.businessEntities.update({ businessEntityId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `businessEntityId` | `string` | Yes | — |
| `name` | `string` | No | A human-friendly name for the business entity. |
| `status` | `active \| inactive` | No | The status to set for the business entity. \* active - The business entity is active and can be used. \* inactive - The business entity is inactive and cannot be used. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `business_entity` | `object \| null` | No | The `business_entity` resource represents a business unit or brand under your organization. Key resources in Chargebee Billing (such as [customer](https://docs.corsair.dev/docs/api/customers), [subscriptions](https://docs.corsair.dev/docs/api/subscriptions), [invoices](https://docs.corsair.dev/docs/api/invoices), and [transactions](https://docs.corsair.dev/docs/api/transactions)) along with the associated site configurations, fall under a [business entity](https://www.chargebee.com/docs/2.0/mbe.html). Each Chargebee Billing [site](https://www.chargebee.com/docs/2.0/sites-intro.html) has one business entity by default. You may create multiple business entities in the following scenarios: \* **Multiple Business Units**: You may be running your business under different regional units with different "invoice-from" addresses. This is usually done to manage taxation and bookkeeping. In such a case, you may create a business entity for each business unit. \* **Multiple Brands**: You may have multiple brands within your business, such as those acquired via mergers and acquisitions. You may create a business entity for each brand. Creating multiple business entities lets you separate configuration and data for your business units or brands so that you can manage their billing and revenue operations independently. **See also** [More information](https://www.chargebee.com/docs/2.0/mbe.html) on business entities and the configuration options available. Specifying business entity in API operations All API operations in Chargebee have site [context](https://docs.corsair.dev/docs/api/business_entities). Context restrictions cannot be assigned to [API keys](https://www.chargebee.com/docs/2.0/api_keys.html). However, if your site has multiple business entities, you can specify the business entity [context](https://docs.corsair.dev/docs/api/business_entities) for an API call by passing a [custom HTTP request header](https://docs.corsair.dev/docs/api/advanced-features). API behavior based on business entity specified The table below explains how Chargebee responds to various API calls depending on whether the business entity ID is specified as part of the API call. **Note** Some of the words used here are defined in the [Terminology section](https://docs.corsair.dev/docs/api/business_entities). \| **Operation/Type of operation** \| **Behavior** \| **Examples** \| \|--------------------------------------------------\|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| Any operation that creates a `customer` resource \| \* If `business_entity_id` **is provided** , the `customer` resource is created and linked to it. \* If `business_entity_id` **is not provided** , the `customer` resource is created under the [default business entity](https://docs.corsair.dev/docs/api/business_entities) of the site. \| \* [Create a customer](https://docs.corsair.dev/docs/api/customers/create-a-customer) \* When [Create a checkout for charge items and quick charge](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges)s or [Create checkout for a new subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription) is called, providing a value for `customer[id]` that is not already present in the site. This creates a new `customer` resource. \| \| Create a resource other than `customer` \| \* If `business_entity_id` **is provided** , and it is the same as that [linked](https://docs.corsair.dev/docs/api/business_entities) to the [target resource](https://docs.corsair.dev/docs/api/business_entities): the resource is created and linked to the business entity provided. \* If `business_entity_id` **is provided** , and it is not the same as that linked to the target resource, a `404 Not Found` response is sent because the resource cannot be found in the [context](https://docs.corsair.dev/docs/api/business_entities) of the business entity specified. \* If `business_entity_id` **is not provided**, the resource is created and linked to the business entity of the target resource. \| \* [Create a subscription](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items): the target resource is a `customer`. \* [Create a comment](https://docs.corsair.dev/docs/api/comments/create-a-comment): the target resource is specified in the value provided for `entity_type`. \* [Create an invoice for items and one-time charges](https://docs.corsair.dev/docs/api/invoices/create-invoice-for-items-and-one-time-charges): depending on the ID specified, the target resource is either a `customer` or a `subscription`. \| \| Update/delete a resource \| \* If `business_entity_id` **is provided** , and it is the same as that [linked](https://docs.corsair.dev/docs/api/business_entities) to the resource, the operation proceeds successfully. \* If `business_entity_id` **is provided** , and it is not the same as that [linked](https://docs.corsair.dev/docs/api/business_entities) to the resource, a `404 Not Found` response is sent because the resource cannot be found in the [context](https://docs.corsair.dev/docs/api/business_entities) of the business entity specified. \* If `business_entity_id` **is not provided**, the operation proceeds successfully. \| \* [Update a customer](https://docs.corsair.dev/docs/api/customers/update-a-customer) \* [Update a subscription](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) \* [Update a card payment source](https://docs.corsair.dev/docs/api/payment_sources/update-a-card-payment-source) \| \| List resources \| \* If `business_entity_id` **is provided,** then only those resources linked to the business entity are returned since the [context](https://docs.corsair.dev/docs/api/business_entities) of the operation is now restricted to the business entity specified. \* If `business_entity_id` **is not provided**, then all resources in the site are returned. \| \* [List customers](https://docs.corsair.dev/docs/api/customers/list-customers) \* [List payment sources](https://docs.corsair.dev/docs/api/payment_sources/list-payment-sources) \| \| Retreive a resource \| \* If `business_entity_id` **is provided** , and it is the same as that [linked](https://docs.corsair.dev/docs/api/business_entities) to the resource, the resource is retrieved successfully. \* If `business_entity_id` **is provided** , and it is not the same as that [linked](https://docs.corsair.dev/docs/api/business_entities) to the resource, a `404 Not Found` response is sent because the resource cannot be found in the [context](https://docs.corsair.dev/docs/api/business_entities) of the business entity specified. \* If `business_entity_id` **is not provided**, the resource is retrieved successfully. \| \* [Retrieve a customer](https://docs.corsair.dev/docs/api/customers/retrieve-a-customer) \* [Retrieve a comment](https://docs.corsair.dev/docs/api/comments/retrieve-a-comment) \| Terminology This section defines some useful terms for describing how business entities work. #### Linked business entity \{#mbe-terms-content} Any resource is always associated with precisely one and only one business entity. We call it the linked business entity of the resource, or simply, the business entity of the resource. #### Default business entity When `customer` resource is created and no business entity is specified, it is linked to the business entity designated as the default business entity of the site. A site always has a default business entity. Please choose the first business entity details carefully, as it can't be changed later, and this will be your default entity when no business entity is specified. #### Context of an operation Any site has data in it. This includes all the various resources such as customers, subscriptions, invoices, comments, and so on. The "context" of an API operation is the subset of site data it has access to. An API operation can only read or write data within its context. By default, an API operation has "site context", which means it has access to the entire site's data. However, when a business entity is [specified](https://docs.corsair.dev/docs/api/business_entities) in an API operation, it has "business entity context", which means that the operation only has access to the data linked to the business entity. **Example** Consider the [List customers API](https://docs.corsair.dev/docs/api/customers/list-customers). When you call the API without specifying a business entity, its context is that of the site and therefore returns customer resources for the entire site. However, when you specify a business entity, the context is only that of the business entity, and therefore the customer resources of only the selected business entity are returned. Let's look at the [Create checkout for a new subscription API](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription). Say you're calling this API and providing the `customer[id]` parameter. When no business entity is specified, the operation has *site context* and therefore looks up the ID among all the customer resources in the site. However, when a business entity is provided, the operation has *business entity context* and looks up the ID only among the customers linked to that business entity. #### Target resource While creating an API resource other than a `customer`, you specify a target resource under which it should be created. For example: \* While [creating an `invoice` resource for a one-time charge](https://docs.corsair.dev/docs/api/invoices/create-invoice-for-items-and-one-time-charges), you must specify either the `customer` or the `subscription` resource to which it belongs. The `customer` or `subscription` resource, in this case, is the target resource of the `invoice`. \* While [creating a `subscription`](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items), the target resource of a `subscription` resource is always a `customer` resource. \* While [creating a `quote` resource of `type` `change_subscription`](https://docs.corsair.dev/docs/api/quotes/create-a-quote-for-update-subscription-items), the target resource is a `subscription` resource. |

> [accordion] business\_entity full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   status?: string | null,
>   deleted?: boolean | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null
> } | null
> ```

***

## Business Rules

### activate

`businessRules.activate`

Activate a business rule. Activates a business rule by setting its active attribute to true, so that Chargebee evaluates it. Every rule is created inactive, so this is the operation that puts a new rule into effect. ### Impacts Business rule The rule active attribute is set to true.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.businessRules.activate({ businessRuleId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `businessRuleId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `business_rule` | `object \| null` | No | A business rule pairs a condition with the actions to take when that condition is met. You supply the context to evaluate, and Chargebee returns the actions configured in `actions_on_success` when the condition evaluates to `true`. Business Rules APIs manage [CPQ Selling Rules](https://www.chargebee.com/docs/cpq/selling-rules). The condition is defined in `structured_expression`, a JSON representation of the rule logic that visual editors and dynamic rule builders can both read and write. Chargebee validates and compiles the expression when the rule is created or updated, and evaluates the compiled form when you call [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules). The `field` of every condition is resolved against the context supplied at evaluation time, so the fields you reference must match the keys of the context the rule is evaluated against. A condition whose `field` is absent from the context never evaluates to `true`, which means the rule never matches. Business rules are versioned. Creating a rule releases its first version, so `latest_version` is `1` and `released_at` is set from the outset. Editing a rule leaves that released version untouched: the first edit creates a draft, and every later edit updates the same draft. [Releasing](https://docs.corsair.dev/docs/api/business_rules/release-a-business-rule) the draft promotes it to the next version number, and that version becomes the latest released version and the one Chargebee evaluates. Until you release it, the previously released version stays in effect, so a rule can keep serving traffic while its next version is being prepared. The `active` attribute is an independent switch that controls whether Chargebee evaluates the rule at all. A rule is created inactive, so it has to be [activated](https://docs.corsair.dev/docs/api/business_rules/activate-a-business-rule) before it takes effect. Related rules can be grouped into a [business ruleset](https://docs.corsair.dev/docs/api/business_rulesets), which evaluates its member rules in priority order using the strategy configured in the ruleset's `execute_mode`. For a walkthrough that creates, activates, and applies a rule in three calls, take a look at the [Business Rules quickstart](https://www.chargebee.com/tutorials/business-rules-quickstart/). Expressions ----------- The `structured_expression` of a rule is a tree of nodes that evaluates to a single `true` or `false`. Every node carries a `type`, which determines the rest of the fields the node takes. The following expression matches a quote from a customer whose language contains `en` and whose shipping country is India or the United States: `json { "type": "GROUP", "operation": "AND", "children": [ { "type": "CONDITION", "field": "customer.language", "operator": "CONTAINS", "value": "en" }, { "type": "CONDITION", "field": "quote.shipping_address_country", "operator": "ANY_OF", "values": ["IN", "US"] } ] } ` Every condition is compiled so that it first tests whether the field is present in the context. A condition on a field that the context doesn't carry evaluates to `false` instead of failing, so the rule that holds it never matches and no `error_message` is returned for it. ### GROUP node Combines the nodes in `children` into a single result. Use a `GROUP` as the root of any expression that has more than one condition, and nest groups to control precedence. \* `operation`: **Required.** `AND` to match only if every child matches, or `OR` to match if any child matches. \* `children`: **Required.** An array holding at least one node. Each entry is itself a `GROUP`, `CONDITION`, or `COLLECTION` node. `json { "type": "GROUP", "operation": "OR", "children": [ { "type": "CONDITION", "field": "quote.payment_terms", "operator": "GREATER_THAN", "value": 30 }, { "type": "CONDITION", "field": "customer.billing_address_country", "operator": "EQUALS", "value": "US" } ] } ` ### CONDITION node Compares one field of the context against a value. \* `field`: **Required.** The path of the field through the context, such as `customer.language`. See [Context](https://docs.corsair.dev/docs/api/business_rules#context) for the paths available. \* `operator`: **Required.** How the comparison is made. See [Operators](https://docs.corsair.dev/docs/api/business_rules#operators) for the operators available and the field types each one compares. \* `value`: The single value to compare against. Required for the single-value operators. \* `values`: The array of values to compare against. Required for `BETWEEN`, `ANY_OF`, and `NONE_OF`. `json { "type": "CONDITION", "field": "quote.contract_duration", "operator": "BETWEEN", "values": [12, 36] } ` ### COLLECTION node Tests the entries of an array in the context, such as the line items of a quote. All four fields are required. \* `field`: **Required.** The array to iterate over, such as `items`. \* `variable`: **Required.** The name each entry is bound to while the predicate is evaluated. \* `mode`: **Required.** `ANY` to match if at least one entry satisfies the predicate, or `NONE` to match only if no entry does. \* `predicate`: **Required.** The expression each entry is tested against, usually a `GROUP` node. Inside the predicate, address the fields of an entry through the bound `variable`. The following node matches a quote that has at least one item discounted by more than 20: `json { "type": "COLLECTION", "field": "items", "variable": "item", "mode": "ANY", "predicate": { "type": "GROUP", "operation": "AND", "children": [ { "type": "CONDITION", "field": "item.discount", "operator": "GREATER_THAN", "value": 20 } ] } } ` ### Operators The following operators are available. The field type is the type the operator can compare, and the value column shows whether the condition takes `value` or `values`. \| Operator \| Field type \| Value \| \|------------------------------------------------------------------------------\|-------------------------\|-------------------------------------------------------------------------------------\| \| `EQUALS`, `NOT_EQUALS` \| String, number, boolean \| `value` \| \| `GREATER_THAN`, `GREATER_THAN_OR_EQUALS`, `LESS_THAN`, `LESS_THAN_OR_EQUALS` \| Number \| `value` \| \| `BETWEEN` \| Number \| `values`, holding exactly two entries, read as the inclusive lower and upper bounds \| \| `CONTAINS`, `NOT_CONTAINS` \| String \| `value` \| \| `STARTS_WITH` \| String \| `value` \| \| `ANY_OF`, `NONE_OF` \| String, number, boolean \| `values`, holding at least one entry \| An operator used on a field of another type isn't rejected when the rule is saved, so the mismatch surfaces only when the rule is evaluated. Context ------- The `context` you pass to [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules) isn't a free-form object. Its `type` selects the schema that the rest of the context is read as, and `CPQ` is the only type available, so a condition can reference only the fields of that schema. A key that falls outside the schema is dropped as the context is read, so a condition on it never evaluates to `true`. A misspelled or unsupported key therefore surfaces as an unmet condition rather than as an error. A `CPQ` context carries `items`, `quote`, `customer`, `user`, `site`, and `quote_subscription`, each of them optional. Pass only the parts the rules you're evaluating need: `json { "type": "CPQ", "customer": { "language": "en", "billing_address_country": "US" }, "quote": { "shipping_address_country": "IN", "payment_terms": 30, "custom_fields": { "region": "apac" } }, "items": [ { "reference_id": "item-1", "amount": 5000, "quantity": 2, "discount": 10 }, { "reference_id": "item-2", "amount": 1200, "quantity": 1, "discount": 0 } ] } ` A condition addresses a field by its path through the context, so `customer.language` reads the `language` of the `customer`. A `COLLECTION` node on `items` iterates over the entries of that array. Each `custom_fields` object holds your own fields keyed by name, and every value must be a string, a number, or a boolean. A condition reads one through its key, as in `quote.custom_fields.region`. The response returns the context back with `rule_ids` filled in on the quote and on each item, so you can see which rules applied where. ### quote \* `type` and `contract_type`: strings. \* `contract_duration` and `payment_terms`: numbers. \* `billing_address_country` and `shipping_address_country`: strings. \* `billing_frequency` and `billing_currency`: strings. \* `creator_email` and `creator_role`: strings. \* `custom_fields`: object. \* `rule_ids`: array of strings. Returned in the response rather than passed, recording the rules that applied to the quote. ### customer \* `billing_address_city`, `billing_address_state`, and `billing_address_country`: strings. \* `language`: string. \* `payment_terms`: number. \* `custom_fields`: object. ### items An array, with each entry holding the following. \* `reference_id`: string, identifying the entry within the context. \* `type`, `item_name`, and `product_family_name`: strings. \* `billing_frequency` and `currency`: strings. \* `billing_cycle`, `amount`, `quantity`, and `discount`: numbers. \* `start_date` and `end_date`: timestamps. \* `rule_ids`: array of strings. Returned in the response rather than passed, recording the rules that applied to that entry. ### user \* `name`, `email`, and `phone`: strings. ### site \* `name`, `domain`, and `currency`: strings. \* `sandbox`: boolean. ### quote\_subscription \* `custom_fields`: object. Actions ------- Every entry in `actions_on_success` is built from an **action template** , a built-in definition that fixes the kind of change an action makes and the parameters it accepts. An action names its template in `action_template_id` and passes that template's parameters in `input`: `json [ { "action_template_id": "action-apply-discount", "input": { "apply_on": "INVOICE_AMOUNT", "discount": 12.0, "discount_type": "PERCENTAGE", "duration_type": "ONE_TIME" } } ] ` The `type` of an action is derived from its template, so it's returned with the action but you don't have to pass it. A parameter that the template doesn't define is rejected. The values of enumerated parameters are matched without regard to case, and are returned in the `input` of the action exactly as you passed them. An action can also carry a `structured_expression` of its own, written in the same format as the expression of the rule. The rule decides whether the action runs at all, and the action's own expression then narrows it to the items of the context that satisfy that expression. One rule can therefore discount some of the items it matched rather than all of them. Only the apply discount, limit discount, and limit quantity templates accept an action-level expression. ### Apply discount Applies a discount to the invoice amount or to specific item prices. Built from `action_template_id` `action-apply-discount` and returned with `type` `APPLY_DISCOUNT`. \* `apply_on`: **Required.** `INVOICE_AMOUNT` to discount the invoice total, or `SPECIFIC_ITEM_PRICE` to discount the item prices the action applies to. \* `discount`: **Required.** The discount to apply, such as `12.0`. \* `discount_type`: **Required.** `PERCENTAGE`, `FLAT_FEE`, or `OFFER_QUANTITY`, which fixes how `discount` is read. \* `duration_type`: **Required.** How long the discount applies, as `ONE_TIME`, `FOREVER`, or `LIMITED_PERIOD`. \* `period_unit`: `DAY`, `WEEK`, `MONTH`, or `YEAR`. Required if `duration_type` is `LIMITED_PERIOD`. \* `period`: The number of `period_unit`s the discount applies for. Required if `period_unit` is passed. ### Apply coupon Applies existing [coupons](https://docs.corsair.dev/docs/api/coupons). Built from `action_template_id` `action-apply-coupon` and returned with `type` `APPLY_COUPON`. \* `apply_on`: **Required.** `INVOICE_AMOUNT` or `SPECIFIC_ITEM_PRICE`. \* `coupon_ids`: **Required.** The coupons to apply, as an array of coupon identifiers. It must hold at least one identifier. ### Limit discount Caps the discount that can be given. Use this template to enforce a discount ceiling without an approval step. Built from `action_template_id` `action-limit-discount` and returned with `type` `LIMIT_DISCOUNT`. \* `apply_on`: **Required.** `INVOICE_AMOUNT` or `SPECIFIC_ITEM_PRICE`. \* `maximum_discount`: **Required.** The largest discount allowed, such as `20.0`. \* `discount_type`: **Required.** `PERCENTAGE`, `FLAT_FEE`, or `OFFER_QUANTITY`, which fixes how `maximum_discount` is read. \* `disable_price_override`: Pass `true` to disallow overriding the price outright. ### Limit quantity Constrains the quantities that can be selected. Built from `action_template_id` `action-limit-quantity` and returned with `type` `LIMIT_QUANTITY`. Every parameter is optional, so pass the ones you want to enforce. \* `minimum_quantity`: The smallest quantity allowed. \* `maximum_quantity`: The largest quantity allowed. \* `quantity_step_count`: The increment the quantity can be changed in, so `5` allows 5, 10, 15, and so on. ### Error Returns an error message instead of a change. Use this template to block an operation when the rule matches. Built from `action_template_id` `action-error` and returned with `type` `ERROR`. \* `error_message`: **Required.** The message returned with the action. Evaluation results ------------------ [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules) returns an `apply_rule` object that echoes back the `context` you passed and carries one entry in `rules` for each rule it evaluated: `json { "apply_rule": { "context": { "type": "CPQ", "customer": { "language": "en" }, "quote": { "shipping_address_country": "IN" } }, "rules": [ { "id": "quote-discount-en", "version": 1, "name": "Apply 12 percent discount at invoice level", "evaluation_result": true, "actions": [ { "action_template_id": "action-apply-discount", "type": "APPLY_DISCOUNT", "input": { "apply_on": "INVOICE_AMOUNT", "discount": 12.0, "discount_type": "PERCENTAGE", "duration_type": "ONE_TIME" } } ], "object": "applied_rule" }, { "id": "quote-discount-uk", "version": 1, "name": "Apply 5 percent discount at invoice level for UK quotes", "evaluation_result": false, "object": "applied_rule" } ], "object": "apply_rule" } } ` Read the result of each rule from `evaluation_result`, and read what the rule produced from `actions`. Two things about the shape are worth knowing before you write code against it. \* `actions` is absent, rather than empty, for a rule whose `evaluation_result` is `false`. The second entry above shows a rule that didn't match. \* An entry for an ad hoc `structured_expression` carries only `evaluation_result`, because there's no stored rule to report an `id`, `name`, or `actions` for. A rule that couldn't be evaluated is returned with `error_message` set instead, but only if you passed `skip_failed_rules` as `true`. Otherwise the request fails. For the full list of fields, see the response of [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules). |

> [accordion] business\_rule full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   latest_version?: number | null,
>   active?: boolean | null,
>   released_at?: number | null,
>   released_by?: string | null,
>   updated_at?: number | null,
>   updated_by?: string | null,
>   created_by?: string | null,
>   created_at?: number | null,
>   tags?: any[] | null,
>   structured_expression?: {
>   } | null,
>   actions_on_success?: any[] | null,
>   resource_version?: number | null
> } | null
> ```

***

### apply

`businessRules.apply`

Apply business rules. Evaluates business rules against a context that you supply. You can evaluate a single rule using rule\_id, every rule in a ruleset using ruleset\_id, or an ad hoc expression using structured\_expression.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.businessRules.apply({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `evaluate` | `boolean` | No | When set to `true`, skips rule action execution and only performs rule evaluation. Useful for testing rule conditions without executing associated actions. |
| `rule_id` | `string` | No | The [business rule](https://docs.corsair.dev/docs/api/business_rules) to evaluate. Its latest released version is evaluated, and one entry is returned for it in `apply_rule.rules[]`. |
| `ruleset_id` | `string` | No | The [business ruleset](https://docs.corsair.dev/docs/api/business_rulesets) to evaluate. Every rule it contains is evaluated in its priority order, following the strategy configured in the ruleset `execute_mode`, which also decides whether evaluation stops early and which of the results are returned. |
| `skip_failed_rules` | `boolean` | No | Skip failed rules and continue processing the rest of the ruleset. A rule that could not be evaluated is returned with `error_message` set. When `false`, the request fails as soon as a rule cannot be evaluated. This applies only to the rules evaluated through `ruleset_id`. A rule evaluated through `rule_id` and an expression evaluated through `structured_expression` fail the request regardless of this value. |
| `structured_expression` | `object` | No | An expression to evaluate without storing it as a rule. Use it to try an expression while you are building it. See [Expressions](https://docs.corsair.dev/docs/api/business_rules#expressions) for the node types and the operators each field type supports. **Impacts** \* The entry returned for the expression in `apply_rule.rules[]` carries only `evaluation_result`. No actions run, because actions belong to a stored rule rather than to an ad-hoc expression. \* An `operator` applied to a field of another type cannot be evaluated and fails the request. `skip_failed_rules` does not apply to this parameter. **Example →** `structured_expression = {"type":"GROUP","operation":"AND","children":[{"type":"CONDITION","field":"customer.language","operator":"CONTAINS","value":"en"},{"type":"CONDITION","field":"quote.shipping_address_country","operator":"ANY_OF","values":["IN","US"]}]}` |
| `context` | `object` | No | The data that the rule expressions are evaluated against, passed as a JSON object. The `field` of each condition is resolved against this object. See [Context](https://docs.corsair.dev/docs/api/business_rules#context) for the schema and the fields a condition can reference. **Constraints** \* Must carry a `type`, which selects the schema that the rest of the object is read as. `CPQ` is the only type available. **Impacts** \* A key that falls outside the schema is dropped as the context is read. \* A condition that references a field the context does not carry, including a key dropped for falling outside the schema, evaluates to `false`. The rule holding it does not match, and no `error_message` is returned for it. **Example →** `context = {"type":"CPQ","customer":{"language":"en"},"quote":{"shipping_address_country":"IN"}}` |

> [accordion] structured\_expression full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] context full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `apply_rule` | `object \| null` | No | — |

> [accordion] apply\_rule full type
>
> ```ts theme={null}
> {
>   evaluate?: boolean | null,
>   rule_id?: string | null,
>   ruleset_id?: string | null,
>   skip_failed_rules?: boolean | null,
>   structured_expression?: {
>   } | null,
>   context?: {
>   } | null,
>   rules?: {
>     id?: string | null,
>     version?: number | null,
>     name?: string | null,
>     description?: string | null,
>     evaluation_result?: boolean | null,
>     error_message?: string | null,
>     actions?: any[] | null
>   }[] | null
> } | null
> ```

***

### create

`businessRules.create`

Create a business rule. Creates a business rule and releases its first version, so the new rule has latest\_version set to 1 and released\_at set. The rule is created inactive: Chargebee does not evaluate it until you call Activate a business rule.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.businessRules.create({
	name: 'example',
	structured_expression: {},
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `id` | `string` | No | Unique identifier for the business rule. If not provided, Chargebee generates one. **Constraints** \* The identifier of a deleted rule cannot be reused. |
| `name` | `string` | Yes | Display name of the business rule. |
| `description` | `string` | No | Description of what the business rule does. |
| `tags` | `any[]` | No | — |
| `structured_expression` | `object` | Yes | A structured JSON representation of the rule logic, designed for visual editors and dynamic builders. Chargebee validates and compiles it when the rule is created. Pass it as a JSON object. See [Expressions](https://docs.corsair.dev/docs/api/business_rules#expressions) for the node types and the operators each field type supports, and [Context](https://docs.corsair.dev/docs/api/business_rules#context) for the fields a condition can reference. **Impacts** \* A condition whose `field` is absent from the context passed to [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules) evaluates to `false`, so the rule never matches and no error is returned. **Example →** `structured_expression = {"type":"GROUP","operation":"AND","children":[{"type":"CONDITION","field":"customer.language","operator":"CONTAINS","value":"en"},{"type":"CONDITION","field":"quote.shipping_address_country","operator":"ANY_OF","values":["IN","US"]}]}` |
| `actions_on_success` | `any[]` | No | The actions to execute when the rule expression evaluates to `true`, passed as a JSON array. Each action takes the `action_template_id` of the template it is built from and that template's parameters in `input`. See [Actions](https://docs.corsair.dev/docs/api/business_rules#actions) for the templates available, the parameters each one takes, and the optional action-level `structured_expression` that narrows the items an action applies to. **Example →** `actions_on_success = [{"action_template_id":"action-apply-discount","input":{"apply_on":"invoice_amount","duration_type":"one_time","discount":12.0,"discount_type":"percentage"}}]` |

> [accordion] structured\_expression full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `business_rule` | `object \| null` | No | A business rule pairs a condition with the actions to take when that condition is met. You supply the context to evaluate, and Chargebee returns the actions configured in `actions_on_success` when the condition evaluates to `true`. Business Rules APIs manage [CPQ Selling Rules](https://www.chargebee.com/docs/cpq/selling-rules). The condition is defined in `structured_expression`, a JSON representation of the rule logic that visual editors and dynamic rule builders can both read and write. Chargebee validates and compiles the expression when the rule is created or updated, and evaluates the compiled form when you call [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules). The `field` of every condition is resolved against the context supplied at evaluation time, so the fields you reference must match the keys of the context the rule is evaluated against. A condition whose `field` is absent from the context never evaluates to `true`, which means the rule never matches. Business rules are versioned. Creating a rule releases its first version, so `latest_version` is `1` and `released_at` is set from the outset. Editing a rule leaves that released version untouched: the first edit creates a draft, and every later edit updates the same draft. [Releasing](https://docs.corsair.dev/docs/api/business_rules/release-a-business-rule) the draft promotes it to the next version number, and that version becomes the latest released version and the one Chargebee evaluates. Until you release it, the previously released version stays in effect, so a rule can keep serving traffic while its next version is being prepared. The `active` attribute is an independent switch that controls whether Chargebee evaluates the rule at all. A rule is created inactive, so it has to be [activated](https://docs.corsair.dev/docs/api/business_rules/activate-a-business-rule) before it takes effect. Related rules can be grouped into a [business ruleset](https://docs.corsair.dev/docs/api/business_rulesets), which evaluates its member rules in priority order using the strategy configured in the ruleset's `execute_mode`. For a walkthrough that creates, activates, and applies a rule in three calls, take a look at the [Business Rules quickstart](https://www.chargebee.com/tutorials/business-rules-quickstart/). Expressions ----------- The `structured_expression` of a rule is a tree of nodes that evaluates to a single `true` or `false`. Every node carries a `type`, which determines the rest of the fields the node takes. The following expression matches a quote from a customer whose language contains `en` and whose shipping country is India or the United States: `json { "type": "GROUP", "operation": "AND", "children": [ { "type": "CONDITION", "field": "customer.language", "operator": "CONTAINS", "value": "en" }, { "type": "CONDITION", "field": "quote.shipping_address_country", "operator": "ANY_OF", "values": ["IN", "US"] } ] } ` Every condition is compiled so that it first tests whether the field is present in the context. A condition on a field that the context doesn't carry evaluates to `false` instead of failing, so the rule that holds it never matches and no `error_message` is returned for it. ### GROUP node Combines the nodes in `children` into a single result. Use a `GROUP` as the root of any expression that has more than one condition, and nest groups to control precedence. \* `operation`: **Required.** `AND` to match only if every child matches, or `OR` to match if any child matches. \* `children`: **Required.** An array holding at least one node. Each entry is itself a `GROUP`, `CONDITION`, or `COLLECTION` node. `json { "type": "GROUP", "operation": "OR", "children": [ { "type": "CONDITION", "field": "quote.payment_terms", "operator": "GREATER_THAN", "value": 30 }, { "type": "CONDITION", "field": "customer.billing_address_country", "operator": "EQUALS", "value": "US" } ] } ` ### CONDITION node Compares one field of the context against a value. \* `field`: **Required.** The path of the field through the context, such as `customer.language`. See [Context](https://docs.corsair.dev/docs/api/business_rules#context) for the paths available. \* `operator`: **Required.** How the comparison is made. See [Operators](https://docs.corsair.dev/docs/api/business_rules#operators) for the operators available and the field types each one compares. \* `value`: The single value to compare against. Required for the single-value operators. \* `values`: The array of values to compare against. Required for `BETWEEN`, `ANY_OF`, and `NONE_OF`. `json { "type": "CONDITION", "field": "quote.contract_duration", "operator": "BETWEEN", "values": [12, 36] } ` ### COLLECTION node Tests the entries of an array in the context, such as the line items of a quote. All four fields are required. \* `field`: **Required.** The array to iterate over, such as `items`. \* `variable`: **Required.** The name each entry is bound to while the predicate is evaluated. \* `mode`: **Required.** `ANY` to match if at least one entry satisfies the predicate, or `NONE` to match only if no entry does. \* `predicate`: **Required.** The expression each entry is tested against, usually a `GROUP` node. Inside the predicate, address the fields of an entry through the bound `variable`. The following node matches a quote that has at least one item discounted by more than 20: `json { "type": "COLLECTION", "field": "items", "variable": "item", "mode": "ANY", "predicate": { "type": "GROUP", "operation": "AND", "children": [ { "type": "CONDITION", "field": "item.discount", "operator": "GREATER_THAN", "value": 20 } ] } } ` ### Operators The following operators are available. The field type is the type the operator can compare, and the value column shows whether the condition takes `value` or `values`. \| Operator \| Field type \| Value \| \|------------------------------------------------------------------------------\|-------------------------\|-------------------------------------------------------------------------------------\| \| `EQUALS`, `NOT_EQUALS` \| String, number, boolean \| `value` \| \| `GREATER_THAN`, `GREATER_THAN_OR_EQUALS`, `LESS_THAN`, `LESS_THAN_OR_EQUALS` \| Number \| `value` \| \| `BETWEEN` \| Number \| `values`, holding exactly two entries, read as the inclusive lower and upper bounds \| \| `CONTAINS`, `NOT_CONTAINS` \| String \| `value` \| \| `STARTS_WITH` \| String \| `value` \| \| `ANY_OF`, `NONE_OF` \| String, number, boolean \| `values`, holding at least one entry \| An operator used on a field of another type isn't rejected when the rule is saved, so the mismatch surfaces only when the rule is evaluated. Context ------- The `context` you pass to [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules) isn't a free-form object. Its `type` selects the schema that the rest of the context is read as, and `CPQ` is the only type available, so a condition can reference only the fields of that schema. A key that falls outside the schema is dropped as the context is read, so a condition on it never evaluates to `true`. A misspelled or unsupported key therefore surfaces as an unmet condition rather than as an error. A `CPQ` context carries `items`, `quote`, `customer`, `user`, `site`, and `quote_subscription`, each of them optional. Pass only the parts the rules you're evaluating need: `json { "type": "CPQ", "customer": { "language": "en", "billing_address_country": "US" }, "quote": { "shipping_address_country": "IN", "payment_terms": 30, "custom_fields": { "region": "apac" } }, "items": [ { "reference_id": "item-1", "amount": 5000, "quantity": 2, "discount": 10 }, { "reference_id": "item-2", "amount": 1200, "quantity": 1, "discount": 0 } ] } ` A condition addresses a field by its path through the context, so `customer.language` reads the `language` of the `customer`. A `COLLECTION` node on `items` iterates over the entries of that array. Each `custom_fields` object holds your own fields keyed by name, and every value must be a string, a number, or a boolean. A condition reads one through its key, as in `quote.custom_fields.region`. The response returns the context back with `rule_ids` filled in on the quote and on each item, so you can see which rules applied where. ### quote \* `type` and `contract_type`: strings. \* `contract_duration` and `payment_terms`: numbers. \* `billing_address_country` and `shipping_address_country`: strings. \* `billing_frequency` and `billing_currency`: strings. \* `creator_email` and `creator_role`: strings. \* `custom_fields`: object. \* `rule_ids`: array of strings. Returned in the response rather than passed, recording the rules that applied to the quote. ### customer \* `billing_address_city`, `billing_address_state`, and `billing_address_country`: strings. \* `language`: string. \* `payment_terms`: number. \* `custom_fields`: object. ### items An array, with each entry holding the following. \* `reference_id`: string, identifying the entry within the context. \* `type`, `item_name`, and `product_family_name`: strings. \* `billing_frequency` and `currency`: strings. \* `billing_cycle`, `amount`, `quantity`, and `discount`: numbers. \* `start_date` and `end_date`: timestamps. \* `rule_ids`: array of strings. Returned in the response rather than passed, recording the rules that applied to that entry. ### user \* `name`, `email`, and `phone`: strings. ### site \* `name`, `domain`, and `currency`: strings. \* `sandbox`: boolean. ### quote\_subscription \* `custom_fields`: object. Actions ------- Every entry in `actions_on_success` is built from an **action template** , a built-in definition that fixes the kind of change an action makes and the parameters it accepts. An action names its template in `action_template_id` and passes that template's parameters in `input`: `json [ { "action_template_id": "action-apply-discount", "input": { "apply_on": "INVOICE_AMOUNT", "discount": 12.0, "discount_type": "PERCENTAGE", "duration_type": "ONE_TIME" } } ] ` The `type` of an action is derived from its template, so it's returned with the action but you don't have to pass it. A parameter that the template doesn't define is rejected. The values of enumerated parameters are matched without regard to case, and are returned in the `input` of the action exactly as you passed them. An action can also carry a `structured_expression` of its own, written in the same format as the expression of the rule. The rule decides whether the action runs at all, and the action's own expression then narrows it to the items of the context that satisfy that expression. One rule can therefore discount some of the items it matched rather than all of them. Only the apply discount, limit discount, and limit quantity templates accept an action-level expression. ### Apply discount Applies a discount to the invoice amount or to specific item prices. Built from `action_template_id` `action-apply-discount` and returned with `type` `APPLY_DISCOUNT`. \* `apply_on`: **Required.** `INVOICE_AMOUNT` to discount the invoice total, or `SPECIFIC_ITEM_PRICE` to discount the item prices the action applies to. \* `discount`: **Required.** The discount to apply, such as `12.0`. \* `discount_type`: **Required.** `PERCENTAGE`, `FLAT_FEE`, or `OFFER_QUANTITY`, which fixes how `discount` is read. \* `duration_type`: **Required.** How long the discount applies, as `ONE_TIME`, `FOREVER`, or `LIMITED_PERIOD`. \* `period_unit`: `DAY`, `WEEK`, `MONTH`, or `YEAR`. Required if `duration_type` is `LIMITED_PERIOD`. \* `period`: The number of `period_unit`s the discount applies for. Required if `period_unit` is passed. ### Apply coupon Applies existing [coupons](https://docs.corsair.dev/docs/api/coupons). Built from `action_template_id` `action-apply-coupon` and returned with `type` `APPLY_COUPON`. \* `apply_on`: **Required.** `INVOICE_AMOUNT` or `SPECIFIC_ITEM_PRICE`. \* `coupon_ids`: **Required.** The coupons to apply, as an array of coupon identifiers. It must hold at least one identifier. ### Limit discount Caps the discount that can be given. Use this template to enforce a discount ceiling without an approval step. Built from `action_template_id` `action-limit-discount` and returned with `type` `LIMIT_DISCOUNT`. \* `apply_on`: **Required.** `INVOICE_AMOUNT` or `SPECIFIC_ITEM_PRICE`. \* `maximum_discount`: **Required.** The largest discount allowed, such as `20.0`. \* `discount_type`: **Required.** `PERCENTAGE`, `FLAT_FEE`, or `OFFER_QUANTITY`, which fixes how `maximum_discount` is read. \* `disable_price_override`: Pass `true` to disallow overriding the price outright. ### Limit quantity Constrains the quantities that can be selected. Built from `action_template_id` `action-limit-quantity` and returned with `type` `LIMIT_QUANTITY`. Every parameter is optional, so pass the ones you want to enforce. \* `minimum_quantity`: The smallest quantity allowed. \* `maximum_quantity`: The largest quantity allowed. \* `quantity_step_count`: The increment the quantity can be changed in, so `5` allows 5, 10, 15, and so on. ### Error Returns an error message instead of a change. Use this template to block an operation when the rule matches. Built from `action_template_id` `action-error` and returned with `type` `ERROR`. \* `error_message`: **Required.** The message returned with the action. Evaluation results ------------------ [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules) returns an `apply_rule` object that echoes back the `context` you passed and carries one entry in `rules` for each rule it evaluated: `json { "apply_rule": { "context": { "type": "CPQ", "customer": { "language": "en" }, "quote": { "shipping_address_country": "IN" } }, "rules": [ { "id": "quote-discount-en", "version": 1, "name": "Apply 12 percent discount at invoice level", "evaluation_result": true, "actions": [ { "action_template_id": "action-apply-discount", "type": "APPLY_DISCOUNT", "input": { "apply_on": "INVOICE_AMOUNT", "discount": 12.0, "discount_type": "PERCENTAGE", "duration_type": "ONE_TIME" } } ], "object": "applied_rule" }, { "id": "quote-discount-uk", "version": 1, "name": "Apply 5 percent discount at invoice level for UK quotes", "evaluation_result": false, "object": "applied_rule" } ], "object": "apply_rule" } } ` Read the result of each rule from `evaluation_result`, and read what the rule produced from `actions`. Two things about the shape are worth knowing before you write code against it. \* `actions` is absent, rather than empty, for a rule whose `evaluation_result` is `false`. The second entry above shows a rule that didn't match. \* An entry for an ad hoc `structured_expression` carries only `evaluation_result`, because there's no stored rule to report an `id`, `name`, or `actions` for. A rule that couldn't be evaluated is returned with `error_message` set instead, but only if you passed `skip_failed_rules` as `true`. Otherwise the request fails. For the full list of fields, see the response of [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules). |

> [accordion] business\_rule full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   latest_version?: number | null,
>   active?: boolean | null,
>   released_at?: number | null,
>   released_by?: string | null,
>   updated_at?: number | null,
>   updated_by?: string | null,
>   created_by?: string | null,
>   created_at?: number | null,
>   tags?: any[] | null,
>   structured_expression?: {
>   } | null,
>   actions_on_success?: any[] | null,
>   resource_version?: number | null
> } | null
> ```

***

### deactivate

`businessRules.deactivate`

Deactivate a business rule. Deactivates a business rule by setting its active attribute to false. The rule is retained along with its versions and ruleset memberships, but Chargebee stops evaluating it. Use this operation to switch a rule off temporarily.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.businessRules.deactivate({ businessRuleId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `businessRuleId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `business_rule` | `object \| null` | No | A business rule pairs a condition with the actions to take when that condition is met. You supply the context to evaluate, and Chargebee returns the actions configured in `actions_on_success` when the condition evaluates to `true`. Business Rules APIs manage [CPQ Selling Rules](https://www.chargebee.com/docs/cpq/selling-rules). The condition is defined in `structured_expression`, a JSON representation of the rule logic that visual editors and dynamic rule builders can both read and write. Chargebee validates and compiles the expression when the rule is created or updated, and evaluates the compiled form when you call [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules). The `field` of every condition is resolved against the context supplied at evaluation time, so the fields you reference must match the keys of the context the rule is evaluated against. A condition whose `field` is absent from the context never evaluates to `true`, which means the rule never matches. Business rules are versioned. Creating a rule releases its first version, so `latest_version` is `1` and `released_at` is set from the outset. Editing a rule leaves that released version untouched: the first edit creates a draft, and every later edit updates the same draft. [Releasing](https://docs.corsair.dev/docs/api/business_rules/release-a-business-rule) the draft promotes it to the next version number, and that version becomes the latest released version and the one Chargebee evaluates. Until you release it, the previously released version stays in effect, so a rule can keep serving traffic while its next version is being prepared. The `active` attribute is an independent switch that controls whether Chargebee evaluates the rule at all. A rule is created inactive, so it has to be [activated](https://docs.corsair.dev/docs/api/business_rules/activate-a-business-rule) before it takes effect. Related rules can be grouped into a [business ruleset](https://docs.corsair.dev/docs/api/business_rulesets), which evaluates its member rules in priority order using the strategy configured in the ruleset's `execute_mode`. For a walkthrough that creates, activates, and applies a rule in three calls, take a look at the [Business Rules quickstart](https://www.chargebee.com/tutorials/business-rules-quickstart/). Expressions ----------- The `structured_expression` of a rule is a tree of nodes that evaluates to a single `true` or `false`. Every node carries a `type`, which determines the rest of the fields the node takes. The following expression matches a quote from a customer whose language contains `en` and whose shipping country is India or the United States: `json { "type": "GROUP", "operation": "AND", "children": [ { "type": "CONDITION", "field": "customer.language", "operator": "CONTAINS", "value": "en" }, { "type": "CONDITION", "field": "quote.shipping_address_country", "operator": "ANY_OF", "values": ["IN", "US"] } ] } ` Every condition is compiled so that it first tests whether the field is present in the context. A condition on a field that the context doesn't carry evaluates to `false` instead of failing, so the rule that holds it never matches and no `error_message` is returned for it. ### GROUP node Combines the nodes in `children` into a single result. Use a `GROUP` as the root of any expression that has more than one condition, and nest groups to control precedence. \* `operation`: **Required.** `AND` to match only if every child matches, or `OR` to match if any child matches. \* `children`: **Required.** An array holding at least one node. Each entry is itself a `GROUP`, `CONDITION`, or `COLLECTION` node. `json { "type": "GROUP", "operation": "OR", "children": [ { "type": "CONDITION", "field": "quote.payment_terms", "operator": "GREATER_THAN", "value": 30 }, { "type": "CONDITION", "field": "customer.billing_address_country", "operator": "EQUALS", "value": "US" } ] } ` ### CONDITION node Compares one field of the context against a value. \* `field`: **Required.** The path of the field through the context, such as `customer.language`. See [Context](https://docs.corsair.dev/docs/api/business_rules#context) for the paths available. \* `operator`: **Required.** How the comparison is made. See [Operators](https://docs.corsair.dev/docs/api/business_rules#operators) for the operators available and the field types each one compares. \* `value`: The single value to compare against. Required for the single-value operators. \* `values`: The array of values to compare against. Required for `BETWEEN`, `ANY_OF`, and `NONE_OF`. `json { "type": "CONDITION", "field": "quote.contract_duration", "operator": "BETWEEN", "values": [12, 36] } ` ### COLLECTION node Tests the entries of an array in the context, such as the line items of a quote. All four fields are required. \* `field`: **Required.** The array to iterate over, such as `items`. \* `variable`: **Required.** The name each entry is bound to while the predicate is evaluated. \* `mode`: **Required.** `ANY` to match if at least one entry satisfies the predicate, or `NONE` to match only if no entry does. \* `predicate`: **Required.** The expression each entry is tested against, usually a `GROUP` node. Inside the predicate, address the fields of an entry through the bound `variable`. The following node matches a quote that has at least one item discounted by more than 20: `json { "type": "COLLECTION", "field": "items", "variable": "item", "mode": "ANY", "predicate": { "type": "GROUP", "operation": "AND", "children": [ { "type": "CONDITION", "field": "item.discount", "operator": "GREATER_THAN", "value": 20 } ] } } ` ### Operators The following operators are available. The field type is the type the operator can compare, and the value column shows whether the condition takes `value` or `values`. \| Operator \| Field type \| Value \| \|------------------------------------------------------------------------------\|-------------------------\|-------------------------------------------------------------------------------------\| \| `EQUALS`, `NOT_EQUALS` \| String, number, boolean \| `value` \| \| `GREATER_THAN`, `GREATER_THAN_OR_EQUALS`, `LESS_THAN`, `LESS_THAN_OR_EQUALS` \| Number \| `value` \| \| `BETWEEN` \| Number \| `values`, holding exactly two entries, read as the inclusive lower and upper bounds \| \| `CONTAINS`, `NOT_CONTAINS` \| String \| `value` \| \| `STARTS_WITH` \| String \| `value` \| \| `ANY_OF`, `NONE_OF` \| String, number, boolean \| `values`, holding at least one entry \| An operator used on a field of another type isn't rejected when the rule is saved, so the mismatch surfaces only when the rule is evaluated. Context ------- The `context` you pass to [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules) isn't a free-form object. Its `type` selects the schema that the rest of the context is read as, and `CPQ` is the only type available, so a condition can reference only the fields of that schema. A key that falls outside the schema is dropped as the context is read, so a condition on it never evaluates to `true`. A misspelled or unsupported key therefore surfaces as an unmet condition rather than as an error. A `CPQ` context carries `items`, `quote`, `customer`, `user`, `site`, and `quote_subscription`, each of them optional. Pass only the parts the rules you're evaluating need: `json { "type": "CPQ", "customer": { "language": "en", "billing_address_country": "US" }, "quote": { "shipping_address_country": "IN", "payment_terms": 30, "custom_fields": { "region": "apac" } }, "items": [ { "reference_id": "item-1", "amount": 5000, "quantity": 2, "discount": 10 }, { "reference_id": "item-2", "amount": 1200, "quantity": 1, "discount": 0 } ] } ` A condition addresses a field by its path through the context, so `customer.language` reads the `language` of the `customer`. A `COLLECTION` node on `items` iterates over the entries of that array. Each `custom_fields` object holds your own fields keyed by name, and every value must be a string, a number, or a boolean. A condition reads one through its key, as in `quote.custom_fields.region`. The response returns the context back with `rule_ids` filled in on the quote and on each item, so you can see which rules applied where. ### quote \* `type` and `contract_type`: strings. \* `contract_duration` and `payment_terms`: numbers. \* `billing_address_country` and `shipping_address_country`: strings. \* `billing_frequency` and `billing_currency`: strings. \* `creator_email` and `creator_role`: strings. \* `custom_fields`: object. \* `rule_ids`: array of strings. Returned in the response rather than passed, recording the rules that applied to the quote. ### customer \* `billing_address_city`, `billing_address_state`, and `billing_address_country`: strings. \* `language`: string. \* `payment_terms`: number. \* `custom_fields`: object. ### items An array, with each entry holding the following. \* `reference_id`: string, identifying the entry within the context. \* `type`, `item_name`, and `product_family_name`: strings. \* `billing_frequency` and `currency`: strings. \* `billing_cycle`, `amount`, `quantity`, and `discount`: numbers. \* `start_date` and `end_date`: timestamps. \* `rule_ids`: array of strings. Returned in the response rather than passed, recording the rules that applied to that entry. ### user \* `name`, `email`, and `phone`: strings. ### site \* `name`, `domain`, and `currency`: strings. \* `sandbox`: boolean. ### quote\_subscription \* `custom_fields`: object. Actions ------- Every entry in `actions_on_success` is built from an **action template** , a built-in definition that fixes the kind of change an action makes and the parameters it accepts. An action names its template in `action_template_id` and passes that template's parameters in `input`: `json [ { "action_template_id": "action-apply-discount", "input": { "apply_on": "INVOICE_AMOUNT", "discount": 12.0, "discount_type": "PERCENTAGE", "duration_type": "ONE_TIME" } } ] ` The `type` of an action is derived from its template, so it's returned with the action but you don't have to pass it. A parameter that the template doesn't define is rejected. The values of enumerated parameters are matched without regard to case, and are returned in the `input` of the action exactly as you passed them. An action can also carry a `structured_expression` of its own, written in the same format as the expression of the rule. The rule decides whether the action runs at all, and the action's own expression then narrows it to the items of the context that satisfy that expression. One rule can therefore discount some of the items it matched rather than all of them. Only the apply discount, limit discount, and limit quantity templates accept an action-level expression. ### Apply discount Applies a discount to the invoice amount or to specific item prices. Built from `action_template_id` `action-apply-discount` and returned with `type` `APPLY_DISCOUNT`. \* `apply_on`: **Required.** `INVOICE_AMOUNT` to discount the invoice total, or `SPECIFIC_ITEM_PRICE` to discount the item prices the action applies to. \* `discount`: **Required.** The discount to apply, such as `12.0`. \* `discount_type`: **Required.** `PERCENTAGE`, `FLAT_FEE`, or `OFFER_QUANTITY`, which fixes how `discount` is read. \* `duration_type`: **Required.** How long the discount applies, as `ONE_TIME`, `FOREVER`, or `LIMITED_PERIOD`. \* `period_unit`: `DAY`, `WEEK`, `MONTH`, or `YEAR`. Required if `duration_type` is `LIMITED_PERIOD`. \* `period`: The number of `period_unit`s the discount applies for. Required if `period_unit` is passed. ### Apply coupon Applies existing [coupons](https://docs.corsair.dev/docs/api/coupons). Built from `action_template_id` `action-apply-coupon` and returned with `type` `APPLY_COUPON`. \* `apply_on`: **Required.** `INVOICE_AMOUNT` or `SPECIFIC_ITEM_PRICE`. \* `coupon_ids`: **Required.** The coupons to apply, as an array of coupon identifiers. It must hold at least one identifier. ### Limit discount Caps the discount that can be given. Use this template to enforce a discount ceiling without an approval step. Built from `action_template_id` `action-limit-discount` and returned with `type` `LIMIT_DISCOUNT`. \* `apply_on`: **Required.** `INVOICE_AMOUNT` or `SPECIFIC_ITEM_PRICE`. \* `maximum_discount`: **Required.** The largest discount allowed, such as `20.0`. \* `discount_type`: **Required.** `PERCENTAGE`, `FLAT_FEE`, or `OFFER_QUANTITY`, which fixes how `maximum_discount` is read. \* `disable_price_override`: Pass `true` to disallow overriding the price outright. ### Limit quantity Constrains the quantities that can be selected. Built from `action_template_id` `action-limit-quantity` and returned with `type` `LIMIT_QUANTITY`. Every parameter is optional, so pass the ones you want to enforce. \* `minimum_quantity`: The smallest quantity allowed. \* `maximum_quantity`: The largest quantity allowed. \* `quantity_step_count`: The increment the quantity can be changed in, so `5` allows 5, 10, 15, and so on. ### Error Returns an error message instead of a change. Use this template to block an operation when the rule matches. Built from `action_template_id` `action-error` and returned with `type` `ERROR`. \* `error_message`: **Required.** The message returned with the action. Evaluation results ------------------ [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules) returns an `apply_rule` object that echoes back the `context` you passed and carries one entry in `rules` for each rule it evaluated: `json { "apply_rule": { "context": { "type": "CPQ", "customer": { "language": "en" }, "quote": { "shipping_address_country": "IN" } }, "rules": [ { "id": "quote-discount-en", "version": 1, "name": "Apply 12 percent discount at invoice level", "evaluation_result": true, "actions": [ { "action_template_id": "action-apply-discount", "type": "APPLY_DISCOUNT", "input": { "apply_on": "INVOICE_AMOUNT", "discount": 12.0, "discount_type": "PERCENTAGE", "duration_type": "ONE_TIME" } } ], "object": "applied_rule" }, { "id": "quote-discount-uk", "version": 1, "name": "Apply 5 percent discount at invoice level for UK quotes", "evaluation_result": false, "object": "applied_rule" } ], "object": "apply_rule" } } ` Read the result of each rule from `evaluation_result`, and read what the rule produced from `actions`. Two things about the shape are worth knowing before you write code against it. \* `actions` is absent, rather than empty, for a rule whose `evaluation_result` is `false`. The second entry above shows a rule that didn't match. \* An entry for an ad hoc `structured_expression` carries only `evaluation_result`, because there's no stored rule to report an `id`, `name`, or `actions` for. A rule that couldn't be evaluated is returned with `error_message` set instead, but only if you passed `skip_failed_rules` as `true`. Otherwise the request fails. For the full list of fields, see the response of [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules). |

> [accordion] business\_rule full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   latest_version?: number | null,
>   active?: boolean | null,
>   released_at?: number | null,
>   released_by?: string | null,
>   updated_at?: number | null,
>   updated_by?: string | null,
>   created_by?: string | null,
>   created_at?: number | null,
>   tags?: any[] | null,
>   structured_expression?: {
>   } | null,
>   actions_on_success?: any[] | null,
>   resource_version?: number | null
> } | null
> ```

***

### delete

`businessRules.delete`

Delete a business rule. Deletes a business rule and removes it from every business ruleset it belongs to. This is a soft delete: the rule is no longer returned by the API or evaluated by Chargebee, but its id cannot be reused.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.businessRules.delete({ businessRuleId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `businessRuleId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `business_rule` | `object \| null` | No | A business rule pairs a condition with the actions to take when that condition is met. You supply the context to evaluate, and Chargebee returns the actions configured in `actions_on_success` when the condition evaluates to `true`. Business Rules APIs manage [CPQ Selling Rules](https://www.chargebee.com/docs/cpq/selling-rules). The condition is defined in `structured_expression`, a JSON representation of the rule logic that visual editors and dynamic rule builders can both read and write. Chargebee validates and compiles the expression when the rule is created or updated, and evaluates the compiled form when you call [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules). The `field` of every condition is resolved against the context supplied at evaluation time, so the fields you reference must match the keys of the context the rule is evaluated against. A condition whose `field` is absent from the context never evaluates to `true`, which means the rule never matches. Business rules are versioned. Creating a rule releases its first version, so `latest_version` is `1` and `released_at` is set from the outset. Editing a rule leaves that released version untouched: the first edit creates a draft, and every later edit updates the same draft. [Releasing](https://docs.corsair.dev/docs/api/business_rules/release-a-business-rule) the draft promotes it to the next version number, and that version becomes the latest released version and the one Chargebee evaluates. Until you release it, the previously released version stays in effect, so a rule can keep serving traffic while its next version is being prepared. The `active` attribute is an independent switch that controls whether Chargebee evaluates the rule at all. A rule is created inactive, so it has to be [activated](https://docs.corsair.dev/docs/api/business_rules/activate-a-business-rule) before it takes effect. Related rules can be grouped into a [business ruleset](https://docs.corsair.dev/docs/api/business_rulesets), which evaluates its member rules in priority order using the strategy configured in the ruleset's `execute_mode`. For a walkthrough that creates, activates, and applies a rule in three calls, take a look at the [Business Rules quickstart](https://www.chargebee.com/tutorials/business-rules-quickstart/). Expressions ----------- The `structured_expression` of a rule is a tree of nodes that evaluates to a single `true` or `false`. Every node carries a `type`, which determines the rest of the fields the node takes. The following expression matches a quote from a customer whose language contains `en` and whose shipping country is India or the United States: `json { "type": "GROUP", "operation": "AND", "children": [ { "type": "CONDITION", "field": "customer.language", "operator": "CONTAINS", "value": "en" }, { "type": "CONDITION", "field": "quote.shipping_address_country", "operator": "ANY_OF", "values": ["IN", "US"] } ] } ` Every condition is compiled so that it first tests whether the field is present in the context. A condition on a field that the context doesn't carry evaluates to `false` instead of failing, so the rule that holds it never matches and no `error_message` is returned for it. ### GROUP node Combines the nodes in `children` into a single result. Use a `GROUP` as the root of any expression that has more than one condition, and nest groups to control precedence. \* `operation`: **Required.** `AND` to match only if every child matches, or `OR` to match if any child matches. \* `children`: **Required.** An array holding at least one node. Each entry is itself a `GROUP`, `CONDITION`, or `COLLECTION` node. `json { "type": "GROUP", "operation": "OR", "children": [ { "type": "CONDITION", "field": "quote.payment_terms", "operator": "GREATER_THAN", "value": 30 }, { "type": "CONDITION", "field": "customer.billing_address_country", "operator": "EQUALS", "value": "US" } ] } ` ### CONDITION node Compares one field of the context against a value. \* `field`: **Required.** The path of the field through the context, such as `customer.language`. See [Context](https://docs.corsair.dev/docs/api/business_rules#context) for the paths available. \* `operator`: **Required.** How the comparison is made. See [Operators](https://docs.corsair.dev/docs/api/business_rules#operators) for the operators available and the field types each one compares. \* `value`: The single value to compare against. Required for the single-value operators. \* `values`: The array of values to compare against. Required for `BETWEEN`, `ANY_OF`, and `NONE_OF`. `json { "type": "CONDITION", "field": "quote.contract_duration", "operator": "BETWEEN", "values": [12, 36] } ` ### COLLECTION node Tests the entries of an array in the context, such as the line items of a quote. All four fields are required. \* `field`: **Required.** The array to iterate over, such as `items`. \* `variable`: **Required.** The name each entry is bound to while the predicate is evaluated. \* `mode`: **Required.** `ANY` to match if at least one entry satisfies the predicate, or `NONE` to match only if no entry does. \* `predicate`: **Required.** The expression each entry is tested against, usually a `GROUP` node. Inside the predicate, address the fields of an entry through the bound `variable`. The following node matches a quote that has at least one item discounted by more than 20: `json { "type": "COLLECTION", "field": "items", "variable": "item", "mode": "ANY", "predicate": { "type": "GROUP", "operation": "AND", "children": [ { "type": "CONDITION", "field": "item.discount", "operator": "GREATER_THAN", "value": 20 } ] } } ` ### Operators The following operators are available. The field type is the type the operator can compare, and the value column shows whether the condition takes `value` or `values`. \| Operator \| Field type \| Value \| \|------------------------------------------------------------------------------\|-------------------------\|-------------------------------------------------------------------------------------\| \| `EQUALS`, `NOT_EQUALS` \| String, number, boolean \| `value` \| \| `GREATER_THAN`, `GREATER_THAN_OR_EQUALS`, `LESS_THAN`, `LESS_THAN_OR_EQUALS` \| Number \| `value` \| \| `BETWEEN` \| Number \| `values`, holding exactly two entries, read as the inclusive lower and upper bounds \| \| `CONTAINS`, `NOT_CONTAINS` \| String \| `value` \| \| `STARTS_WITH` \| String \| `value` \| \| `ANY_OF`, `NONE_OF` \| String, number, boolean \| `values`, holding at least one entry \| An operator used on a field of another type isn't rejected when the rule is saved, so the mismatch surfaces only when the rule is evaluated. Context ------- The `context` you pass to [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules) isn't a free-form object. Its `type` selects the schema that the rest of the context is read as, and `CPQ` is the only type available, so a condition can reference only the fields of that schema. A key that falls outside the schema is dropped as the context is read, so a condition on it never evaluates to `true`. A misspelled or unsupported key therefore surfaces as an unmet condition rather than as an error. A `CPQ` context carries `items`, `quote`, `customer`, `user`, `site`, and `quote_subscription`, each of them optional. Pass only the parts the rules you're evaluating need: `json { "type": "CPQ", "customer": { "language": "en", "billing_address_country": "US" }, "quote": { "shipping_address_country": "IN", "payment_terms": 30, "custom_fields": { "region": "apac" } }, "items": [ { "reference_id": "item-1", "amount": 5000, "quantity": 2, "discount": 10 }, { "reference_id": "item-2", "amount": 1200, "quantity": 1, "discount": 0 } ] } ` A condition addresses a field by its path through the context, so `customer.language` reads the `language` of the `customer`. A `COLLECTION` node on `items` iterates over the entries of that array. Each `custom_fields` object holds your own fields keyed by name, and every value must be a string, a number, or a boolean. A condition reads one through its key, as in `quote.custom_fields.region`. The response returns the context back with `rule_ids` filled in on the quote and on each item, so you can see which rules applied where. ### quote \* `type` and `contract_type`: strings. \* `contract_duration` and `payment_terms`: numbers. \* `billing_address_country` and `shipping_address_country`: strings. \* `billing_frequency` and `billing_currency`: strings. \* `creator_email` and `creator_role`: strings. \* `custom_fields`: object. \* `rule_ids`: array of strings. Returned in the response rather than passed, recording the rules that applied to the quote. ### customer \* `billing_address_city`, `billing_address_state`, and `billing_address_country`: strings. \* `language`: string. \* `payment_terms`: number. \* `custom_fields`: object. ### items An array, with each entry holding the following. \* `reference_id`: string, identifying the entry within the context. \* `type`, `item_name`, and `product_family_name`: strings. \* `billing_frequency` and `currency`: strings. \* `billing_cycle`, `amount`, `quantity`, and `discount`: numbers. \* `start_date` and `end_date`: timestamps. \* `rule_ids`: array of strings. Returned in the response rather than passed, recording the rules that applied to that entry. ### user \* `name`, `email`, and `phone`: strings. ### site \* `name`, `domain`, and `currency`: strings. \* `sandbox`: boolean. ### quote\_subscription \* `custom_fields`: object. Actions ------- Every entry in `actions_on_success` is built from an **action template** , a built-in definition that fixes the kind of change an action makes and the parameters it accepts. An action names its template in `action_template_id` and passes that template's parameters in `input`: `json [ { "action_template_id": "action-apply-discount", "input": { "apply_on": "INVOICE_AMOUNT", "discount": 12.0, "discount_type": "PERCENTAGE", "duration_type": "ONE_TIME" } } ] ` The `type` of an action is derived from its template, so it's returned with the action but you don't have to pass it. A parameter that the template doesn't define is rejected. The values of enumerated parameters are matched without regard to case, and are returned in the `input` of the action exactly as you passed them. An action can also carry a `structured_expression` of its own, written in the same format as the expression of the rule. The rule decides whether the action runs at all, and the action's own expression then narrows it to the items of the context that satisfy that expression. One rule can therefore discount some of the items it matched rather than all of them. Only the apply discount, limit discount, and limit quantity templates accept an action-level expression. ### Apply discount Applies a discount to the invoice amount or to specific item prices. Built from `action_template_id` `action-apply-discount` and returned with `type` `APPLY_DISCOUNT`. \* `apply_on`: **Required.** `INVOICE_AMOUNT` to discount the invoice total, or `SPECIFIC_ITEM_PRICE` to discount the item prices the action applies to. \* `discount`: **Required.** The discount to apply, such as `12.0`. \* `discount_type`: **Required.** `PERCENTAGE`, `FLAT_FEE`, or `OFFER_QUANTITY`, which fixes how `discount` is read. \* `duration_type`: **Required.** How long the discount applies, as `ONE_TIME`, `FOREVER`, or `LIMITED_PERIOD`. \* `period_unit`: `DAY`, `WEEK`, `MONTH`, or `YEAR`. Required if `duration_type` is `LIMITED_PERIOD`. \* `period`: The number of `period_unit`s the discount applies for. Required if `period_unit` is passed. ### Apply coupon Applies existing [coupons](https://docs.corsair.dev/docs/api/coupons). Built from `action_template_id` `action-apply-coupon` and returned with `type` `APPLY_COUPON`. \* `apply_on`: **Required.** `INVOICE_AMOUNT` or `SPECIFIC_ITEM_PRICE`. \* `coupon_ids`: **Required.** The coupons to apply, as an array of coupon identifiers. It must hold at least one identifier. ### Limit discount Caps the discount that can be given. Use this template to enforce a discount ceiling without an approval step. Built from `action_template_id` `action-limit-discount` and returned with `type` `LIMIT_DISCOUNT`. \* `apply_on`: **Required.** `INVOICE_AMOUNT` or `SPECIFIC_ITEM_PRICE`. \* `maximum_discount`: **Required.** The largest discount allowed, such as `20.0`. \* `discount_type`: **Required.** `PERCENTAGE`, `FLAT_FEE`, or `OFFER_QUANTITY`, which fixes how `maximum_discount` is read. \* `disable_price_override`: Pass `true` to disallow overriding the price outright. ### Limit quantity Constrains the quantities that can be selected. Built from `action_template_id` `action-limit-quantity` and returned with `type` `LIMIT_QUANTITY`. Every parameter is optional, so pass the ones you want to enforce. \* `minimum_quantity`: The smallest quantity allowed. \* `maximum_quantity`: The largest quantity allowed. \* `quantity_step_count`: The increment the quantity can be changed in, so `5` allows 5, 10, 15, and so on. ### Error Returns an error message instead of a change. Use this template to block an operation when the rule matches. Built from `action_template_id` `action-error` and returned with `type` `ERROR`. \* `error_message`: **Required.** The message returned with the action. Evaluation results ------------------ [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules) returns an `apply_rule` object that echoes back the `context` you passed and carries one entry in `rules` for each rule it evaluated: `json { "apply_rule": { "context": { "type": "CPQ", "customer": { "language": "en" }, "quote": { "shipping_address_country": "IN" } }, "rules": [ { "id": "quote-discount-en", "version": 1, "name": "Apply 12 percent discount at invoice level", "evaluation_result": true, "actions": [ { "action_template_id": "action-apply-discount", "type": "APPLY_DISCOUNT", "input": { "apply_on": "INVOICE_AMOUNT", "discount": 12.0, "discount_type": "PERCENTAGE", "duration_type": "ONE_TIME" } } ], "object": "applied_rule" }, { "id": "quote-discount-uk", "version": 1, "name": "Apply 5 percent discount at invoice level for UK quotes", "evaluation_result": false, "object": "applied_rule" } ], "object": "apply_rule" } } ` Read the result of each rule from `evaluation_result`, and read what the rule produced from `actions`. Two things about the shape are worth knowing before you write code against it. \* `actions` is absent, rather than empty, for a rule whose `evaluation_result` is `false`. The second entry above shows a rule that didn't match. \* An entry for an ad hoc `structured_expression` carries only `evaluation_result`, because there's no stored rule to report an `id`, `name`, or `actions` for. A rule that couldn't be evaluated is returned with `error_message` set instead, but only if you passed `skip_failed_rules` as `true`. Otherwise the request fails. For the full list of fields, see the response of [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules). |

> [accordion] business\_rule full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   latest_version?: number | null,
>   active?: boolean | null,
>   released_at?: number | null,
>   released_by?: string | null,
>   updated_at?: number | null,
>   updated_by?: string | null,
>   created_by?: string | null,
>   created_at?: number | null,
>   tags?: any[] | null,
>   structured_expression?: {
>   } | null,
>   actions_on_success?: any[] | null,
>   resource_version?: number | null
> } | null
> ```

***

### deleteDraft

`businessRules.deleteDraft`

Delete a business rule draft. Deletes the draft version of a business rule, permanently discarding every change that has not been released. The released version of the rule is not affected. Use this operation to abandon a revision you no longer want to release, and to leave the rule serving its released version unchanged.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.businessRules.deleteDraft({ businessRuleId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `businessRuleId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `business_rule` | `object \| null` | No | A business rule pairs a condition with the actions to take when that condition is met. You supply the context to evaluate, and Chargebee returns the actions configured in `actions_on_success` when the condition evaluates to `true`. Business Rules APIs manage [CPQ Selling Rules](https://www.chargebee.com/docs/cpq/selling-rules). The condition is defined in `structured_expression`, a JSON representation of the rule logic that visual editors and dynamic rule builders can both read and write. Chargebee validates and compiles the expression when the rule is created or updated, and evaluates the compiled form when you call [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules). The `field` of every condition is resolved against the context supplied at evaluation time, so the fields you reference must match the keys of the context the rule is evaluated against. A condition whose `field` is absent from the context never evaluates to `true`, which means the rule never matches. Business rules are versioned. Creating a rule releases its first version, so `latest_version` is `1` and `released_at` is set from the outset. Editing a rule leaves that released version untouched: the first edit creates a draft, and every later edit updates the same draft. [Releasing](https://docs.corsair.dev/docs/api/business_rules/release-a-business-rule) the draft promotes it to the next version number, and that version becomes the latest released version and the one Chargebee evaluates. Until you release it, the previously released version stays in effect, so a rule can keep serving traffic while its next version is being prepared. The `active` attribute is an independent switch that controls whether Chargebee evaluates the rule at all. A rule is created inactive, so it has to be [activated](https://docs.corsair.dev/docs/api/business_rules/activate-a-business-rule) before it takes effect. Related rules can be grouped into a [business ruleset](https://docs.corsair.dev/docs/api/business_rulesets), which evaluates its member rules in priority order using the strategy configured in the ruleset's `execute_mode`. For a walkthrough that creates, activates, and applies a rule in three calls, take a look at the [Business Rules quickstart](https://www.chargebee.com/tutorials/business-rules-quickstart/). Expressions ----------- The `structured_expression` of a rule is a tree of nodes that evaluates to a single `true` or `false`. Every node carries a `type`, which determines the rest of the fields the node takes. The following expression matches a quote from a customer whose language contains `en` and whose shipping country is India or the United States: `json { "type": "GROUP", "operation": "AND", "children": [ { "type": "CONDITION", "field": "customer.language", "operator": "CONTAINS", "value": "en" }, { "type": "CONDITION", "field": "quote.shipping_address_country", "operator": "ANY_OF", "values": ["IN", "US"] } ] } ` Every condition is compiled so that it first tests whether the field is present in the context. A condition on a field that the context doesn't carry evaluates to `false` instead of failing, so the rule that holds it never matches and no `error_message` is returned for it. ### GROUP node Combines the nodes in `children` into a single result. Use a `GROUP` as the root of any expression that has more than one condition, and nest groups to control precedence. \* `operation`: **Required.** `AND` to match only if every child matches, or `OR` to match if any child matches. \* `children`: **Required.** An array holding at least one node. Each entry is itself a `GROUP`, `CONDITION`, or `COLLECTION` node. `json { "type": "GROUP", "operation": "OR", "children": [ { "type": "CONDITION", "field": "quote.payment_terms", "operator": "GREATER_THAN", "value": 30 }, { "type": "CONDITION", "field": "customer.billing_address_country", "operator": "EQUALS", "value": "US" } ] } ` ### CONDITION node Compares one field of the context against a value. \* `field`: **Required.** The path of the field through the context, such as `customer.language`. See [Context](https://docs.corsair.dev/docs/api/business_rules#context) for the paths available. \* `operator`: **Required.** How the comparison is made. See [Operators](https://docs.corsair.dev/docs/api/business_rules#operators) for the operators available and the field types each one compares. \* `value`: The single value to compare against. Required for the single-value operators. \* `values`: The array of values to compare against. Required for `BETWEEN`, `ANY_OF`, and `NONE_OF`. `json { "type": "CONDITION", "field": "quote.contract_duration", "operator": "BETWEEN", "values": [12, 36] } ` ### COLLECTION node Tests the entries of an array in the context, such as the line items of a quote. All four fields are required. \* `field`: **Required.** The array to iterate over, such as `items`. \* `variable`: **Required.** The name each entry is bound to while the predicate is evaluated. \* `mode`: **Required.** `ANY` to match if at least one entry satisfies the predicate, or `NONE` to match only if no entry does. \* `predicate`: **Required.** The expression each entry is tested against, usually a `GROUP` node. Inside the predicate, address the fields of an entry through the bound `variable`. The following node matches a quote that has at least one item discounted by more than 20: `json { "type": "COLLECTION", "field": "items", "variable": "item", "mode": "ANY", "predicate": { "type": "GROUP", "operation": "AND", "children": [ { "type": "CONDITION", "field": "item.discount", "operator": "GREATER_THAN", "value": 20 } ] } } ` ### Operators The following operators are available. The field type is the type the operator can compare, and the value column shows whether the condition takes `value` or `values`. \| Operator \| Field type \| Value \| \|------------------------------------------------------------------------------\|-------------------------\|-------------------------------------------------------------------------------------\| \| `EQUALS`, `NOT_EQUALS` \| String, number, boolean \| `value` \| \| `GREATER_THAN`, `GREATER_THAN_OR_EQUALS`, `LESS_THAN`, `LESS_THAN_OR_EQUALS` \| Number \| `value` \| \| `BETWEEN` \| Number \| `values`, holding exactly two entries, read as the inclusive lower and upper bounds \| \| `CONTAINS`, `NOT_CONTAINS` \| String \| `value` \| \| `STARTS_WITH` \| String \| `value` \| \| `ANY_OF`, `NONE_OF` \| String, number, boolean \| `values`, holding at least one entry \| An operator used on a field of another type isn't rejected when the rule is saved, so the mismatch surfaces only when the rule is evaluated. Context ------- The `context` you pass to [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules) isn't a free-form object. Its `type` selects the schema that the rest of the context is read as, and `CPQ` is the only type available, so a condition can reference only the fields of that schema. A key that falls outside the schema is dropped as the context is read, so a condition on it never evaluates to `true`. A misspelled or unsupported key therefore surfaces as an unmet condition rather than as an error. A `CPQ` context carries `items`, `quote`, `customer`, `user`, `site`, and `quote_subscription`, each of them optional. Pass only the parts the rules you're evaluating need: `json { "type": "CPQ", "customer": { "language": "en", "billing_address_country": "US" }, "quote": { "shipping_address_country": "IN", "payment_terms": 30, "custom_fields": { "region": "apac" } }, "items": [ { "reference_id": "item-1", "amount": 5000, "quantity": 2, "discount": 10 }, { "reference_id": "item-2", "amount": 1200, "quantity": 1, "discount": 0 } ] } ` A condition addresses a field by its path through the context, so `customer.language` reads the `language` of the `customer`. A `COLLECTION` node on `items` iterates over the entries of that array. Each `custom_fields` object holds your own fields keyed by name, and every value must be a string, a number, or a boolean. A condition reads one through its key, as in `quote.custom_fields.region`. The response returns the context back with `rule_ids` filled in on the quote and on each item, so you can see which rules applied where. ### quote \* `type` and `contract_type`: strings. \* `contract_duration` and `payment_terms`: numbers. \* `billing_address_country` and `shipping_address_country`: strings. \* `billing_frequency` and `billing_currency`: strings. \* `creator_email` and `creator_role`: strings. \* `custom_fields`: object. \* `rule_ids`: array of strings. Returned in the response rather than passed, recording the rules that applied to the quote. ### customer \* `billing_address_city`, `billing_address_state`, and `billing_address_country`: strings. \* `language`: string. \* `payment_terms`: number. \* `custom_fields`: object. ### items An array, with each entry holding the following. \* `reference_id`: string, identifying the entry within the context. \* `type`, `item_name`, and `product_family_name`: strings. \* `billing_frequency` and `currency`: strings. \* `billing_cycle`, `amount`, `quantity`, and `discount`: numbers. \* `start_date` and `end_date`: timestamps. \* `rule_ids`: array of strings. Returned in the response rather than passed, recording the rules that applied to that entry. ### user \* `name`, `email`, and `phone`: strings. ### site \* `name`, `domain`, and `currency`: strings. \* `sandbox`: boolean. ### quote\_subscription \* `custom_fields`: object. Actions ------- Every entry in `actions_on_success` is built from an **action template** , a built-in definition that fixes the kind of change an action makes and the parameters it accepts. An action names its template in `action_template_id` and passes that template's parameters in `input`: `json [ { "action_template_id": "action-apply-discount", "input": { "apply_on": "INVOICE_AMOUNT", "discount": 12.0, "discount_type": "PERCENTAGE", "duration_type": "ONE_TIME" } } ] ` The `type` of an action is derived from its template, so it's returned with the action but you don't have to pass it. A parameter that the template doesn't define is rejected. The values of enumerated parameters are matched without regard to case, and are returned in the `input` of the action exactly as you passed them. An action can also carry a `structured_expression` of its own, written in the same format as the expression of the rule. The rule decides whether the action runs at all, and the action's own expression then narrows it to the items of the context that satisfy that expression. One rule can therefore discount some of the items it matched rather than all of them. Only the apply discount, limit discount, and limit quantity templates accept an action-level expression. ### Apply discount Applies a discount to the invoice amount or to specific item prices. Built from `action_template_id` `action-apply-discount` and returned with `type` `APPLY_DISCOUNT`. \* `apply_on`: **Required.** `INVOICE_AMOUNT` to discount the invoice total, or `SPECIFIC_ITEM_PRICE` to discount the item prices the action applies to. \* `discount`: **Required.** The discount to apply, such as `12.0`. \* `discount_type`: **Required.** `PERCENTAGE`, `FLAT_FEE`, or `OFFER_QUANTITY`, which fixes how `discount` is read. \* `duration_type`: **Required.** How long the discount applies, as `ONE_TIME`, `FOREVER`, or `LIMITED_PERIOD`. \* `period_unit`: `DAY`, `WEEK`, `MONTH`, or `YEAR`. Required if `duration_type` is `LIMITED_PERIOD`. \* `period`: The number of `period_unit`s the discount applies for. Required if `period_unit` is passed. ### Apply coupon Applies existing [coupons](https://docs.corsair.dev/docs/api/coupons). Built from `action_template_id` `action-apply-coupon` and returned with `type` `APPLY_COUPON`. \* `apply_on`: **Required.** `INVOICE_AMOUNT` or `SPECIFIC_ITEM_PRICE`. \* `coupon_ids`: **Required.** The coupons to apply, as an array of coupon identifiers. It must hold at least one identifier. ### Limit discount Caps the discount that can be given. Use this template to enforce a discount ceiling without an approval step. Built from `action_template_id` `action-limit-discount` and returned with `type` `LIMIT_DISCOUNT`. \* `apply_on`: **Required.** `INVOICE_AMOUNT` or `SPECIFIC_ITEM_PRICE`. \* `maximum_discount`: **Required.** The largest discount allowed, such as `20.0`. \* `discount_type`: **Required.** `PERCENTAGE`, `FLAT_FEE`, or `OFFER_QUANTITY`, which fixes how `maximum_discount` is read. \* `disable_price_override`: Pass `true` to disallow overriding the price outright. ### Limit quantity Constrains the quantities that can be selected. Built from `action_template_id` `action-limit-quantity` and returned with `type` `LIMIT_QUANTITY`. Every parameter is optional, so pass the ones you want to enforce. \* `minimum_quantity`: The smallest quantity allowed. \* `maximum_quantity`: The largest quantity allowed. \* `quantity_step_count`: The increment the quantity can be changed in, so `5` allows 5, 10, 15, and so on. ### Error Returns an error message instead of a change. Use this template to block an operation when the rule matches. Built from `action_template_id` `action-error` and returned with `type` `ERROR`. \* `error_message`: **Required.** The message returned with the action. Evaluation results ------------------ [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules) returns an `apply_rule` object that echoes back the `context` you passed and carries one entry in `rules` for each rule it evaluated: `json { "apply_rule": { "context": { "type": "CPQ", "customer": { "language": "en" }, "quote": { "shipping_address_country": "IN" } }, "rules": [ { "id": "quote-discount-en", "version": 1, "name": "Apply 12 percent discount at invoice level", "evaluation_result": true, "actions": [ { "action_template_id": "action-apply-discount", "type": "APPLY_DISCOUNT", "input": { "apply_on": "INVOICE_AMOUNT", "discount": 12.0, "discount_type": "PERCENTAGE", "duration_type": "ONE_TIME" } } ], "object": "applied_rule" }, { "id": "quote-discount-uk", "version": 1, "name": "Apply 5 percent discount at invoice level for UK quotes", "evaluation_result": false, "object": "applied_rule" } ], "object": "apply_rule" } } ` Read the result of each rule from `evaluation_result`, and read what the rule produced from `actions`. Two things about the shape are worth knowing before you write code against it. \* `actions` is absent, rather than empty, for a rule whose `evaluation_result` is `false`. The second entry above shows a rule that didn't match. \* An entry for an ad hoc `structured_expression` carries only `evaluation_result`, because there's no stored rule to report an `id`, `name`, or `actions` for. A rule that couldn't be evaluated is returned with `error_message` set instead, but only if you passed `skip_failed_rules` as `true`. Otherwise the request fails. For the full list of fields, see the response of [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules). |

> [accordion] business\_rule full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   latest_version?: number | null,
>   active?: boolean | null,
>   released_at?: number | null,
>   released_by?: string | null,
>   updated_at?: number | null,
>   updated_by?: string | null,
>   created_by?: string | null,
>   created_at?: number | null,
>   tags?: any[] | null,
>   structured_expression?: {
>   } | null,
>   actions_on_success?: any[] | null,
>   resource_version?: number | null
> } | null
> ```

***

### get

`businessRules.get`

Retrieve a business rule. Retrieves the released version of the business rule with the specified id, which is the version Chargebee evaluates. The response describes the version in latest\_version.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.businessRules.get({ businessRuleId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `businessRuleId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `business_rule` | `object \| null` | No | A business rule pairs a condition with the actions to take when that condition is met. You supply the context to evaluate, and Chargebee returns the actions configured in `actions_on_success` when the condition evaluates to `true`. Business Rules APIs manage [CPQ Selling Rules](https://www.chargebee.com/docs/cpq/selling-rules). The condition is defined in `structured_expression`, a JSON representation of the rule logic that visual editors and dynamic rule builders can both read and write. Chargebee validates and compiles the expression when the rule is created or updated, and evaluates the compiled form when you call [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules). The `field` of every condition is resolved against the context supplied at evaluation time, so the fields you reference must match the keys of the context the rule is evaluated against. A condition whose `field` is absent from the context never evaluates to `true`, which means the rule never matches. Business rules are versioned. Creating a rule releases its first version, so `latest_version` is `1` and `released_at` is set from the outset. Editing a rule leaves that released version untouched: the first edit creates a draft, and every later edit updates the same draft. [Releasing](https://docs.corsair.dev/docs/api/business_rules/release-a-business-rule) the draft promotes it to the next version number, and that version becomes the latest released version and the one Chargebee evaluates. Until you release it, the previously released version stays in effect, so a rule can keep serving traffic while its next version is being prepared. The `active` attribute is an independent switch that controls whether Chargebee evaluates the rule at all. A rule is created inactive, so it has to be [activated](https://docs.corsair.dev/docs/api/business_rules/activate-a-business-rule) before it takes effect. Related rules can be grouped into a [business ruleset](https://docs.corsair.dev/docs/api/business_rulesets), which evaluates its member rules in priority order using the strategy configured in the ruleset's `execute_mode`. For a walkthrough that creates, activates, and applies a rule in three calls, take a look at the [Business Rules quickstart](https://www.chargebee.com/tutorials/business-rules-quickstart/). Expressions ----------- The `structured_expression` of a rule is a tree of nodes that evaluates to a single `true` or `false`. Every node carries a `type`, which determines the rest of the fields the node takes. The following expression matches a quote from a customer whose language contains `en` and whose shipping country is India or the United States: `json { "type": "GROUP", "operation": "AND", "children": [ { "type": "CONDITION", "field": "customer.language", "operator": "CONTAINS", "value": "en" }, { "type": "CONDITION", "field": "quote.shipping_address_country", "operator": "ANY_OF", "values": ["IN", "US"] } ] } ` Every condition is compiled so that it first tests whether the field is present in the context. A condition on a field that the context doesn't carry evaluates to `false` instead of failing, so the rule that holds it never matches and no `error_message` is returned for it. ### GROUP node Combines the nodes in `children` into a single result. Use a `GROUP` as the root of any expression that has more than one condition, and nest groups to control precedence. \* `operation`: **Required.** `AND` to match only if every child matches, or `OR` to match if any child matches. \* `children`: **Required.** An array holding at least one node. Each entry is itself a `GROUP`, `CONDITION`, or `COLLECTION` node. `json { "type": "GROUP", "operation": "OR", "children": [ { "type": "CONDITION", "field": "quote.payment_terms", "operator": "GREATER_THAN", "value": 30 }, { "type": "CONDITION", "field": "customer.billing_address_country", "operator": "EQUALS", "value": "US" } ] } ` ### CONDITION node Compares one field of the context against a value. \* `field`: **Required.** The path of the field through the context, such as `customer.language`. See [Context](https://docs.corsair.dev/docs/api/business_rules#context) for the paths available. \* `operator`: **Required.** How the comparison is made. See [Operators](https://docs.corsair.dev/docs/api/business_rules#operators) for the operators available and the field types each one compares. \* `value`: The single value to compare against. Required for the single-value operators. \* `values`: The array of values to compare against. Required for `BETWEEN`, `ANY_OF`, and `NONE_OF`. `json { "type": "CONDITION", "field": "quote.contract_duration", "operator": "BETWEEN", "values": [12, 36] } ` ### COLLECTION node Tests the entries of an array in the context, such as the line items of a quote. All four fields are required. \* `field`: **Required.** The array to iterate over, such as `items`. \* `variable`: **Required.** The name each entry is bound to while the predicate is evaluated. \* `mode`: **Required.** `ANY` to match if at least one entry satisfies the predicate, or `NONE` to match only if no entry does. \* `predicate`: **Required.** The expression each entry is tested against, usually a `GROUP` node. Inside the predicate, address the fields of an entry through the bound `variable`. The following node matches a quote that has at least one item discounted by more than 20: `json { "type": "COLLECTION", "field": "items", "variable": "item", "mode": "ANY", "predicate": { "type": "GROUP", "operation": "AND", "children": [ { "type": "CONDITION", "field": "item.discount", "operator": "GREATER_THAN", "value": 20 } ] } } ` ### Operators The following operators are available. The field type is the type the operator can compare, and the value column shows whether the condition takes `value` or `values`. \| Operator \| Field type \| Value \| \|------------------------------------------------------------------------------\|-------------------------\|-------------------------------------------------------------------------------------\| \| `EQUALS`, `NOT_EQUALS` \| String, number, boolean \| `value` \| \| `GREATER_THAN`, `GREATER_THAN_OR_EQUALS`, `LESS_THAN`, `LESS_THAN_OR_EQUALS` \| Number \| `value` \| \| `BETWEEN` \| Number \| `values`, holding exactly two entries, read as the inclusive lower and upper bounds \| \| `CONTAINS`, `NOT_CONTAINS` \| String \| `value` \| \| `STARTS_WITH` \| String \| `value` \| \| `ANY_OF`, `NONE_OF` \| String, number, boolean \| `values`, holding at least one entry \| An operator used on a field of another type isn't rejected when the rule is saved, so the mismatch surfaces only when the rule is evaluated. Context ------- The `context` you pass to [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules) isn't a free-form object. Its `type` selects the schema that the rest of the context is read as, and `CPQ` is the only type available, so a condition can reference only the fields of that schema. A key that falls outside the schema is dropped as the context is read, so a condition on it never evaluates to `true`. A misspelled or unsupported key therefore surfaces as an unmet condition rather than as an error. A `CPQ` context carries `items`, `quote`, `customer`, `user`, `site`, and `quote_subscription`, each of them optional. Pass only the parts the rules you're evaluating need: `json { "type": "CPQ", "customer": { "language": "en", "billing_address_country": "US" }, "quote": { "shipping_address_country": "IN", "payment_terms": 30, "custom_fields": { "region": "apac" } }, "items": [ { "reference_id": "item-1", "amount": 5000, "quantity": 2, "discount": 10 }, { "reference_id": "item-2", "amount": 1200, "quantity": 1, "discount": 0 } ] } ` A condition addresses a field by its path through the context, so `customer.language` reads the `language` of the `customer`. A `COLLECTION` node on `items` iterates over the entries of that array. Each `custom_fields` object holds your own fields keyed by name, and every value must be a string, a number, or a boolean. A condition reads one through its key, as in `quote.custom_fields.region`. The response returns the context back with `rule_ids` filled in on the quote and on each item, so you can see which rules applied where. ### quote \* `type` and `contract_type`: strings. \* `contract_duration` and `payment_terms`: numbers. \* `billing_address_country` and `shipping_address_country`: strings. \* `billing_frequency` and `billing_currency`: strings. \* `creator_email` and `creator_role`: strings. \* `custom_fields`: object. \* `rule_ids`: array of strings. Returned in the response rather than passed, recording the rules that applied to the quote. ### customer \* `billing_address_city`, `billing_address_state`, and `billing_address_country`: strings. \* `language`: string. \* `payment_terms`: number. \* `custom_fields`: object. ### items An array, with each entry holding the following. \* `reference_id`: string, identifying the entry within the context. \* `type`, `item_name`, and `product_family_name`: strings. \* `billing_frequency` and `currency`: strings. \* `billing_cycle`, `amount`, `quantity`, and `discount`: numbers. \* `start_date` and `end_date`: timestamps. \* `rule_ids`: array of strings. Returned in the response rather than passed, recording the rules that applied to that entry. ### user \* `name`, `email`, and `phone`: strings. ### site \* `name`, `domain`, and `currency`: strings. \* `sandbox`: boolean. ### quote\_subscription \* `custom_fields`: object. Actions ------- Every entry in `actions_on_success` is built from an **action template** , a built-in definition that fixes the kind of change an action makes and the parameters it accepts. An action names its template in `action_template_id` and passes that template's parameters in `input`: `json [ { "action_template_id": "action-apply-discount", "input": { "apply_on": "INVOICE_AMOUNT", "discount": 12.0, "discount_type": "PERCENTAGE", "duration_type": "ONE_TIME" } } ] ` The `type` of an action is derived from its template, so it's returned with the action but you don't have to pass it. A parameter that the template doesn't define is rejected. The values of enumerated parameters are matched without regard to case, and are returned in the `input` of the action exactly as you passed them. An action can also carry a `structured_expression` of its own, written in the same format as the expression of the rule. The rule decides whether the action runs at all, and the action's own expression then narrows it to the items of the context that satisfy that expression. One rule can therefore discount some of the items it matched rather than all of them. Only the apply discount, limit discount, and limit quantity templates accept an action-level expression. ### Apply discount Applies a discount to the invoice amount or to specific item prices. Built from `action_template_id` `action-apply-discount` and returned with `type` `APPLY_DISCOUNT`. \* `apply_on`: **Required.** `INVOICE_AMOUNT` to discount the invoice total, or `SPECIFIC_ITEM_PRICE` to discount the item prices the action applies to. \* `discount`: **Required.** The discount to apply, such as `12.0`. \* `discount_type`: **Required.** `PERCENTAGE`, `FLAT_FEE`, or `OFFER_QUANTITY`, which fixes how `discount` is read. \* `duration_type`: **Required.** How long the discount applies, as `ONE_TIME`, `FOREVER`, or `LIMITED_PERIOD`. \* `period_unit`: `DAY`, `WEEK`, `MONTH`, or `YEAR`. Required if `duration_type` is `LIMITED_PERIOD`. \* `period`: The number of `period_unit`s the discount applies for. Required if `period_unit` is passed. ### Apply coupon Applies existing [coupons](https://docs.corsair.dev/docs/api/coupons). Built from `action_template_id` `action-apply-coupon` and returned with `type` `APPLY_COUPON`. \* `apply_on`: **Required.** `INVOICE_AMOUNT` or `SPECIFIC_ITEM_PRICE`. \* `coupon_ids`: **Required.** The coupons to apply, as an array of coupon identifiers. It must hold at least one identifier. ### Limit discount Caps the discount that can be given. Use this template to enforce a discount ceiling without an approval step. Built from `action_template_id` `action-limit-discount` and returned with `type` `LIMIT_DISCOUNT`. \* `apply_on`: **Required.** `INVOICE_AMOUNT` or `SPECIFIC_ITEM_PRICE`. \* `maximum_discount`: **Required.** The largest discount allowed, such as `20.0`. \* `discount_type`: **Required.** `PERCENTAGE`, `FLAT_FEE`, or `OFFER_QUANTITY`, which fixes how `maximum_discount` is read. \* `disable_price_override`: Pass `true` to disallow overriding the price outright. ### Limit quantity Constrains the quantities that can be selected. Built from `action_template_id` `action-limit-quantity` and returned with `type` `LIMIT_QUANTITY`. Every parameter is optional, so pass the ones you want to enforce. \* `minimum_quantity`: The smallest quantity allowed. \* `maximum_quantity`: The largest quantity allowed. \* `quantity_step_count`: The increment the quantity can be changed in, so `5` allows 5, 10, 15, and so on. ### Error Returns an error message instead of a change. Use this template to block an operation when the rule matches. Built from `action_template_id` `action-error` and returned with `type` `ERROR`. \* `error_message`: **Required.** The message returned with the action. Evaluation results ------------------ [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules) returns an `apply_rule` object that echoes back the `context` you passed and carries one entry in `rules` for each rule it evaluated: `json { "apply_rule": { "context": { "type": "CPQ", "customer": { "language": "en" }, "quote": { "shipping_address_country": "IN" } }, "rules": [ { "id": "quote-discount-en", "version": 1, "name": "Apply 12 percent discount at invoice level", "evaluation_result": true, "actions": [ { "action_template_id": "action-apply-discount", "type": "APPLY_DISCOUNT", "input": { "apply_on": "INVOICE_AMOUNT", "discount": 12.0, "discount_type": "PERCENTAGE", "duration_type": "ONE_TIME" } } ], "object": "applied_rule" }, { "id": "quote-discount-uk", "version": 1, "name": "Apply 5 percent discount at invoice level for UK quotes", "evaluation_result": false, "object": "applied_rule" } ], "object": "apply_rule" } } ` Read the result of each rule from `evaluation_result`, and read what the rule produced from `actions`. Two things about the shape are worth knowing before you write code against it. \* `actions` is absent, rather than empty, for a rule whose `evaluation_result` is `false`. The second entry above shows a rule that didn't match. \* An entry for an ad hoc `structured_expression` carries only `evaluation_result`, because there's no stored rule to report an `id`, `name`, or `actions` for. A rule that couldn't be evaluated is returned with `error_message` set instead, but only if you passed `skip_failed_rules` as `true`. Otherwise the request fails. For the full list of fields, see the response of [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules). |

> [accordion] business\_rule full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   latest_version?: number | null,
>   active?: boolean | null,
>   released_at?: number | null,
>   released_by?: string | null,
>   updated_at?: number | null,
>   updated_by?: string | null,
>   created_by?: string | null,
>   created_at?: number | null,
>   tags?: any[] | null,
>   structured_expression?: {
>   } | null,
>   actions_on_success?: any[] | null,
>   resource_version?: number | null
> } | null
> ```

***

### getDraft

`businessRules.getDraft`

Retrieve a business rule draft. Retrieves the draft version of a business rule. The draft holds changes that have not been released yet, so it can differ from the released version returned by Retrieve a business rule. Use this operation to review a staged change before releasing it.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.businessRules.getDraft({ businessRuleId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `businessRuleId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `business_rule` | `object \| null` | No | A business rule pairs a condition with the actions to take when that condition is met. You supply the context to evaluate, and Chargebee returns the actions configured in `actions_on_success` when the condition evaluates to `true`. Business Rules APIs manage [CPQ Selling Rules](https://www.chargebee.com/docs/cpq/selling-rules). The condition is defined in `structured_expression`, a JSON representation of the rule logic that visual editors and dynamic rule builders can both read and write. Chargebee validates and compiles the expression when the rule is created or updated, and evaluates the compiled form when you call [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules). The `field` of every condition is resolved against the context supplied at evaluation time, so the fields you reference must match the keys of the context the rule is evaluated against. A condition whose `field` is absent from the context never evaluates to `true`, which means the rule never matches. Business rules are versioned. Creating a rule releases its first version, so `latest_version` is `1` and `released_at` is set from the outset. Editing a rule leaves that released version untouched: the first edit creates a draft, and every later edit updates the same draft. [Releasing](https://docs.corsair.dev/docs/api/business_rules/release-a-business-rule) the draft promotes it to the next version number, and that version becomes the latest released version and the one Chargebee evaluates. Until you release it, the previously released version stays in effect, so a rule can keep serving traffic while its next version is being prepared. The `active` attribute is an independent switch that controls whether Chargebee evaluates the rule at all. A rule is created inactive, so it has to be [activated](https://docs.corsair.dev/docs/api/business_rules/activate-a-business-rule) before it takes effect. Related rules can be grouped into a [business ruleset](https://docs.corsair.dev/docs/api/business_rulesets), which evaluates its member rules in priority order using the strategy configured in the ruleset's `execute_mode`. For a walkthrough that creates, activates, and applies a rule in three calls, take a look at the [Business Rules quickstart](https://www.chargebee.com/tutorials/business-rules-quickstart/). Expressions ----------- The `structured_expression` of a rule is a tree of nodes that evaluates to a single `true` or `false`. Every node carries a `type`, which determines the rest of the fields the node takes. The following expression matches a quote from a customer whose language contains `en` and whose shipping country is India or the United States: `json { "type": "GROUP", "operation": "AND", "children": [ { "type": "CONDITION", "field": "customer.language", "operator": "CONTAINS", "value": "en" }, { "type": "CONDITION", "field": "quote.shipping_address_country", "operator": "ANY_OF", "values": ["IN", "US"] } ] } ` Every condition is compiled so that it first tests whether the field is present in the context. A condition on a field that the context doesn't carry evaluates to `false` instead of failing, so the rule that holds it never matches and no `error_message` is returned for it. ### GROUP node Combines the nodes in `children` into a single result. Use a `GROUP` as the root of any expression that has more than one condition, and nest groups to control precedence. \* `operation`: **Required.** `AND` to match only if every child matches, or `OR` to match if any child matches. \* `children`: **Required.** An array holding at least one node. Each entry is itself a `GROUP`, `CONDITION`, or `COLLECTION` node. `json { "type": "GROUP", "operation": "OR", "children": [ { "type": "CONDITION", "field": "quote.payment_terms", "operator": "GREATER_THAN", "value": 30 }, { "type": "CONDITION", "field": "customer.billing_address_country", "operator": "EQUALS", "value": "US" } ] } ` ### CONDITION node Compares one field of the context against a value. \* `field`: **Required.** The path of the field through the context, such as `customer.language`. See [Context](https://docs.corsair.dev/docs/api/business_rules#context) for the paths available. \* `operator`: **Required.** How the comparison is made. See [Operators](https://docs.corsair.dev/docs/api/business_rules#operators) for the operators available and the field types each one compares. \* `value`: The single value to compare against. Required for the single-value operators. \* `values`: The array of values to compare against. Required for `BETWEEN`, `ANY_OF`, and `NONE_OF`. `json { "type": "CONDITION", "field": "quote.contract_duration", "operator": "BETWEEN", "values": [12, 36] } ` ### COLLECTION node Tests the entries of an array in the context, such as the line items of a quote. All four fields are required. \* `field`: **Required.** The array to iterate over, such as `items`. \* `variable`: **Required.** The name each entry is bound to while the predicate is evaluated. \* `mode`: **Required.** `ANY` to match if at least one entry satisfies the predicate, or `NONE` to match only if no entry does. \* `predicate`: **Required.** The expression each entry is tested against, usually a `GROUP` node. Inside the predicate, address the fields of an entry through the bound `variable`. The following node matches a quote that has at least one item discounted by more than 20: `json { "type": "COLLECTION", "field": "items", "variable": "item", "mode": "ANY", "predicate": { "type": "GROUP", "operation": "AND", "children": [ { "type": "CONDITION", "field": "item.discount", "operator": "GREATER_THAN", "value": 20 } ] } } ` ### Operators The following operators are available. The field type is the type the operator can compare, and the value column shows whether the condition takes `value` or `values`. \| Operator \| Field type \| Value \| \|------------------------------------------------------------------------------\|-------------------------\|-------------------------------------------------------------------------------------\| \| `EQUALS`, `NOT_EQUALS` \| String, number, boolean \| `value` \| \| `GREATER_THAN`, `GREATER_THAN_OR_EQUALS`, `LESS_THAN`, `LESS_THAN_OR_EQUALS` \| Number \| `value` \| \| `BETWEEN` \| Number \| `values`, holding exactly two entries, read as the inclusive lower and upper bounds \| \| `CONTAINS`, `NOT_CONTAINS` \| String \| `value` \| \| `STARTS_WITH` \| String \| `value` \| \| `ANY_OF`, `NONE_OF` \| String, number, boolean \| `values`, holding at least one entry \| An operator used on a field of another type isn't rejected when the rule is saved, so the mismatch surfaces only when the rule is evaluated. Context ------- The `context` you pass to [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules) isn't a free-form object. Its `type` selects the schema that the rest of the context is read as, and `CPQ` is the only type available, so a condition can reference only the fields of that schema. A key that falls outside the schema is dropped as the context is read, so a condition on it never evaluates to `true`. A misspelled or unsupported key therefore surfaces as an unmet condition rather than as an error. A `CPQ` context carries `items`, `quote`, `customer`, `user`, `site`, and `quote_subscription`, each of them optional. Pass only the parts the rules you're evaluating need: `json { "type": "CPQ", "customer": { "language": "en", "billing_address_country": "US" }, "quote": { "shipping_address_country": "IN", "payment_terms": 30, "custom_fields": { "region": "apac" } }, "items": [ { "reference_id": "item-1", "amount": 5000, "quantity": 2, "discount": 10 }, { "reference_id": "item-2", "amount": 1200, "quantity": 1, "discount": 0 } ] } ` A condition addresses a field by its path through the context, so `customer.language` reads the `language` of the `customer`. A `COLLECTION` node on `items` iterates over the entries of that array. Each `custom_fields` object holds your own fields keyed by name, and every value must be a string, a number, or a boolean. A condition reads one through its key, as in `quote.custom_fields.region`. The response returns the context back with `rule_ids` filled in on the quote and on each item, so you can see which rules applied where. ### quote \* `type` and `contract_type`: strings. \* `contract_duration` and `payment_terms`: numbers. \* `billing_address_country` and `shipping_address_country`: strings. \* `billing_frequency` and `billing_currency`: strings. \* `creator_email` and `creator_role`: strings. \* `custom_fields`: object. \* `rule_ids`: array of strings. Returned in the response rather than passed, recording the rules that applied to the quote. ### customer \* `billing_address_city`, `billing_address_state`, and `billing_address_country`: strings. \* `language`: string. \* `payment_terms`: number. \* `custom_fields`: object. ### items An array, with each entry holding the following. \* `reference_id`: string, identifying the entry within the context. \* `type`, `item_name`, and `product_family_name`: strings. \* `billing_frequency` and `currency`: strings. \* `billing_cycle`, `amount`, `quantity`, and `discount`: numbers. \* `start_date` and `end_date`: timestamps. \* `rule_ids`: array of strings. Returned in the response rather than passed, recording the rules that applied to that entry. ### user \* `name`, `email`, and `phone`: strings. ### site \* `name`, `domain`, and `currency`: strings. \* `sandbox`: boolean. ### quote\_subscription \* `custom_fields`: object. Actions ------- Every entry in `actions_on_success` is built from an **action template** , a built-in definition that fixes the kind of change an action makes and the parameters it accepts. An action names its template in `action_template_id` and passes that template's parameters in `input`: `json [ { "action_template_id": "action-apply-discount", "input": { "apply_on": "INVOICE_AMOUNT", "discount": 12.0, "discount_type": "PERCENTAGE", "duration_type": "ONE_TIME" } } ] ` The `type` of an action is derived from its template, so it's returned with the action but you don't have to pass it. A parameter that the template doesn't define is rejected. The values of enumerated parameters are matched without regard to case, and are returned in the `input` of the action exactly as you passed them. An action can also carry a `structured_expression` of its own, written in the same format as the expression of the rule. The rule decides whether the action runs at all, and the action's own expression then narrows it to the items of the context that satisfy that expression. One rule can therefore discount some of the items it matched rather than all of them. Only the apply discount, limit discount, and limit quantity templates accept an action-level expression. ### Apply discount Applies a discount to the invoice amount or to specific item prices. Built from `action_template_id` `action-apply-discount` and returned with `type` `APPLY_DISCOUNT`. \* `apply_on`: **Required.** `INVOICE_AMOUNT` to discount the invoice total, or `SPECIFIC_ITEM_PRICE` to discount the item prices the action applies to. \* `discount`: **Required.** The discount to apply, such as `12.0`. \* `discount_type`: **Required.** `PERCENTAGE`, `FLAT_FEE`, or `OFFER_QUANTITY`, which fixes how `discount` is read. \* `duration_type`: **Required.** How long the discount applies, as `ONE_TIME`, `FOREVER`, or `LIMITED_PERIOD`. \* `period_unit`: `DAY`, `WEEK`, `MONTH`, or `YEAR`. Required if `duration_type` is `LIMITED_PERIOD`. \* `period`: The number of `period_unit`s the discount applies for. Required if `period_unit` is passed. ### Apply coupon Applies existing [coupons](https://docs.corsair.dev/docs/api/coupons). Built from `action_template_id` `action-apply-coupon` and returned with `type` `APPLY_COUPON`. \* `apply_on`: **Required.** `INVOICE_AMOUNT` or `SPECIFIC_ITEM_PRICE`. \* `coupon_ids`: **Required.** The coupons to apply, as an array of coupon identifiers. It must hold at least one identifier. ### Limit discount Caps the discount that can be given. Use this template to enforce a discount ceiling without an approval step. Built from `action_template_id` `action-limit-discount` and returned with `type` `LIMIT_DISCOUNT`. \* `apply_on`: **Required.** `INVOICE_AMOUNT` or `SPECIFIC_ITEM_PRICE`. \* `maximum_discount`: **Required.** The largest discount allowed, such as `20.0`. \* `discount_type`: **Required.** `PERCENTAGE`, `FLAT_FEE`, or `OFFER_QUANTITY`, which fixes how `maximum_discount` is read. \* `disable_price_override`: Pass `true` to disallow overriding the price outright. ### Limit quantity Constrains the quantities that can be selected. Built from `action_template_id` `action-limit-quantity` and returned with `type` `LIMIT_QUANTITY`. Every parameter is optional, so pass the ones you want to enforce. \* `minimum_quantity`: The smallest quantity allowed. \* `maximum_quantity`: The largest quantity allowed. \* `quantity_step_count`: The increment the quantity can be changed in, so `5` allows 5, 10, 15, and so on. ### Error Returns an error message instead of a change. Use this template to block an operation when the rule matches. Built from `action_template_id` `action-error` and returned with `type` `ERROR`. \* `error_message`: **Required.** The message returned with the action. Evaluation results ------------------ [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules) returns an `apply_rule` object that echoes back the `context` you passed and carries one entry in `rules` for each rule it evaluated: `json { "apply_rule": { "context": { "type": "CPQ", "customer": { "language": "en" }, "quote": { "shipping_address_country": "IN" } }, "rules": [ { "id": "quote-discount-en", "version": 1, "name": "Apply 12 percent discount at invoice level", "evaluation_result": true, "actions": [ { "action_template_id": "action-apply-discount", "type": "APPLY_DISCOUNT", "input": { "apply_on": "INVOICE_AMOUNT", "discount": 12.0, "discount_type": "PERCENTAGE", "duration_type": "ONE_TIME" } } ], "object": "applied_rule" }, { "id": "quote-discount-uk", "version": 1, "name": "Apply 5 percent discount at invoice level for UK quotes", "evaluation_result": false, "object": "applied_rule" } ], "object": "apply_rule" } } ` Read the result of each rule from `evaluation_result`, and read what the rule produced from `actions`. Two things about the shape are worth knowing before you write code against it. \* `actions` is absent, rather than empty, for a rule whose `evaluation_result` is `false`. The second entry above shows a rule that didn't match. \* An entry for an ad hoc `structured_expression` carries only `evaluation_result`, because there's no stored rule to report an `id`, `name`, or `actions` for. A rule that couldn't be evaluated is returned with `error_message` set instead, but only if you passed `skip_failed_rules` as `true`. Otherwise the request fails. For the full list of fields, see the response of [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules). |

> [accordion] business\_rule full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   latest_version?: number | null,
>   active?: boolean | null,
>   released_at?: number | null,
>   released_by?: string | null,
>   updated_at?: number | null,
>   updated_by?: string | null,
>   created_by?: string | null,
>   created_at?: number | null,
>   tags?: any[] | null,
>   structured_expression?: {
>   } | null,
>   actions_on_success?: any[] | null,
>   resource_version?: number | null
> } | null
> ```

***

### list

`businessRules.list`

List business rules. Returns a list of business rules satisfying all the conditions specified in the filter parameters. Each rule is returned as its released version. Deleted rules are not returned.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.businessRules.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `draft` | `object` | No | optional, boolean filter Filters the results by the draft state of the business rule. Pass `true` to return the rules that have an unreleased draft, and `false`, the default, to return the rules as of their released version. **Supported operators :** is **Example →** *draft\\\[is\\] = "true"* |
| `active` | `object` | No | optional, boolean filter Filters the results by the active status of the business rule. Pass `true` to return only the rules Chargebee currently evaluates, and `false` to return only the rules that are switched off. When omitted, rules are returned irrespective of their active status. **Supported operators :** is **Example →** *active\\\[is\\] = "true"* |

> [accordion] draft full type
>
> ```ts theme={null}
> {
>   is?: true | false
> }
> ```

> [accordion] active full type
>
> ```ts theme={null}
> {
>   is?: true | false
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   business_rule?: {
>     id?: string | null,
>     name?: string | null,
>     description?: string | null,
>     latest_version?: number | null,
>     active?: boolean | null,
>     released_at?: number | null,
>     released_by?: string | null,
>     updated_at?: number | null,
>     updated_by?: string | null,
>     created_by?: string | null,
>     created_at?: number | null,
>     tags?: any[] | null,
>     structured_expression?: {
>     } | null,
>     actions_on_success?: any[] | null,
>     resource_version?: number | null
>   } | null
> }[] | null
> ```

***

### release

`businessRules.release`

Release a business rule. Releases the draft version of a business rule. The draft is promoted to the next version number and becomes the released version that Chargebee evaluates, so latest\_version is incremented and released\_at is set. Until you release it, the previously released version stays in effect.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.businessRules.release({ businessRuleId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `businessRuleId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `business_rule` | `object \| null` | No | A business rule pairs a condition with the actions to take when that condition is met. You supply the context to evaluate, and Chargebee returns the actions configured in `actions_on_success` when the condition evaluates to `true`. Business Rules APIs manage [CPQ Selling Rules](https://www.chargebee.com/docs/cpq/selling-rules). The condition is defined in `structured_expression`, a JSON representation of the rule logic that visual editors and dynamic rule builders can both read and write. Chargebee validates and compiles the expression when the rule is created or updated, and evaluates the compiled form when you call [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules). The `field` of every condition is resolved against the context supplied at evaluation time, so the fields you reference must match the keys of the context the rule is evaluated against. A condition whose `field` is absent from the context never evaluates to `true`, which means the rule never matches. Business rules are versioned. Creating a rule releases its first version, so `latest_version` is `1` and `released_at` is set from the outset. Editing a rule leaves that released version untouched: the first edit creates a draft, and every later edit updates the same draft. [Releasing](https://docs.corsair.dev/docs/api/business_rules/release-a-business-rule) the draft promotes it to the next version number, and that version becomes the latest released version and the one Chargebee evaluates. Until you release it, the previously released version stays in effect, so a rule can keep serving traffic while its next version is being prepared. The `active` attribute is an independent switch that controls whether Chargebee evaluates the rule at all. A rule is created inactive, so it has to be [activated](https://docs.corsair.dev/docs/api/business_rules/activate-a-business-rule) before it takes effect. Related rules can be grouped into a [business ruleset](https://docs.corsair.dev/docs/api/business_rulesets), which evaluates its member rules in priority order using the strategy configured in the ruleset's `execute_mode`. For a walkthrough that creates, activates, and applies a rule in three calls, take a look at the [Business Rules quickstart](https://www.chargebee.com/tutorials/business-rules-quickstart/). Expressions ----------- The `structured_expression` of a rule is a tree of nodes that evaluates to a single `true` or `false`. Every node carries a `type`, which determines the rest of the fields the node takes. The following expression matches a quote from a customer whose language contains `en` and whose shipping country is India or the United States: `json { "type": "GROUP", "operation": "AND", "children": [ { "type": "CONDITION", "field": "customer.language", "operator": "CONTAINS", "value": "en" }, { "type": "CONDITION", "field": "quote.shipping_address_country", "operator": "ANY_OF", "values": ["IN", "US"] } ] } ` Every condition is compiled so that it first tests whether the field is present in the context. A condition on a field that the context doesn't carry evaluates to `false` instead of failing, so the rule that holds it never matches and no `error_message` is returned for it. ### GROUP node Combines the nodes in `children` into a single result. Use a `GROUP` as the root of any expression that has more than one condition, and nest groups to control precedence. \* `operation`: **Required.** `AND` to match only if every child matches, or `OR` to match if any child matches. \* `children`: **Required.** An array holding at least one node. Each entry is itself a `GROUP`, `CONDITION`, or `COLLECTION` node. `json { "type": "GROUP", "operation": "OR", "children": [ { "type": "CONDITION", "field": "quote.payment_terms", "operator": "GREATER_THAN", "value": 30 }, { "type": "CONDITION", "field": "customer.billing_address_country", "operator": "EQUALS", "value": "US" } ] } ` ### CONDITION node Compares one field of the context against a value. \* `field`: **Required.** The path of the field through the context, such as `customer.language`. See [Context](https://docs.corsair.dev/docs/api/business_rules#context) for the paths available. \* `operator`: **Required.** How the comparison is made. See [Operators](https://docs.corsair.dev/docs/api/business_rules#operators) for the operators available and the field types each one compares. \* `value`: The single value to compare against. Required for the single-value operators. \* `values`: The array of values to compare against. Required for `BETWEEN`, `ANY_OF`, and `NONE_OF`. `json { "type": "CONDITION", "field": "quote.contract_duration", "operator": "BETWEEN", "values": [12, 36] } ` ### COLLECTION node Tests the entries of an array in the context, such as the line items of a quote. All four fields are required. \* `field`: **Required.** The array to iterate over, such as `items`. \* `variable`: **Required.** The name each entry is bound to while the predicate is evaluated. \* `mode`: **Required.** `ANY` to match if at least one entry satisfies the predicate, or `NONE` to match only if no entry does. \* `predicate`: **Required.** The expression each entry is tested against, usually a `GROUP` node. Inside the predicate, address the fields of an entry through the bound `variable`. The following node matches a quote that has at least one item discounted by more than 20: `json { "type": "COLLECTION", "field": "items", "variable": "item", "mode": "ANY", "predicate": { "type": "GROUP", "operation": "AND", "children": [ { "type": "CONDITION", "field": "item.discount", "operator": "GREATER_THAN", "value": 20 } ] } } ` ### Operators The following operators are available. The field type is the type the operator can compare, and the value column shows whether the condition takes `value` or `values`. \| Operator \| Field type \| Value \| \|------------------------------------------------------------------------------\|-------------------------\|-------------------------------------------------------------------------------------\| \| `EQUALS`, `NOT_EQUALS` \| String, number, boolean \| `value` \| \| `GREATER_THAN`, `GREATER_THAN_OR_EQUALS`, `LESS_THAN`, `LESS_THAN_OR_EQUALS` \| Number \| `value` \| \| `BETWEEN` \| Number \| `values`, holding exactly two entries, read as the inclusive lower and upper bounds \| \| `CONTAINS`, `NOT_CONTAINS` \| String \| `value` \| \| `STARTS_WITH` \| String \| `value` \| \| `ANY_OF`, `NONE_OF` \| String, number, boolean \| `values`, holding at least one entry \| An operator used on a field of another type isn't rejected when the rule is saved, so the mismatch surfaces only when the rule is evaluated. Context ------- The `context` you pass to [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules) isn't a free-form object. Its `type` selects the schema that the rest of the context is read as, and `CPQ` is the only type available, so a condition can reference only the fields of that schema. A key that falls outside the schema is dropped as the context is read, so a condition on it never evaluates to `true`. A misspelled or unsupported key therefore surfaces as an unmet condition rather than as an error. A `CPQ` context carries `items`, `quote`, `customer`, `user`, `site`, and `quote_subscription`, each of them optional. Pass only the parts the rules you're evaluating need: `json { "type": "CPQ", "customer": { "language": "en", "billing_address_country": "US" }, "quote": { "shipping_address_country": "IN", "payment_terms": 30, "custom_fields": { "region": "apac" } }, "items": [ { "reference_id": "item-1", "amount": 5000, "quantity": 2, "discount": 10 }, { "reference_id": "item-2", "amount": 1200, "quantity": 1, "discount": 0 } ] } ` A condition addresses a field by its path through the context, so `customer.language` reads the `language` of the `customer`. A `COLLECTION` node on `items` iterates over the entries of that array. Each `custom_fields` object holds your own fields keyed by name, and every value must be a string, a number, or a boolean. A condition reads one through its key, as in `quote.custom_fields.region`. The response returns the context back with `rule_ids` filled in on the quote and on each item, so you can see which rules applied where. ### quote \* `type` and `contract_type`: strings. \* `contract_duration` and `payment_terms`: numbers. \* `billing_address_country` and `shipping_address_country`: strings. \* `billing_frequency` and `billing_currency`: strings. \* `creator_email` and `creator_role`: strings. \* `custom_fields`: object. \* `rule_ids`: array of strings. Returned in the response rather than passed, recording the rules that applied to the quote. ### customer \* `billing_address_city`, `billing_address_state`, and `billing_address_country`: strings. \* `language`: string. \* `payment_terms`: number. \* `custom_fields`: object. ### items An array, with each entry holding the following. \* `reference_id`: string, identifying the entry within the context. \* `type`, `item_name`, and `product_family_name`: strings. \* `billing_frequency` and `currency`: strings. \* `billing_cycle`, `amount`, `quantity`, and `discount`: numbers. \* `start_date` and `end_date`: timestamps. \* `rule_ids`: array of strings. Returned in the response rather than passed, recording the rules that applied to that entry. ### user \* `name`, `email`, and `phone`: strings. ### site \* `name`, `domain`, and `currency`: strings. \* `sandbox`: boolean. ### quote\_subscription \* `custom_fields`: object. Actions ------- Every entry in `actions_on_success` is built from an **action template** , a built-in definition that fixes the kind of change an action makes and the parameters it accepts. An action names its template in `action_template_id` and passes that template's parameters in `input`: `json [ { "action_template_id": "action-apply-discount", "input": { "apply_on": "INVOICE_AMOUNT", "discount": 12.0, "discount_type": "PERCENTAGE", "duration_type": "ONE_TIME" } } ] ` The `type` of an action is derived from its template, so it's returned with the action but you don't have to pass it. A parameter that the template doesn't define is rejected. The values of enumerated parameters are matched without regard to case, and are returned in the `input` of the action exactly as you passed them. An action can also carry a `structured_expression` of its own, written in the same format as the expression of the rule. The rule decides whether the action runs at all, and the action's own expression then narrows it to the items of the context that satisfy that expression. One rule can therefore discount some of the items it matched rather than all of them. Only the apply discount, limit discount, and limit quantity templates accept an action-level expression. ### Apply discount Applies a discount to the invoice amount or to specific item prices. Built from `action_template_id` `action-apply-discount` and returned with `type` `APPLY_DISCOUNT`. \* `apply_on`: **Required.** `INVOICE_AMOUNT` to discount the invoice total, or `SPECIFIC_ITEM_PRICE` to discount the item prices the action applies to. \* `discount`: **Required.** The discount to apply, such as `12.0`. \* `discount_type`: **Required.** `PERCENTAGE`, `FLAT_FEE`, or `OFFER_QUANTITY`, which fixes how `discount` is read. \* `duration_type`: **Required.** How long the discount applies, as `ONE_TIME`, `FOREVER`, or `LIMITED_PERIOD`. \* `period_unit`: `DAY`, `WEEK`, `MONTH`, or `YEAR`. Required if `duration_type` is `LIMITED_PERIOD`. \* `period`: The number of `period_unit`s the discount applies for. Required if `period_unit` is passed. ### Apply coupon Applies existing [coupons](https://docs.corsair.dev/docs/api/coupons). Built from `action_template_id` `action-apply-coupon` and returned with `type` `APPLY_COUPON`. \* `apply_on`: **Required.** `INVOICE_AMOUNT` or `SPECIFIC_ITEM_PRICE`. \* `coupon_ids`: **Required.** The coupons to apply, as an array of coupon identifiers. It must hold at least one identifier. ### Limit discount Caps the discount that can be given. Use this template to enforce a discount ceiling without an approval step. Built from `action_template_id` `action-limit-discount` and returned with `type` `LIMIT_DISCOUNT`. \* `apply_on`: **Required.** `INVOICE_AMOUNT` or `SPECIFIC_ITEM_PRICE`. \* `maximum_discount`: **Required.** The largest discount allowed, such as `20.0`. \* `discount_type`: **Required.** `PERCENTAGE`, `FLAT_FEE`, or `OFFER_QUANTITY`, which fixes how `maximum_discount` is read. \* `disable_price_override`: Pass `true` to disallow overriding the price outright. ### Limit quantity Constrains the quantities that can be selected. Built from `action_template_id` `action-limit-quantity` and returned with `type` `LIMIT_QUANTITY`. Every parameter is optional, so pass the ones you want to enforce. \* `minimum_quantity`: The smallest quantity allowed. \* `maximum_quantity`: The largest quantity allowed. \* `quantity_step_count`: The increment the quantity can be changed in, so `5` allows 5, 10, 15, and so on. ### Error Returns an error message instead of a change. Use this template to block an operation when the rule matches. Built from `action_template_id` `action-error` and returned with `type` `ERROR`. \* `error_message`: **Required.** The message returned with the action. Evaluation results ------------------ [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules) returns an `apply_rule` object that echoes back the `context` you passed and carries one entry in `rules` for each rule it evaluated: `json { "apply_rule": { "context": { "type": "CPQ", "customer": { "language": "en" }, "quote": { "shipping_address_country": "IN" } }, "rules": [ { "id": "quote-discount-en", "version": 1, "name": "Apply 12 percent discount at invoice level", "evaluation_result": true, "actions": [ { "action_template_id": "action-apply-discount", "type": "APPLY_DISCOUNT", "input": { "apply_on": "INVOICE_AMOUNT", "discount": 12.0, "discount_type": "PERCENTAGE", "duration_type": "ONE_TIME" } } ], "object": "applied_rule" }, { "id": "quote-discount-uk", "version": 1, "name": "Apply 5 percent discount at invoice level for UK quotes", "evaluation_result": false, "object": "applied_rule" } ], "object": "apply_rule" } } ` Read the result of each rule from `evaluation_result`, and read what the rule produced from `actions`. Two things about the shape are worth knowing before you write code against it. \* `actions` is absent, rather than empty, for a rule whose `evaluation_result` is `false`. The second entry above shows a rule that didn't match. \* An entry for an ad hoc `structured_expression` carries only `evaluation_result`, because there's no stored rule to report an `id`, `name`, or `actions` for. A rule that couldn't be evaluated is returned with `error_message` set instead, but only if you passed `skip_failed_rules` as `true`. Otherwise the request fails. For the full list of fields, see the response of [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules). |

> [accordion] business\_rule full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   latest_version?: number | null,
>   active?: boolean | null,
>   released_at?: number | null,
>   released_by?: string | null,
>   updated_at?: number | null,
>   updated_by?: string | null,
>   created_by?: string | null,
>   created_at?: number | null,
>   tags?: any[] | null,
>   structured_expression?: {
>   } | null,
>   actions_on_success?: any[] | null,
>   resource_version?: number | null
> } | null
> ```

***

### updateDraft

`businessRules.updateDraft`

Update a business rule draft. Updates the draft version of a business rule. The first edit creates a draft from the released version, and every later edit updates that same draft. Changes made to a draft do not affect rule evaluation until the draft is released.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.businessRules.updateDraft({
	businessRuleId: 'example',
	name: 'example',
	structured_expression: {},
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `businessRuleId` | `string` | Yes | — |
| `name` | `string` | Yes | Display name of the business rule. |
| `description` | `string` | No | Description of what the business rule does. |
| `tags` | `any[]` | No | — |
| `structured_expression` | `object` | Yes | A structured JSON representation of the rule logic, designed for visual editors and dynamic builders. Chargebee validates and compiles it when the draft is updated. Pass it as a JSON object. See [Expressions](https://docs.corsair.dev/docs/api/business_rules#expressions) for the node types and the operators each field type supports, and [Context](https://docs.corsair.dev/docs/api/business_rules#context) for the fields a condition can reference. **Impacts** \* A condition whose `field` is absent from the context passed to [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules) evaluates to `false`, so the rule never matches and no error is returned. **Example →** `structured_expression = {"type":"GROUP","operation":"AND","children":[{"type":"CONDITION","field":"customer.language","operator":"CONTAINS","value":"en"},{"type":"CONDITION","field":"quote.shipping_address_country","operator":"ANY_OF","values":["IN","US","GB"]}]}` |
| `actions_on_success` | `any[]` | No | The actions to execute when the rule expression evaluates to `true`, passed as a JSON array. Each action takes the `action_template_id` of the template it is built from and that template's parameters in `input`. See [Actions](https://docs.corsair.dev/docs/api/business_rules#actions) for the templates available, the parameters each one takes, and the optional action-level `structured_expression` that narrows the items an action applies to. **Example →** `actions_on_success = [{"action_template_id":"action-apply-discount","input":{"apply_on":"invoice_amount","duration_type":"one_time","discount":15.0,"discount_type":"percentage"}}]` |

> [accordion] structured\_expression full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `business_rule` | `object \| null` | No | A business rule pairs a condition with the actions to take when that condition is met. You supply the context to evaluate, and Chargebee returns the actions configured in `actions_on_success` when the condition evaluates to `true`. Business Rules APIs manage [CPQ Selling Rules](https://www.chargebee.com/docs/cpq/selling-rules). The condition is defined in `structured_expression`, a JSON representation of the rule logic that visual editors and dynamic rule builders can both read and write. Chargebee validates and compiles the expression when the rule is created or updated, and evaluates the compiled form when you call [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules). The `field` of every condition is resolved against the context supplied at evaluation time, so the fields you reference must match the keys of the context the rule is evaluated against. A condition whose `field` is absent from the context never evaluates to `true`, which means the rule never matches. Business rules are versioned. Creating a rule releases its first version, so `latest_version` is `1` and `released_at` is set from the outset. Editing a rule leaves that released version untouched: the first edit creates a draft, and every later edit updates the same draft. [Releasing](https://docs.corsair.dev/docs/api/business_rules/release-a-business-rule) the draft promotes it to the next version number, and that version becomes the latest released version and the one Chargebee evaluates. Until you release it, the previously released version stays in effect, so a rule can keep serving traffic while its next version is being prepared. The `active` attribute is an independent switch that controls whether Chargebee evaluates the rule at all. A rule is created inactive, so it has to be [activated](https://docs.corsair.dev/docs/api/business_rules/activate-a-business-rule) before it takes effect. Related rules can be grouped into a [business ruleset](https://docs.corsair.dev/docs/api/business_rulesets), which evaluates its member rules in priority order using the strategy configured in the ruleset's `execute_mode`. For a walkthrough that creates, activates, and applies a rule in three calls, take a look at the [Business Rules quickstart](https://www.chargebee.com/tutorials/business-rules-quickstart/). Expressions ----------- The `structured_expression` of a rule is a tree of nodes that evaluates to a single `true` or `false`. Every node carries a `type`, which determines the rest of the fields the node takes. The following expression matches a quote from a customer whose language contains `en` and whose shipping country is India or the United States: `json { "type": "GROUP", "operation": "AND", "children": [ { "type": "CONDITION", "field": "customer.language", "operator": "CONTAINS", "value": "en" }, { "type": "CONDITION", "field": "quote.shipping_address_country", "operator": "ANY_OF", "values": ["IN", "US"] } ] } ` Every condition is compiled so that it first tests whether the field is present in the context. A condition on a field that the context doesn't carry evaluates to `false` instead of failing, so the rule that holds it never matches and no `error_message` is returned for it. ### GROUP node Combines the nodes in `children` into a single result. Use a `GROUP` as the root of any expression that has more than one condition, and nest groups to control precedence. \* `operation`: **Required.** `AND` to match only if every child matches, or `OR` to match if any child matches. \* `children`: **Required.** An array holding at least one node. Each entry is itself a `GROUP`, `CONDITION`, or `COLLECTION` node. `json { "type": "GROUP", "operation": "OR", "children": [ { "type": "CONDITION", "field": "quote.payment_terms", "operator": "GREATER_THAN", "value": 30 }, { "type": "CONDITION", "field": "customer.billing_address_country", "operator": "EQUALS", "value": "US" } ] } ` ### CONDITION node Compares one field of the context against a value. \* `field`: **Required.** The path of the field through the context, such as `customer.language`. See [Context](https://docs.corsair.dev/docs/api/business_rules#context) for the paths available. \* `operator`: **Required.** How the comparison is made. See [Operators](https://docs.corsair.dev/docs/api/business_rules#operators) for the operators available and the field types each one compares. \* `value`: The single value to compare against. Required for the single-value operators. \* `values`: The array of values to compare against. Required for `BETWEEN`, `ANY_OF`, and `NONE_OF`. `json { "type": "CONDITION", "field": "quote.contract_duration", "operator": "BETWEEN", "values": [12, 36] } ` ### COLLECTION node Tests the entries of an array in the context, such as the line items of a quote. All four fields are required. \* `field`: **Required.** The array to iterate over, such as `items`. \* `variable`: **Required.** The name each entry is bound to while the predicate is evaluated. \* `mode`: **Required.** `ANY` to match if at least one entry satisfies the predicate, or `NONE` to match only if no entry does. \* `predicate`: **Required.** The expression each entry is tested against, usually a `GROUP` node. Inside the predicate, address the fields of an entry through the bound `variable`. The following node matches a quote that has at least one item discounted by more than 20: `json { "type": "COLLECTION", "field": "items", "variable": "item", "mode": "ANY", "predicate": { "type": "GROUP", "operation": "AND", "children": [ { "type": "CONDITION", "field": "item.discount", "operator": "GREATER_THAN", "value": 20 } ] } } ` ### Operators The following operators are available. The field type is the type the operator can compare, and the value column shows whether the condition takes `value` or `values`. \| Operator \| Field type \| Value \| \|------------------------------------------------------------------------------\|-------------------------\|-------------------------------------------------------------------------------------\| \| `EQUALS`, `NOT_EQUALS` \| String, number, boolean \| `value` \| \| `GREATER_THAN`, `GREATER_THAN_OR_EQUALS`, `LESS_THAN`, `LESS_THAN_OR_EQUALS` \| Number \| `value` \| \| `BETWEEN` \| Number \| `values`, holding exactly two entries, read as the inclusive lower and upper bounds \| \| `CONTAINS`, `NOT_CONTAINS` \| String \| `value` \| \| `STARTS_WITH` \| String \| `value` \| \| `ANY_OF`, `NONE_OF` \| String, number, boolean \| `values`, holding at least one entry \| An operator used on a field of another type isn't rejected when the rule is saved, so the mismatch surfaces only when the rule is evaluated. Context ------- The `context` you pass to [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules) isn't a free-form object. Its `type` selects the schema that the rest of the context is read as, and `CPQ` is the only type available, so a condition can reference only the fields of that schema. A key that falls outside the schema is dropped as the context is read, so a condition on it never evaluates to `true`. A misspelled or unsupported key therefore surfaces as an unmet condition rather than as an error. A `CPQ` context carries `items`, `quote`, `customer`, `user`, `site`, and `quote_subscription`, each of them optional. Pass only the parts the rules you're evaluating need: `json { "type": "CPQ", "customer": { "language": "en", "billing_address_country": "US" }, "quote": { "shipping_address_country": "IN", "payment_terms": 30, "custom_fields": { "region": "apac" } }, "items": [ { "reference_id": "item-1", "amount": 5000, "quantity": 2, "discount": 10 }, { "reference_id": "item-2", "amount": 1200, "quantity": 1, "discount": 0 } ] } ` A condition addresses a field by its path through the context, so `customer.language` reads the `language` of the `customer`. A `COLLECTION` node on `items` iterates over the entries of that array. Each `custom_fields` object holds your own fields keyed by name, and every value must be a string, a number, or a boolean. A condition reads one through its key, as in `quote.custom_fields.region`. The response returns the context back with `rule_ids` filled in on the quote and on each item, so you can see which rules applied where. ### quote \* `type` and `contract_type`: strings. \* `contract_duration` and `payment_terms`: numbers. \* `billing_address_country` and `shipping_address_country`: strings. \* `billing_frequency` and `billing_currency`: strings. \* `creator_email` and `creator_role`: strings. \* `custom_fields`: object. \* `rule_ids`: array of strings. Returned in the response rather than passed, recording the rules that applied to the quote. ### customer \* `billing_address_city`, `billing_address_state`, and `billing_address_country`: strings. \* `language`: string. \* `payment_terms`: number. \* `custom_fields`: object. ### items An array, with each entry holding the following. \* `reference_id`: string, identifying the entry within the context. \* `type`, `item_name`, and `product_family_name`: strings. \* `billing_frequency` and `currency`: strings. \* `billing_cycle`, `amount`, `quantity`, and `discount`: numbers. \* `start_date` and `end_date`: timestamps. \* `rule_ids`: array of strings. Returned in the response rather than passed, recording the rules that applied to that entry. ### user \* `name`, `email`, and `phone`: strings. ### site \* `name`, `domain`, and `currency`: strings. \* `sandbox`: boolean. ### quote\_subscription \* `custom_fields`: object. Actions ------- Every entry in `actions_on_success` is built from an **action template** , a built-in definition that fixes the kind of change an action makes and the parameters it accepts. An action names its template in `action_template_id` and passes that template's parameters in `input`: `json [ { "action_template_id": "action-apply-discount", "input": { "apply_on": "INVOICE_AMOUNT", "discount": 12.0, "discount_type": "PERCENTAGE", "duration_type": "ONE_TIME" } } ] ` The `type` of an action is derived from its template, so it's returned with the action but you don't have to pass it. A parameter that the template doesn't define is rejected. The values of enumerated parameters are matched without regard to case, and are returned in the `input` of the action exactly as you passed them. An action can also carry a `structured_expression` of its own, written in the same format as the expression of the rule. The rule decides whether the action runs at all, and the action's own expression then narrows it to the items of the context that satisfy that expression. One rule can therefore discount some of the items it matched rather than all of them. Only the apply discount, limit discount, and limit quantity templates accept an action-level expression. ### Apply discount Applies a discount to the invoice amount or to specific item prices. Built from `action_template_id` `action-apply-discount` and returned with `type` `APPLY_DISCOUNT`. \* `apply_on`: **Required.** `INVOICE_AMOUNT` to discount the invoice total, or `SPECIFIC_ITEM_PRICE` to discount the item prices the action applies to. \* `discount`: **Required.** The discount to apply, such as `12.0`. \* `discount_type`: **Required.** `PERCENTAGE`, `FLAT_FEE`, or `OFFER_QUANTITY`, which fixes how `discount` is read. \* `duration_type`: **Required.** How long the discount applies, as `ONE_TIME`, `FOREVER`, or `LIMITED_PERIOD`. \* `period_unit`: `DAY`, `WEEK`, `MONTH`, or `YEAR`. Required if `duration_type` is `LIMITED_PERIOD`. \* `period`: The number of `period_unit`s the discount applies for. Required if `period_unit` is passed. ### Apply coupon Applies existing [coupons](https://docs.corsair.dev/docs/api/coupons). Built from `action_template_id` `action-apply-coupon` and returned with `type` `APPLY_COUPON`. \* `apply_on`: **Required.** `INVOICE_AMOUNT` or `SPECIFIC_ITEM_PRICE`. \* `coupon_ids`: **Required.** The coupons to apply, as an array of coupon identifiers. It must hold at least one identifier. ### Limit discount Caps the discount that can be given. Use this template to enforce a discount ceiling without an approval step. Built from `action_template_id` `action-limit-discount` and returned with `type` `LIMIT_DISCOUNT`. \* `apply_on`: **Required.** `INVOICE_AMOUNT` or `SPECIFIC_ITEM_PRICE`. \* `maximum_discount`: **Required.** The largest discount allowed, such as `20.0`. \* `discount_type`: **Required.** `PERCENTAGE`, `FLAT_FEE`, or `OFFER_QUANTITY`, which fixes how `maximum_discount` is read. \* `disable_price_override`: Pass `true` to disallow overriding the price outright. ### Limit quantity Constrains the quantities that can be selected. Built from `action_template_id` `action-limit-quantity` and returned with `type` `LIMIT_QUANTITY`. Every parameter is optional, so pass the ones you want to enforce. \* `minimum_quantity`: The smallest quantity allowed. \* `maximum_quantity`: The largest quantity allowed. \* `quantity_step_count`: The increment the quantity can be changed in, so `5` allows 5, 10, 15, and so on. ### Error Returns an error message instead of a change. Use this template to block an operation when the rule matches. Built from `action_template_id` `action-error` and returned with `type` `ERROR`. \* `error_message`: **Required.** The message returned with the action. Evaluation results ------------------ [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules) returns an `apply_rule` object that echoes back the `context` you passed and carries one entry in `rules` for each rule it evaluated: `json { "apply_rule": { "context": { "type": "CPQ", "customer": { "language": "en" }, "quote": { "shipping_address_country": "IN" } }, "rules": [ { "id": "quote-discount-en", "version": 1, "name": "Apply 12 percent discount at invoice level", "evaluation_result": true, "actions": [ { "action_template_id": "action-apply-discount", "type": "APPLY_DISCOUNT", "input": { "apply_on": "INVOICE_AMOUNT", "discount": 12.0, "discount_type": "PERCENTAGE", "duration_type": "ONE_TIME" } } ], "object": "applied_rule" }, { "id": "quote-discount-uk", "version": 1, "name": "Apply 5 percent discount at invoice level for UK quotes", "evaluation_result": false, "object": "applied_rule" } ], "object": "apply_rule" } } ` Read the result of each rule from `evaluation_result`, and read what the rule produced from `actions`. Two things about the shape are worth knowing before you write code against it. \* `actions` is absent, rather than empty, for a rule whose `evaluation_result` is `false`. The second entry above shows a rule that didn't match. \* An entry for an ad hoc `structured_expression` carries only `evaluation_result`, because there's no stored rule to report an `id`, `name`, or `actions` for. A rule that couldn't be evaluated is returned with `error_message` set instead, but only if you passed `skip_failed_rules` as `true`. Otherwise the request fails. For the full list of fields, see the response of [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules). |

> [accordion] business\_rule full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   latest_version?: number | null,
>   active?: boolean | null,
>   released_at?: number | null,
>   released_by?: string | null,
>   updated_at?: number | null,
>   updated_by?: string | null,
>   created_by?: string | null,
>   created_at?: number | null,
>   tags?: any[] | null,
>   structured_expression?: {
>   } | null,
>   actions_on_success?: any[] | null,
>   resource_version?: number | null
> } | null
> ```

***

## Business Rulesets

### activate

`businessRulesets.activate`

Activate a business ruleset. Activates a business ruleset by setting its active attribute to true, so that Chargebee evaluates the rules it contains. ### Impacts Business ruleset The ruleset active attribute is set to true.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.businessRulesets.activate({ businessRulesetId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `businessRulesetId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `business_ruleset` | `object \| null` | No | A business ruleset groups [business rules](https://docs.corsair.dev/docs/api/business_rules) so that they can be evaluated together, in the priority order you assign, using the strategy set in `execute_mode`. Rulesets let you apply a whole decision at once instead of calling each rule separately. Passing a `ruleset_id` to [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules) evaluates the rules the ruleset contains in their priority order and returns a result for each one. The `execute_mode` decides whether evaluation runs through every rule or stops as soon as a rule evaluates to `true` or to `false`, and which of the results are returned. Membership is managed separately from the rules themselves. [Add business rules to a ruleset](https://docs.corsair.dev/docs/api/business_rulesets/add-business-rules-to-a-ruleset) and [Remove business rules from a ruleset](https://docs.corsair.dev/docs/api/business_rulesets/remove-business-rules-from-a-ruleset) change membership incrementally, while passing `rules` to [Update a business ruleset](https://docs.corsair.dev/docs/api/business_rulesets/update-a-business-ruleset) replaces it entirely. A rule can belong to more than one ruleset, and removing it from a ruleset does not delete the rule. The `active` attribute controls whether Chargebee evaluates the ruleset. A rule is evaluated through a ruleset only when both the ruleset and the rule are `active`. |

> [accordion] business\_ruleset full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   active?: boolean | null,
>   execute_mode?: string | null,
>   updated_at?: number | null,
>   updated_by?: string | null,
>   created_by?: string | null,
>   created_at?: number | null,
>   rules?: any[] | null,
>   resource_version?: number | null
> } | null
> ```

***

### addRules

`businessRulesets.addRules`

Add business rules to a ruleset. Adds one or more business rules to a ruleset without changing any of its other attributes. The rules are appended to the end of the ruleset's evaluation order, so you cannot choose their priorities here. Use this operation to extend a ruleset that is already in use.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.businessRulesets.addRules({ businessRulesetId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `businessRulesetId` | `string` | Yes | — |
| `rules` | `any[]` | No | The [business rules](https://docs.corsair.dev/docs/api/business_rules) to add to the ruleset. Each entry takes the `rule_id` of an existing business rule. Pass the list as a JSON array. To place a new rule earlier in the evaluation order, set the priorities explicitly with [Update a business ruleset](https://docs.corsair.dev/docs/api/business_rulesets/update-a-business-ruleset) instead. **Impacts** \* Each rule is appended to the end of the ruleset's evaluation order, taking a priority above the highest already in use, in the order the entries appear in the array. \* Rules already in the ruleset keep their priorities. **Constraints** \* Each `rule_id` must belong to a business rule that already exists. \* A rule that is already in the ruleset cannot be added again. **Example →** `rules = [{"rule_id":"custom-uuid-3"},{"rule_id":"custom-uuid-4"}]` |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `business_ruleset` | `object \| null` | No | A business ruleset groups [business rules](https://docs.corsair.dev/docs/api/business_rules) so that they can be evaluated together, in the priority order you assign, using the strategy set in `execute_mode`. Rulesets let you apply a whole decision at once instead of calling each rule separately. Passing a `ruleset_id` to [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules) evaluates the rules the ruleset contains in their priority order and returns a result for each one. The `execute_mode` decides whether evaluation runs through every rule or stops as soon as a rule evaluates to `true` or to `false`, and which of the results are returned. Membership is managed separately from the rules themselves. [Add business rules to a ruleset](https://docs.corsair.dev/docs/api/business_rulesets/add-business-rules-to-a-ruleset) and [Remove business rules from a ruleset](https://docs.corsair.dev/docs/api/business_rulesets/remove-business-rules-from-a-ruleset) change membership incrementally, while passing `rules` to [Update a business ruleset](https://docs.corsair.dev/docs/api/business_rulesets/update-a-business-ruleset) replaces it entirely. A rule can belong to more than one ruleset, and removing it from a ruleset does not delete the rule. The `active` attribute controls whether Chargebee evaluates the ruleset. A rule is evaluated through a ruleset only when both the ruleset and the rule are `active`. |

> [accordion] business\_ruleset full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   active?: boolean | null,
>   execute_mode?: string | null,
>   updated_at?: number | null,
>   updated_by?: string | null,
>   created_by?: string | null,
>   created_at?: number | null,
>   rules?: any[] | null,
>   resource_version?: number | null
> } | null
> ```

***

### create

`businessRulesets.create`

Create a business ruleset. Creates a business ruleset. A ruleset groups business rules so that they can be evaluated together, in the priority order you assign, using the strategy set in execute\_mode.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.businessRulesets.create({ name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `id` | `string` | No | Unique identifier for the business ruleset. If not provided, Chargebee generates one. |
| `name` | `string` | Yes | Display name of the business ruleset. |
| `description` | `string` | No | Description of what the business ruleset does. |
| `execute_mode` | `stop_on_first_true \| stop_on_first_false \| execute_all \| execute_all_true` | No | Strategy that determines how the rules in the ruleset are evaluated and when evaluation stops. **Default value** \* `execute_all`. \* execute\_all - Every rule in the ruleset is evaluated and all the results are returned. This is the default. \* stop\_on\_first\_true - Evaluation stops as soon as a rule evaluates to `true`. The rules that come later in the evaluation order are not evaluated. \* execute\_all\_true - Every rule in the ruleset is evaluated, and only the rules that evaluated to `true` are returned. \* stop\_on\_first\_false - Evaluation stops as soon as a rule evaluates to `false`. The rules that come later in the evaluation order are not evaluated. |
| `rules` | `any[]` | No | The [business rules](https://docs.corsair.dev/docs/api/business_rules) that make up the ruleset, along with the priorities that determine their positions in its evaluation order. Each entry takes the `rule_id` of an existing business rule and an optional `priority`; when `priority` is omitted, it is assigned from the position of the entry in the array. Pass the list as a JSON array. **Constraints** \* Each `rule_id` must belong to a business rule that already exists. \* A `priority` can be used by only one rule in the ruleset. Two entries that carry the same `priority` are rejected. **Example →** `rules = [{"rule_id":"custom-uuid-1","priority":1},{"rule_id":"custom-uuid-2","priority":2}]` |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `business_ruleset` | `object \| null` | No | A business ruleset groups [business rules](https://docs.corsair.dev/docs/api/business_rules) so that they can be evaluated together, in the priority order you assign, using the strategy set in `execute_mode`. Rulesets let you apply a whole decision at once instead of calling each rule separately. Passing a `ruleset_id` to [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules) evaluates the rules the ruleset contains in their priority order and returns a result for each one. The `execute_mode` decides whether evaluation runs through every rule or stops as soon as a rule evaluates to `true` or to `false`, and which of the results are returned. Membership is managed separately from the rules themselves. [Add business rules to a ruleset](https://docs.corsair.dev/docs/api/business_rulesets/add-business-rules-to-a-ruleset) and [Remove business rules from a ruleset](https://docs.corsair.dev/docs/api/business_rulesets/remove-business-rules-from-a-ruleset) change membership incrementally, while passing `rules` to [Update a business ruleset](https://docs.corsair.dev/docs/api/business_rulesets/update-a-business-ruleset) replaces it entirely. A rule can belong to more than one ruleset, and removing it from a ruleset does not delete the rule. The `active` attribute controls whether Chargebee evaluates the ruleset. A rule is evaluated through a ruleset only when both the ruleset and the rule are `active`. |

> [accordion] business\_ruleset full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   active?: boolean | null,
>   execute_mode?: string | null,
>   updated_at?: number | null,
>   updated_by?: string | null,
>   created_by?: string | null,
>   created_at?: number | null,
>   rules?: any[] | null,
>   resource_version?: number | null
> } | null
> ```

***

### deactivate

`businessRulesets.deactivate`

Deactivate a business ruleset. Deactivates a business ruleset by setting its active attribute to false. The ruleset and its rule memberships are retained, but Chargebee stops evaluating it. Use this operation to switch off a whole group of rules in one call, without changing the rules themselves.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.businessRulesets.deactivate({ businessRulesetId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `businessRulesetId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `business_ruleset` | `object \| null` | No | A business ruleset groups [business rules](https://docs.corsair.dev/docs/api/business_rules) so that they can be evaluated together, in the priority order you assign, using the strategy set in `execute_mode`. Rulesets let you apply a whole decision at once instead of calling each rule separately. Passing a `ruleset_id` to [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules) evaluates the rules the ruleset contains in their priority order and returns a result for each one. The `execute_mode` decides whether evaluation runs through every rule or stops as soon as a rule evaluates to `true` or to `false`, and which of the results are returned. Membership is managed separately from the rules themselves. [Add business rules to a ruleset](https://docs.corsair.dev/docs/api/business_rulesets/add-business-rules-to-a-ruleset) and [Remove business rules from a ruleset](https://docs.corsair.dev/docs/api/business_rulesets/remove-business-rules-from-a-ruleset) change membership incrementally, while passing `rules` to [Update a business ruleset](https://docs.corsair.dev/docs/api/business_rulesets/update-a-business-ruleset) replaces it entirely. A rule can belong to more than one ruleset, and removing it from a ruleset does not delete the rule. The `active` attribute controls whether Chargebee evaluates the ruleset. A rule is evaluated through a ruleset only when both the ruleset and the rule are `active`. |

> [accordion] business\_ruleset full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   active?: boolean | null,
>   execute_mode?: string | null,
>   updated_at?: number | null,
>   updated_by?: string | null,
>   created_by?: string | null,
>   created_at?: number | null,
>   rules?: any[] | null,
>   resource_version?: number | null
> } | null
> ```

***

### delete

`businessRulesets.delete`

Delete a business ruleset. Permanently deletes a business ruleset. ### Prerequisites & Constraints \* The business ruleset must not contain any business rules. If it does, remove the business rules from the ruleset before deleting it. ### Impacts Business ruleset Chargebee permanently deletes the business ruleset.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.businessRulesets.delete({ businessRulesetId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `businessRulesetId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `business_ruleset` | `object \| null` | No | A business ruleset groups [business rules](https://docs.corsair.dev/docs/api/business_rules) so that they can be evaluated together, in the priority order you assign, using the strategy set in `execute_mode`. Rulesets let you apply a whole decision at once instead of calling each rule separately. Passing a `ruleset_id` to [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules) evaluates the rules the ruleset contains in their priority order and returns a result for each one. The `execute_mode` decides whether evaluation runs through every rule or stops as soon as a rule evaluates to `true` or to `false`, and which of the results are returned. Membership is managed separately from the rules themselves. [Add business rules to a ruleset](https://docs.corsair.dev/docs/api/business_rulesets/add-business-rules-to-a-ruleset) and [Remove business rules from a ruleset](https://docs.corsair.dev/docs/api/business_rulesets/remove-business-rules-from-a-ruleset) change membership incrementally, while passing `rules` to [Update a business ruleset](https://docs.corsair.dev/docs/api/business_rulesets/update-a-business-ruleset) replaces it entirely. A rule can belong to more than one ruleset, and removing it from a ruleset does not delete the rule. The `active` attribute controls whether Chargebee evaluates the ruleset. A rule is evaluated through a ruleset only when both the ruleset and the rule are `active`. |

> [accordion] business\_ruleset full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   active?: boolean | null,
>   execute_mode?: string | null,
>   updated_at?: number | null,
>   updated_by?: string | null,
>   created_by?: string | null,
>   created_at?: number | null,
>   rules?: any[] | null,
>   resource_version?: number | null
> } | null
> ```

***

### get

`businessRulesets.get`

Retrieve a business ruleset. Retrieves the business ruleset with the specified id. To fetch the rules it contains, use List rules in a business ruleset.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.businessRulesets.get({ businessRulesetId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `businessRulesetId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `business_ruleset` | `object \| null` | No | A business ruleset groups [business rules](https://docs.corsair.dev/docs/api/business_rules) so that they can be evaluated together, in the priority order you assign, using the strategy set in `execute_mode`. Rulesets let you apply a whole decision at once instead of calling each rule separately. Passing a `ruleset_id` to [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules) evaluates the rules the ruleset contains in their priority order and returns a result for each one. The `execute_mode` decides whether evaluation runs through every rule or stops as soon as a rule evaluates to `true` or to `false`, and which of the results are returned. Membership is managed separately from the rules themselves. [Add business rules to a ruleset](https://docs.corsair.dev/docs/api/business_rulesets/add-business-rules-to-a-ruleset) and [Remove business rules from a ruleset](https://docs.corsair.dev/docs/api/business_rulesets/remove-business-rules-from-a-ruleset) change membership incrementally, while passing `rules` to [Update a business ruleset](https://docs.corsair.dev/docs/api/business_rulesets/update-a-business-ruleset) replaces it entirely. A rule can belong to more than one ruleset, and removing it from a ruleset does not delete the rule. The `active` attribute controls whether Chargebee evaluates the ruleset. A rule is evaluated through a ruleset only when both the ruleset and the rule are `active`. |

> [accordion] business\_ruleset full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   active?: boolean | null,
>   execute_mode?: string | null,
>   updated_at?: number | null,
>   updated_by?: string | null,
>   created_by?: string | null,
>   created_at?: number | null,
>   rules?: any[] | null,
>   resource_version?: number | null
> } | null
> ```

***

### list

`businessRulesets.list`

List business rulesets. Returns a list of business rulesets satisfying all the conditions specified in the filter parameters. The response describes each ruleset but does not carry its membership; use List rules in a business ruleset to page through the rules of a particular ruleset.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.businessRulesets.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `active` | `object` | No | optional, boolean filter Filters the results by the active status of the business ruleset. Pass `true` to return only the rulesets Chargebee currently evaluates, and `false` to return only the rulesets that are switched off. When omitted, rulesets are returned irrespective of their active status. **Supported operators :** is **Example →** *active\\\[is\\] = "true"* |

> [accordion] active full type
>
> ```ts theme={null}
> {
>   is?: true | false
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   business_ruleset?: {
>     id?: string | null,
>     name?: string | null,
>     description?: string | null,
>     active?: boolean | null,
>     execute_mode?: string | null,
>     updated_at?: number | null,
>     updated_by?: string | null,
>     created_by?: string | null,
>     created_at?: number | null,
>     rules?: any[] | null,
>     resource_version?: number | null
>   } | null
> }[] | null
> ```

***

### listRules

`businessRulesets.listRules`

List rules in a business ruleset. Returns the business rules that belong to a ruleset, along with the priority that determines their evaluation order. The results can be filtered by active status and are paginated. Each entry carries the rule\_id of the rule and its priority within this ruleset.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.businessRulesets.listRules({ businessRulesetId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `active` | `object` | No | optional, boolean filter Filters the results by the active status of the business rules in the ruleset. Pass `true` to return only the rules that are evaluated when the ruleset is applied, and `false` to return only the rules that are switched off. When omitted, rules are returned irrespective of their active status. **Supported operators :** is **Example →** *active\\\[is\\] = "true"* |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `businessRulesetId` | `string` | Yes | — |

> [accordion] active full type
>
> ```ts theme={null}
> {
>   is?: true | false
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `business_ruleset_rule` | `object \| null` | No | — |

> [accordion] business\_ruleset\_rule full type
>
> ```ts theme={null}
> {
>   rule_id?: string | null,
>   priority?: number | null
> } | null
> ```

***

### removeRules

`businessRulesets.removeRules`

Remove business rules from a ruleset. Removes one or more business rules from a ruleset without changing any of its other attributes. The rules themselves are not deleted and remain available to other rulesets.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.businessRulesets.removeRules({ businessRulesetId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `businessRulesetId` | `string` | Yes | — |
| `rules` | `any[]` | No | The business rules to remove from the ruleset. Each entry takes the `rule_id` of a rule that currently belongs to the ruleset. Pass the list as a JSON array. **Example →** `rules = [{"rule_id":"custom-uuid-3"}]` |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `business_ruleset` | `object \| null` | No | A business ruleset groups [business rules](https://docs.corsair.dev/docs/api/business_rules) so that they can be evaluated together, in the priority order you assign, using the strategy set in `execute_mode`. Rulesets let you apply a whole decision at once instead of calling each rule separately. Passing a `ruleset_id` to [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules) evaluates the rules the ruleset contains in their priority order and returns a result for each one. The `execute_mode` decides whether evaluation runs through every rule or stops as soon as a rule evaluates to `true` or to `false`, and which of the results are returned. Membership is managed separately from the rules themselves. [Add business rules to a ruleset](https://docs.corsair.dev/docs/api/business_rulesets/add-business-rules-to-a-ruleset) and [Remove business rules from a ruleset](https://docs.corsair.dev/docs/api/business_rulesets/remove-business-rules-from-a-ruleset) change membership incrementally, while passing `rules` to [Update a business ruleset](https://docs.corsair.dev/docs/api/business_rulesets/update-a-business-ruleset) replaces it entirely. A rule can belong to more than one ruleset, and removing it from a ruleset does not delete the rule. The `active` attribute controls whether Chargebee evaluates the ruleset. A rule is evaluated through a ruleset only when both the ruleset and the rule are `active`. |

> [accordion] business\_ruleset full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   active?: boolean | null,
>   execute_mode?: string | null,
>   updated_at?: number | null,
>   updated_by?: string | null,
>   created_by?: string | null,
>   created_at?: number | null,
>   rules?: any[] | null,
>   resource_version?: number | null
> } | null
> ```

***

### update

`businessRulesets.update`

Update a business ruleset. Updates a business ruleset. Passing rules replaces the entire membership of the ruleset. To change membership incrementally, use Add business rules to a ruleset or Remove business rules from a ruleset instead.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.businessRulesets.update({ businessRulesetId: 'example', name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `businessRulesetId` | `string` | Yes | — |
| `name` | `string` | Yes | Display name of the business ruleset. Include it even when you are only changing another attribute, such as `execute_mode`. |
| `description` | `string` | No | Description of what the business ruleset does. |
| `execute_mode` | `stop_on_first_true \| stop_on_first_false \| execute_all \| execute_all_true` | No | Strategy that determines how the rules in the ruleset are evaluated and when evaluation stops. \* execute\_all - Every rule in the ruleset is evaluated and all the results are returned. This is the default. \* stop\_on\_first\_true - Evaluation stops as soon as a rule evaluates to `true`. The rules that come later in the evaluation order are not evaluated. \* execute\_all\_true - Every rule in the ruleset is evaluated, and only the rules that evaluated to `true` are returned. \* stop\_on\_first\_false - Evaluation stops as soon as a rule evaluates to `false`. The rules that come later in the evaluation order are not evaluated. |
| `rules` | `any[]` | No | The [business rules](https://docs.corsair.dev/docs/api/business_rules) that make up the ruleset, along with the priorities that determine their positions in its evaluation order. Each entry takes the `rule_id` of an existing business rule and an optional `priority`; when `priority` is omitted, it is assigned from the position of the entry in the array. Pass the list as a JSON array. **Constraints** \* Passing this parameter replaces the entire membership of the ruleset. To change the membership incrementally, use [Add business rules to a ruleset](https://docs.corsair.dev/docs/api/business_rulesets/add-business-rules-to-a-ruleset) or [Remove business rules from a ruleset](https://docs.corsair.dev/docs/api/business_rulesets/remove-business-rules-from-a-ruleset) instead. \* Each `rule_id` must belong to a business rule that already exists, and can appear only once in the list. \* A `priority` can be used by only one rule in the ruleset. Two entries that carry the same `priority` are rejected. **Example →** `rules = [{"rule_id":"custom-uuid-1","priority":1},{"rule_id":"custom-uuid-2","priority":2}]` |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `business_ruleset` | `object \| null` | No | A business ruleset groups [business rules](https://docs.corsair.dev/docs/api/business_rules) so that they can be evaluated together, in the priority order you assign, using the strategy set in `execute_mode`. Rulesets let you apply a whole decision at once instead of calling each rule separately. Passing a `ruleset_id` to [Apply business rules](https://docs.corsair.dev/docs/api/business_rules/apply-business-rules) evaluates the rules the ruleset contains in their priority order and returns a result for each one. The `execute_mode` decides whether evaluation runs through every rule or stops as soon as a rule evaluates to `true` or to `false`, and which of the results are returned. Membership is managed separately from the rules themselves. [Add business rules to a ruleset](https://docs.corsair.dev/docs/api/business_rulesets/add-business-rules-to-a-ruleset) and [Remove business rules from a ruleset](https://docs.corsair.dev/docs/api/business_rulesets/remove-business-rules-from-a-ruleset) change membership incrementally, while passing `rules` to [Update a business ruleset](https://docs.corsair.dev/docs/api/business_rulesets/update-a-business-ruleset) replaces it entirely. A rule can belong to more than one ruleset, and removing it from a ruleset does not delete the rule. The `active` attribute controls whether Chargebee evaluates the ruleset. A rule is evaluated through a ruleset only when both the ruleset and the rule are `active`. |

> [accordion] business\_ruleset full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   active?: boolean | null,
>   execute_mode?: string | null,
>   updated_at?: number | null,
>   updated_by?: string | null,
>   created_by?: string | null,
>   created_at?: number | null,
>   rules?: any[] | null,
>   resource_version?: number | null
> } | null
> ```

***

## Cards

### get

`cards.get`

Retrieve card for a customer. #### Deprecated This operation is obsoleted by the Retrieve a payment source API . Retrieves the credit card for the customer id.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.cards.get({ customerId: 'cust_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customerId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |

> [accordion] card full type
>
> ```ts theme={null}
> {
>   payment_source_id?: string | null,
>   status?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   ref_tx_id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   iin?: string | null,
>   last4?: string | null,
>   card_type?: string | null,
>   funding_type?: string | null,
>   expiry_month?: number | null,
>   expiry_year?: number | null,
>   issuing_country?: string | null,
>   billing_addr1?: string | null,
>   billing_addr2?: string | null,
>   billing_city?: string | null,
>   billing_state_code?: string | null,
>   billing_state?: string | null,
>   billing_country?: string | null,
>   billing_zip?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   ip_address?: string | null,
>   powered_by?: string | null,
>   customer_id?: string | null,
>   masked_number?: string | null
> } | null
> ```

***

## Collections Payment Promises

### cancel

`collectionsPaymentPromises.cancel`

Cancel a collections payment promise. Cancels an active collections payment promise. Cancelling does not resume the invoice's reminder sequence. A promise can also end automatically. When the invoice is paid, the promise becomes fulfilled or broken. When the invoice is voided, written off, or deleted, the promise becomes cancelled.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.collectionsPaymentPromises.cancel({ collectionsPaymentPromiseId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `collectionsPaymentPromiseId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `collections_payment_promise` | `object \| null` | No | A collections payment promise represents a customer's commitment to pay a specific invoice by a promised date. A promise is `active` until it ends: \* `fulfilled`: the invoice is paid on or before `promised_on`. \* `broken`: the invoice is paid after `promised_on`, or is still unpaid when `promised_on` passes. \* `cancelled`: you cancel the promise, or the invoice is voided, written off, or deleted. Receivables must be enabled for the site. If it is not, these operations are rejected. |

> [accordion] collections\_payment\_promise full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   invoice_id?: string | null,
>   status?: string | null,
>   reason?: string | null,
>   promised_by?: string | null,
>   promised_on?: number | null,
>   created_at?: number | null,
>   updated_at?: number | null,
>   resource_version?: number | null
> } | null
> ```

***

### create

`collectionsPaymentPromises.create`

Create a collections payment promise. Creates a collections payment promise that records a customer's commitment to pay by promised\_on. The response is a list with one promise for each covered invoice. To cover one invoice, pass invoice\_id and an amount equal to that invoice's amount due.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.collectionsPaymentPromises.create({ amount: 1, customer_id: 'example', promised_on: 1 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customer_id` | `string` | Yes | Customer making the promise. This field is required. |
| `invoice_id` | `string` | No | Invoice to cover. Leave out to cover the customer's open invoices, oldest due date first. |
| `amount` | `number` | Yes | Amount the customer promises to pay, in the currency's smallest unit (for example, cents). With `invoice_id`, it must equal that invoice's amount due. Without `invoice_id`, it must equal the combined amount due of whole open invoices, taken oldest due date first. Any other amount is rejected. |
| `currency_code` | `string` | No | ISO 4217 currency code. Without `invoice_id`, only open invoices in this currency are covered, and `currency_code` is required when the customer's open invoices are in more than one currency. Ignored when `invoice_id` is passed. |
| `promised_on` | `number` | Yes | Timestamp in UTC seconds for the date on which the customer promised payment. This field is required. |
| `reason` | `string` | No | Optional context about why or how this promise was recorded. |
| `promised_by` | `string` | No | Name or identifier of the user or agent who captured this promise. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `collections_payment_promises` | `object[] \| null` | No | One `collections_payment_promise` resource for each covered invoice. |

> [accordion] collections\_payment\_promises full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   invoice_id?: string | null,
>   status?: string | null,
>   reason?: string | null,
>   promised_by?: string | null,
>   promised_on?: number | null,
>   created_at?: number | null,
>   updated_at?: number | null,
>   resource_version?: number | null
> }[] | null
> ```

***

### get

`collectionsPaymentPromises.get`

Retrieve a payment promise. Retrieves a collections payment promise by ID.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.collectionsPaymentPromises.get({ collectionsPaymentPromiseId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `collectionsPaymentPromiseId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `collections_payment_promise` | `object \| null` | No | A collections payment promise represents a customer's commitment to pay a specific invoice by a promised date. A promise is `active` until it ends: \* `fulfilled`: the invoice is paid on or before `promised_on`. \* `broken`: the invoice is paid after `promised_on`, or is still unpaid when `promised_on` passes. \* `cancelled`: you cancel the promise, or the invoice is voided, written off, or deleted. Receivables must be enabled for the site. If it is not, these operations are rejected. |

> [accordion] collections\_payment\_promise full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   invoice_id?: string | null,
>   status?: string | null,
>   reason?: string | null,
>   promised_by?: string | null,
>   promised_on?: number | null,
>   created_at?: number | null,
>   updated_at?: number | null,
>   resource_version?: number | null
> } | null
> ```

***

### list

`collectionsPaymentPromises.list`

List collections payment promises. Lists collections payment promises. All filters are optional; without filters, promises are returned newest first.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.collectionsPaymentPromises.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `customer_id` | `object` | No | optional, string filter Filters promises by customer identifier. **Supported operators :** is **Example →** *customer\_id\\\[is\\] = "Azq8CVnhdtD7C1xD"* |
| `invoice_id` | `object` | No | optional, string filter Filters promises by invoice identifier. **Supported operators :** is **Example →** *invoice\_id\\\[is\\] = "inv\_123"* |
| `status` | `object` | No | optional, enumerated string filter Filters promises by status. Possible values are : active, fulfilled, broken, cancelled. **Supported operators :** is **Example →** *status\\\[is\\] = "active"* |

> [accordion] customer\_id full type
>
> ```ts theme={null}
> {
>   is?: string
> }
> ```

> [accordion] invoice\_id full type
>
> ```ts theme={null}
> {
>   is?: string
> }
> ```

> [accordion] status full type
>
> ```ts theme={null}
> {
>   is?: active | fulfilled | broken | cancelled
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   collections_payment_promise?: {
>     id?: string | null,
>     customer_id?: string | null,
>     invoice_id?: string | null,
>     status?: string | null,
>     reason?: string | null,
>     promised_by?: string | null,
>     promised_on?: number | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     resource_version?: number | null
>   } | null
> }[] | null
> ```

***

### update

`collectionsPaymentPromises.update`

Update a collections payment promise. Updates an active collections payment promise. You can change promised\_on, reason, or promised\_by; omitted parameters remain unchanged.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.collectionsPaymentPromises.update({ collectionsPaymentPromiseId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `collectionsPaymentPromiseId` | `string` | Yes | — |
| `promised_on` | `number` | No | Updated promised payment date as a UTC timestamp in seconds. Must be in the future. |
| `reason` | `string` | No | Optional note describing the context or reason for capturing this promise. Replaces the stored value. If you leave out `reason`, the stored value is unchanged. |
| `promised_by` | `string` | No | Name or identifier of the user or agent who captured this promise. Replaces the stored value. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `collections_payment_promise` | `object \| null` | No | A collections payment promise represents a customer's commitment to pay a specific invoice by a promised date. A promise is `active` until it ends: \* `fulfilled`: the invoice is paid on or before `promised_on`. \* `broken`: the invoice is paid after `promised_on`, or is still unpaid when `promised_on` passes. \* `cancelled`: you cancel the promise, or the invoice is voided, written off, or deleted. Receivables must be enabled for the site. If it is not, these operations are rejected. |

> [accordion] collections\_payment\_promise full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   invoice_id?: string | null,
>   status?: string | null,
>   reason?: string | null,
>   promised_by?: string | null,
>   promised_on?: number | null,
>   created_at?: number | null,
>   updated_at?: number | null,
>   resource_version?: number | null
> } | null
> ```

***

## Comments

### create

`comments.create`

Create a comment. Create a new comment for an entity. The newly added comment will be shown in the web interface as well.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.comments.create({ entity_id: 'example', entity_type: 'customer', notes: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `entity_type` | `customer \| subscription \| invoice \| quote \| credit_note \| transaction \| plan \| addon \| coupon \| order \| business_entity \| item_family \| item \| item_price \| price_variant \| task` | Yes | Type of the entity to create the comment for. \* item - Entity that represents item \* order - Entity that represents an order \* item\_price - Entity that represents item price \* customer - Entity that represents a customer \* invoice - Invoice description \* business\_entity - Entity that represents item of type business entity \* plan - Entity that represents a subscription plan \* price\_variant - Entity that represents a price variant \* coupon - Entity that represents a discount coupon \* subscription - Entity that represents a subscription of a customer \* task - Entity that represents a task \* item\_family - Entity that represents item family \* transaction - Entity that represents a transaction. \* addon - Entity that represents an addon \* credit\_note - Credit note description \* quote - Entity that represents a quote |
| `entity_id` | `string` | Yes | Unique identifier of the entity. |
| `notes` | `string` | Yes | Actual notes for the comment. |
| `added_by` | `string` | No | The user who created the comment. If created via API, this contains the name given for the API key used. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `comment` | `object \| null` | No | Comments are additional information that you can add to your resources. Comments can be added to provide context for any operation that was performed. When you make an API call on any resource, for example, Subscriptions -\\> Change term end, you can add more context to that operation by calling the comments API as a follow up call. Besides the user generated comments, Chargebee also generates "System" comments when a change for a resource happens at the backend. These comments are all read-only. |

> [accordion] comment full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   entity_type?: string | null,
>   added_by?: string | null,
>   notes?: string | null,
>   created_at?: number | null,
>   type?: string | null,
>   entity_id?: string | null,
>   business_entity_id?: string | null
> } | null
> ```

***

### delete

`comments.delete`

Delete a comment. for an entity identified by comment ID. Only the comments that are added via Admin console and API can be deleted. Chargebee generated "System" comments cannot be deleted.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.comments.delete({ commentId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `commentId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `comment` | `object \| null` | No | Comments are additional information that you can add to your resources. Comments can be added to provide context for any operation that was performed. When you make an API call on any resource, for example, Subscriptions -\\> Change term end, you can add more context to that operation by calling the comments API as a follow up call. Besides the user generated comments, Chargebee also generates "System" comments when a change for a resource happens at the backend. These comments are all read-only. |

> [accordion] comment full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   entity_type?: string | null,
>   added_by?: string | null,
>   notes?: string | null,
>   created_at?: number | null,
>   type?: string | null,
>   entity_id?: string | null,
>   business_entity_id?: string | null
> } | null
> ```

***

### get

`comments.get`

Retrieve a comment. for an entity identified by comment ID.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.comments.get({ commentId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `commentId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `comment` | `object \| null` | No | Comments are additional information that you can add to your resources. Comments can be added to provide context for any operation that was performed. When you make an API call on any resource, for example, Subscriptions -\\> Change term end, you can add more context to that operation by calling the comments API as a follow up call. Besides the user generated comments, Chargebee also generates "System" comments when a change for a resource happens at the backend. These comments are all read-only. |

> [accordion] comment full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   entity_type?: string | null,
>   added_by?: string | null,
>   notes?: string | null,
>   created_at?: number | null,
>   type?: string | null,
>   entity_id?: string | null,
>   business_entity_id?: string | null
> } | null
> ```

***

### list

`comments.list`

List comments. Retrieve the list of comments sorted by the recent ones on the top. If you want to retrieve the list of comments for an entity, for example, subscription you can filter them by passing the entity type and unique identifier for that entity, for example, subscription ID.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.comments.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `entity_type` | `customer \| subscription \| invoice \| quote \| credit_note \| transaction \| plan \| addon \| coupon \| order \| business_entity \| item_family \| item \| item_price \| price_variant \| task` | No | Type of the entity this comment generated for. \* item - Entity that represents item \* order - Entity that represents an order \* item\_price - Entity that represents item price \* customer - Entity that represents a customer \* invoice - Invoice description \* business\_entity - Entity that represents item of type business entity \* plan - Entity that represents a subscription plan \* price\_variant - Entity that represents a price variant \* coupon - Entity that represents a discount coupon \* subscription - Entity that represents a subscription of a customer \* task - Entity that represents a task \* item\_family - Entity that represents item family \* transaction - Entity that represents a transaction. \* addon - Entity that represents an addon \* credit\_note - Credit note description \* quote - Entity that represents a quote |
| `entity_id` | `string` | No | Unique identifier of the entity. |
| `created_at` | `object` | No | optional, timestamp(UTC) in seconds filter The time at which this comment was created. **Supported operators :** after, before, on, between **Example →** *created\_at\\\[on\\] = "1456332678"* |
| `sort_by` | `object` | No | optional, string filter Sorts based on the specified attribute. **Supported attributes :** created\_at **Supported sort-orders :** asc, desc **Example →** *sort\_by\\\[asc\\] = "created\_at"* This will sort the result based on the 'created\_at' attribute in ascending(earliest first) order. |

> [accordion] created\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] sort\_by full type
>
> ```ts theme={null}
> {
>   asc?: created_at,
>   desc?: created_at
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   comment?: {
>     id?: string | null,
>     entity_type?: string | null,
>     added_by?: string | null,
>     notes?: string | null,
>     created_at?: number | null,
>     type?: string | null,
>     entity_id?: string | null,
>     business_entity_id?: string | null
>   } | null
> }[] | null
> ```

***

## Configurations

### list

`configurations.list`

List site configurations. Returns a list of your domain and product catalog version details.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.configurations.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `configurations` | `object[] \| null` | No | Resource object representing configuration |

> [accordion] configurations full type
>
> ```ts theme={null}
> {
>   domain?: string | null,
>   product_catalog_version?: string | null,
>   chargebee_response_schema_type?: string | null
> }[] | null
> ```

***

## Coupon Codes

### archive

`couponCodes.archive`

Archive a coupon code. Archives a coupon code thereby making it inactive. The archived coupon code cannot be applied to any subscription.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.couponCodes.archive({ couponCodeCode: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `couponCodeCode` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `coupon_code` | `object \| null` | No | Coupon codes are used along with existing coupons in Chargebee. You can create a coupon set using a bunch of coupon codes and this coupon set will be associated with an existing coupon. A coupon code can only be applied to a single subscription and cannot be re-used. Using coupon codes you can distribute several unique codes for a single main coupon, when you are running promotions. |

> [accordion] coupon\_code full type
>
> ```ts theme={null}
> {
>   code?: string | null,
>   status?: string | null,
>   coupon_id?: string | null,
>   coupon_set_id?: string | null,
>   coupon_set_name?: string | null
> } | null
> ```

***

### get

`couponCodes.get`

Retrieve a coupon code. Retrieves a specific coupon code details.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.couponCodes.get({ couponCodeCode: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `couponCodeCode` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `coupon_code` | `object \| null` | No | Coupon codes are used along with existing coupons in Chargebee. You can create a coupon set using a bunch of coupon codes and this coupon set will be associated with an existing coupon. A coupon code can only be applied to a single subscription and cannot be re-used. Using coupon codes you can distribute several unique codes for a single main coupon, when you are running promotions. |

> [accordion] coupon\_code full type
>
> ```ts theme={null}
> {
>   code?: string | null,
>   status?: string | null,
>   coupon_id?: string | null,
>   coupon_set_id?: string | null,
>   coupon_set_name?: string | null
> } | null
> ```

***

### list

`couponCodes.list`

List coupon codes. List the available coupon codes.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.couponCodes.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `code` | `object` | No | optional, string filter Unique coupon code that can be redeemed only once. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *code\\\[is\_not\\] = "OFF2009"* |
| `coupon_id` | `object` | No | optional, string filter Id of the main coupon resource. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *coupon\_id\\\[is\\] = "OFF20"* |
| `coupon_set_name` | `object` | No | optional, string filter Coupon set name to which this coupon code would be grouped under. If the coupon set with the passed name is not present, a new coupon set will be created. **Supported operators :** is, is\_not, starts\_with **Example →** *coupon\_set\_name\\\[is\_not\\] = "OFF20"* |
| `status` | `object` | No | optional, enumerated string filter Status of the coupon code. Possible values are : not\_redeemed, redeemed, archived. **Supported operators :** is, is\_not, in, not\_in **Example →** *status\\\[is\\] = "redeemed"* |

> [accordion] code full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] coupon\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] coupon\_set\_name full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string
> }
> ```

> [accordion] status full type
>
> ```ts theme={null}
> {
>   is?: not_redeemed | redeemed | archived,
>   is_not?: not_redeemed | redeemed | archived,
>   in?: string,
>   not_in?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   coupon_code?: {
>     code?: string | null,
>     status?: string | null,
>     coupon_id?: string | null,
>     coupon_set_id?: string | null,
>     coupon_set_name?: string | null
>   } | null
> }[] | null
> ```

***

## Coupons

### copy

`coupons.copy`

Copy a coupon. Copies a coupon over from one site to another. Copying of archived coupons is not supported. The item prices that are linked to the coupon in the source site are also linked to the coupon in the destination site.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.coupons.copy({ from_site: 'example', id_at_from_site: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `from_site` | `string` | Yes | Your Chargebee site name having the coupon to be copied. **Note:** Unless you are copying from a twin site (acme \\& acme-test are twin sites), [contact 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 have this allow-listed. |
| `id_at_from_site` | `string` | Yes | Id of the coupon to be copied. The new coupon created in this site will have the same Id. |
| `id` | `string` | No | Id of copied coupon in this site. |
| `for_site_merging` | `boolean` | No | If copy action is performed as part of Chargebee site merge action, pass the value as true. **Note:** If this parameter is passed true coupon state, redemptions, coupon set and coupon codes associated with this coupon will be copied. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `coupon` | `object \| null` | No | Overview -------- Coupons are deductions applied to invoices or invoice line items. They're designed to be consumed by your customers directly. A coupon deduction can either be for a fixed amount or for a percentage of the amount of the invoice or line item. **Note:** If you wish to provide discounts to your customers via API or the Chargebee app, see [Discounts API](https://docs.corsair.dev/docs/api/discounts) Order of application of coupons and discounts --------------------------------------------- When both [coupons](https://docs.corsair.dev/docs/api/coupons) and [discounts](https://docs.corsair.dev/docs/api/discounts) are applied simultaneously to a [subscription](https://docs.corsair.dev/docs/api/subscriptions) or [one-time invoice](https://docs.corsair.dev/docs/api/invoices/create-invoice-for-items-and-one-time-charges), they're applied in the following order: \|---\|---------------------------------------\|-------------------------------------------------------------------------------------\| \| \| **Summary** \| **Description** \| \| 1 \| Line-level, fixed amount coupons \| `coupon` with `apply_on` = `each_specified_item` and `discount_type` = `flat` \| \| 2 \| Line-level, fixed amount discounts \| `discount` with `apply_on` = `specific_item_price` and `type` = `fixed_amount` \| \| 3 \| Line-level, percentage coupons \| `coupon` with `apply_on` = `each_specified_item` and `discount_type` = `percentage` \| \| 4 \| Line-level, percentage discounts \| `discount` with `apply_on` = `specific_item_price` and `type` = `percentage` \| \| 5 \| Invoice-level, fixed amount coupons \| `coupon` with `apply_on` = `invoice_amount` and `discount_type` = `flat` \| \| 6 \| Invoice-level, fixed amount discounts \| `discount` with `apply_on` = `invoice_amount` and `type` = `fixed_amount` \| \| 7 \| Invoice-level, percentage coupons \| `coupon` with `apply_on` = `invoice_amount` and `discount_type` = `percentage` \| \| 8 \| Invoice-level, percentage discounts \| `discount` with `apply_on` = `invoice_amount` and `type` = `percentage` \| For example, consider the following scenario: A subscription is created with: \* a plan price of $200 per month * an addon price of $20 per month \* a flat $5 invoice discount * a 1% off coupon on the addon * a flat $2 coupon on the invoice The above coupons and discount are applied in the following order: \|---\|---------------------------------------------\|-----------------------------------------------\| \| \| **Discount or coupon applied** \| **Subtotal at each step** \| \| 1 \| Initial subtotal (plan price + addon price) \| $200 + $20 = $220 \| \| 2 \| 1% off coupon on the addon \| $200 + $(20 - 0.02) = $200 + $19.98 = $219.98 \| \| 3 \| Flat $2 coupon on the invoice \| $219.98 - $2 = $217.98 \| \| 4 \| Flat $5 invoice discount \| $217.98 - $5 = **$212.98\*\* \| |

> [accordion] coupon full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   invoice_name?: string | null,
>   discount_type?: string | null,
>   discount_percentage?: number | null,
>   discount_amount?: number | null,
>   discount_quantity?: number | null,
>   currency_code?: string | null,
>   duration_type?: string | null,
>   valid_from?: number | null,
>   valid_till?: number | null,
>   max_redemptions?: number | null,
>   status?: string | null,
>   apply_on?: string | null,
>   created_at?: number | null,
>   archived_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   period?: number | null,
>   period_unit?: string | null,
>   redemptions?: number | null,
>   invoice_notes?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   item_constraints?: {
>     item_type?: string | null,
>     constraint?: string | null,
>     item_price_ids?: any[] | null
>   }[] | null,
>   item_constraint_criteria?: {
>     item_type?: string | null,
>     currencies?: any[] | null,
>     item_family_ids?: any[] | null,
>     item_price_periods?: any[] | null
>   }[] | null,
>   coupon_constraints?: {
>     entity_type?: string | null,
>     type?: string | null,
>     value?: string | null
>   }[] | null
> } | null
> ```

***

### create

`coupons.create`

Create a coupon. This API creates a new coupon for a specific promotion or offers. Product Catalog 1.0 sites only.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.coupons.create({ apply_on: 'invoice_amount', id: 'cust_8gsnbYfsMLds', name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `id` | `string` | Yes | Used to uniquely identify the coupon in your website/application and to integrate with Chargebee. **Note:** When the coupon ID contains a special character; for example: `#`, the API returns an error. Make sure that you [encode](https://www.urlencoder.org/) the coupon ID in the path parameter before making an API call. . |
| `name` | `string` | Yes | The display name used in web interface for identifying the coupon. **Note:** When the name of the coupon set contains a special character; for example: `#`, the API returns an error. Make sure that you [encode](https://www.urlencoder.org/) the name of the coupon set in the path parameter before making an API call. . |
| `invoice_name` | `string` | No | Display name used in invoice. If it is not configured then name is used in invoice. |
| `discount_type` | `fixed_amount \| percentage \| offer_quantity` | No | Specifies the type of discount to be applied. \* fixed\_amount - A fixed amount is deducted as a discount. The discount amount is specified in [discount\_amount](https://docs.corsair.dev/docs/api/v2/pcv-1/coupons/create-a-coupon#discount_amount). [Learn more](https://www.chargebee.com/docs/1.0/coupons.html#fixed-amount) about `fixed_amount` coupons. \* percentage - A percentage of the original price is deducted as a discount. The discount percentage is specified in [discount\_percentage](https://docs.corsair.dev/docs/api/v2/pcv-1/coupons/create-a-coupon#discount_percentage). [Learn more](https://www.chargebee.com/docs/1.0/coupons.html#percentage) about `percentage` coupons. \* offer\_quantity - A specified number of units of the plan or addon are offered for free. The number of free units is specified in [discount\_quantity](https://docs.corsair.dev/docs/api/v2/pcv-1/coupons/create-a-coupon#discount_quantity). The `offer_quantity` option is valid only when [apply\_on](https://docs.corsair.dev/docs/api/v2/pcv-1/coupons/create-a-coupon#apply_on) is set to `each_specified_item` and the `pricing_model` of the [plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object#pricing_model) or addon is `per_unit`. [Learn more](https://www.chargebee.com/docs/1.0/coupons.html#offer-quantity) about `offer_quantity` coupons. |
| `discount_amount` | `number` | No | The value of the deduction. The format of this value depends on the [kind of currency](https://docs.corsair.dev/docs/api/currencies) . |
| `currency_code` | `string` | No | The currency code ([ISO 4217 format](https://www.chargebee.com/docs/2.0/supported-currencies.html) ) of the coupon. Applicable for *fixed\_amount* coupons alone. |
| `discount_percentage` | `number` | No | The percentage of the original amount that should be deducted from it. |
| `discount_quantity` | `number` | No | Specifies the number of free units provided for the [plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans) or [addon](https://docs.corsair.dev/docs/api/v2/pcv-1/addons) , without affecting the total quantity sold. This parameter is applicable only when the [discount\_type](https://docs.corsair.dev/docs/api/v2/pcv-1/coupons/create-a-coupon#discount_type) is set to `offer_quantity` . |
| `apply_on` | `invoice_amount \| each_specified_item` | Yes | The amount on the invoice to which the coupon is applied. \* invoice\_amount - The coupon is applied to the invoice `sub_total` . \* each\_specified\_item - The coupon is applied to the `invoice.line_item.amount` that corresponds to the plan or addon specified by `plan_ids` and `addon_ids` . |
| `duration_type` | `one_time \| forever \| limited_period` | No | Specifies the time duration for which this coupon is attached to the subscription. \* forever - The coupon is attached to the subscription and applied on the invoices until explicitly removed. \* 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` . \* one\_time - The coupon stays attached to the subscription till it is applied on an invoice **once**. It is removed after that from the subscription. |
| `duration_month` | `number` | No | **(Deprecated)** The duration of time in months for which the coupon is attached to the subscription. Applicable only when `duration_type` is `limited_period`. **Note:** This parameter has been deprecated. Use `period` and `period_unit` instead. |
| `valid_till` | `number` | No | Date upto which the coupon can be applied to new subscriptions. |
| `max_redemptions` | `number` | No | Maximum number of times this coupon can be redeemed. **Note:** If not specified, the coupon can be redeemed an indefinite number of times. . |
| `invoice_notes` | `string` | No | A customer-facing note added to all invoices associated with this API resource. This note becomes one among [all the notes](https://docs.corsair.dev/docs/api/invoices/invoice-object#notes) displayed on the invoice PDF. |
| `meta_data` | `object` | No | A collection of key-value pairs that provides extra information about the coupon. **Note:** There's a character limit of 65,535. [Learn more](https://docs.corsair.dev/docs/api/v2/pcv-1/advanced-features) . |
| `included_in_mrr` | `boolean` | No | The coupon is included in MRR calculations for your site. This attribute is only applicable for coupons of `duration_type = one_time` and when the feature is enabled in Chargebee. Note: If the site-level setting is to exclude one-time coupons from MRR calculations, this value is always returned `false` . |
| `period` | `number` | No | The duration of time for which the coupon is attached to the subscription, in `period_units`. Applicable only when [duration\_type](https://docs.corsair.dev/docs/api/coupons/coupon-object#duration_type) is [limited\_period](https://docs.corsair.dev/docs/api/coupons/coupon-object#duration_type) . |
| `period_unit` | `day \| week \| month \| year` | No | The unit of time for period. Applicable only when [duration\_type](https://docs.corsair.dev/docs/api/coupons/coupon-object#duration_type) is [limited\_period](https://docs.corsair.dev/docs/api/coupons/coupon-object#duration_type) . \* year - A period of 1 calendar year. \* month - A period of 1 calendar month. \* week - A period of 7 days. \* day - A period of 24 hours. |
| `plan_constraint` | `none \| all \| specific` | No | Plans the coupon can be applied to. \* all - Coupon applicable to all plans. \* specific - Coupon only applicable to specified plans. If used, it is mandatory to specify the plan(s). \* none - Coupon not applicable to any plans. |
| `addon_constraint` | `none \| all \| specific` | No | Addons the coupon can be applied to. \* specific - Coupon only applicable to specified addons. If used, it is mandatory to specify the addon(s). \* all - Coupon applicable to all addons. \* none - Coupon not applicable to any addons. |
| `plan_ids` | `string[]` | No | Identifier of the plan. |
| `addon_ids` | `string[]` | No | Identifier of the addon. |
| `status` | `active \| archived` | No | Status of the coupon. \* active - Can be applied to a subscription. \* archived - Cannot be applied to a subscription. Existing associations remain unaffected. |

> [accordion] meta\_data full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `coupon` | `object \| null` | No | Overview -------- Coupons are deductions applied to invoices or invoice line items. They're designed to be consumed by your customers directly. A coupon deduction can either be for a fixed amount or for a percentage of the amount of the invoice or line item. Order of application of coupons ------------------------------- When multiple [coupons](https://docs.corsair.dev/docs/api/coupons) are applied to a [subscription](https://docs.corsair.dev/docs/api/subscriptions) or [one-time invoice](https://docs.corsair.dev/docs/api/v2/pcv-1/invoices/create-an-invoice), they're applied in the following order: \|---\|-------------------------------------\|-------------------------------------------------------------------------------------\| \| \| **Summary** \| **Description** \| \| 1 \| Line-level, fixed amount coupons \| `coupon` with `apply_on` = `each_specified_item` and `discount_type` = `flat` \| \| 2 \| Line-level, percentage coupons \| `coupon` with `apply_on` = `each_specified_item` and `discount_type` = `percentage` \| \| 3 \| Invoice-level, fixed amount coupons \| `coupon` with `apply_on` = `invoice_amount` and `discount_type` = `flat` \| \| 4 \| Invoice-level, percentage coupons \| `coupon` with `apply_on` = `invoice_amount` and `discount_type` = `percentage` \| For example, consider the following scenario: A subscription is created with: \* a plan price of $200 per month * an addon price of $20 per month \* a flat $5 coupon on the invoice * a 1% off coupon on the addon * a flat $10 coupon on the plan The above coupons are applied in the following order: \|---\|---------------------------------------------\|--------------------------------------------\| \| \| **Discount or coupon applied** \| **Subtotal at each step** \| \| 1 \| Initial subtotal (plan price + addon price) \| $200 + $20 = $220 \| \| 2 \| Flat $10 coupon on the plan \| $(200 - 10) + $20 = $190 + $20 = $210 \| \| 3 \| 1% off coupon on the addon \| $190 + $(20 - 0.2) = $190 + $19.8 = $209.8 \| \| 4 \| Flat $5 coupon on the invoice \| $209.8 - $5 = **$204.8\*\* \| |

> [accordion] coupon full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   invoice_name?: string | null,
>   discount_type?: string | null,
>   discount_percentage?: number | null,
>   discount_amount?: number | null,
>   discount_quantity?: number | null,
>   currency_code?: string | null,
>   duration_type?: string | null,
>   valid_till?: number | null,
>   max_redemptions?: number | null,
>   status?: string | null,
>   apply_on?: string | null,
>   plan_constraint?: string | null,
>   addon_constraint?: string | null,
>   created_at?: number | null,
>   archived_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   included_in_mrr?: boolean | null,
>   period?: number | null,
>   period_unit?: string | null,
>   plan_ids?: string[] | null,
>   addon_ids?: string[] | null,
>   redemptions?: number | null,
>   invoice_notes?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null
> } | null
> ```

***

### createForItems

`coupons.createForItems`

Create a coupon for items. This API creates a new coupon for a specific promotion or offers.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.coupons.createForItems({ apply_on: 'invoice_amount', id: 'cust_8gsnbYfsMLds', name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `id` | `string` | Yes | Used to uniquely identify the coupon in your website/application and to integrate with Chargebee. **Note:** When the coupon ID contains a special character; for example: `#`, the API returns an error. Make sure that you [encode](https://www.urlencoder.org/) the coupon ID in the path parameter before making an API call. . |
| `name` | `string` | Yes | The display name used in web interface for identifying the coupon. **Note:** When the name of the coupon set contains a special character; for example: `#`, the API returns an error. Make sure that you [encode](https://www.urlencoder.org/) the name of the coupon set in the path parameter before making an API call. . |
| `invoice_name` | `string` | No | Display name used in invoice. If it is not configured then name is used in invoice. |
| `discount_type` | `fixed_amount \| percentage \| offer_quantity` | No | Specifies the type of discount to be applied. \* percentage - A percentage of the original price is deducted as a discount. The discount percentage is specified in [discount\_percentage](https://docs.corsair.dev/docs/api/coupons/create-a-coupon-for-items#discount_percentage). [Learn more](https://www.chargebee.com/docs/2.0/coupons.html#percentage-coupons) about `percentage` coupons. \* fixed\_amount - A fixed amount is deducted as a discount. The discount amount is specified in [discount\_amount](https://docs.corsair.dev/docs/api/coupons/create-a-coupon-for-items#discount_amount). [Learn more](https://www.chargebee.com/docs/2.0/coupons.html#fixed-amount-coupons) about `fixed_amount` coupons. \* offer\_quantity - A specified number of units of the item price are offered for free. The number of free units is specified in [discount\_quantity](https://docs.corsair.dev/docs/api/coupons/create-a-coupon-for-items#discount_quantity). The `offer_quantity` option is valid only when [apply\_on](https://docs.corsair.dev/docs/api/coupons/create-a-coupon-for-items#apply_on) is set to `each_specified_item` and the [pricing\_model](https://docs.corsair.dev/docs/api/item_prices/item_price-object#pricing_model) of the item price is `per_unit`. [Learn more](https://www.chargebee.com/docs/2.0/coupons.html#offer-quantity-coupons) about `offer_quantity` coupons. |
| `discount_amount` | `number` | No | The value of the deduction. The format of this value depends on the [kind of currency](https://docs.corsair.dev/docs/api/currencies) . |
| `currency_code` | `string` | No | The currency code ([ISO 4217 format](https://www.chargebee.com/docs/2.0/supported-currencies.html) ) of the coupon. Applicable for *fixed\_amount* coupons alone. |
| `discount_percentage` | `number` | No | The percentage of the original amount that should be deducted from it. |
| `discount_quantity` | `number` | No | Specifies the number of free units provided for the [item price](https://docs.corsair.dev/docs/api/item_prices) , without affecting the total quantity sold. This parameter is applicable only when the [discount\_type](https://docs.corsair.dev/docs/api/coupons/create-a-coupon-for-items#discount_type) is set to `offer_quantity` . |
| `apply_on` | `invoice_amount \| each_specified_item` | Yes | The amount on the invoice to which the coupon is applied. \* invoice\_amount - The coupon is applied to the invoice `sub_total` . \* each\_specified\_item - Applies the coupon to specified items (plans, addons, or charges), with the discount applied to each matching `invoice.line_item.amount`. Requires applicability to be configured using [`item_constraints`](https://docs.corsair.dev/docs/api/coupons/create-a-coupon-for-items#item_constraints)---for example `all`, `criteria`, or `specific` with `item_price_ids`. When you attach this coupon to a subscription, at least one of that subscription's plans, addons, or charges must match those rules. If none do, the request fails. |
| `duration_type` | `one_time \| forever \| limited_period` | No | Specifies the time duration for which this coupon is attached to the subscription. \* forever - The coupon is attached to the subscription and applied on the invoices until explicitly removed. \* one\_time - The coupon stays attached to the subscription till it is applied on an invoice **once**. It is removed after that from the subscription. \* 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` . |
| `duration_month` | `number` | No | **(Deprecated)** The duration of time in months for which the coupon is attached to the subscription. Applicable only when `duration_type` is `limited_period`. **Note:** This parameter has been deprecated. Use `period` and `period_unit` instead. |
| `valid_from` | `number` | No | The date from which the coupon can be applied to subscriptions. |
| `valid_till` | `number` | No | Date upto which the coupon can be applied to new subscriptions. |
| `max_redemptions` | `number` | No | Maximum number of times this coupon can be redeemed. **Note:** If not specified, the coupon can be redeemed an indefinite number of times. . |
| `invoice_notes` | `string` | No | A customer-facing note added to all invoices associated with this API resource. This note becomes one among [all the notes](https://docs.corsair.dev/docs/api/invoices/invoice-object#notes) displayed on the invoice PDF. |
| `meta_data` | `object` | No | A collection of key-value pairs that provides extra information about the coupon. **Note:** There's a character limit of 65,535. [Learn more](https://docs.corsair.dev/docs/api/advanced-features) . |
| `included_in_mrr` | `boolean` | No | The coupon is included in MRR calculations for your site. This attribute is only applicable for coupons of `duration_type = one_time` and when the feature is enabled in Chargebee. Note: If the site-level setting is to exclude one-time coupons from MRR calculations, this value is always returned `false` . |
| `period` | `number` | No | The duration of time for which the coupon is attached to the subscription, in `period_units`. Applicable only when [duration\_type](https://docs.corsair.dev/docs/api/coupons/coupon-object#duration_type) is [limited\_period](https://docs.corsair.dev/docs/api/coupons/coupon-object#duration_type) . |
| `period_unit` | `day \| week \| month \| year` | No | The unit of time for period. Applicable only when [duration\_type](https://docs.corsair.dev/docs/api/coupons/coupon-object#duration_type) is [limited\_period](https://docs.corsair.dev/docs/api/coupons/coupon-object#duration_type) . \* month - A period of 1 calendar month. \* week - A period of 7 days. \* year - A period of 1 calendar year. \* day - A period of 24 hours. |
| `status` | `active \| archived` | No | Status of the coupon. \* archived - Cannot be applied to a subscription. Existing associations remain unaffected. \* active - Can be applied to a subscription. |
| `item_constraints` | `object` | No | Parameters for item\_constraints |
| `item_constraint_criteria` | `object` | No | Parameters for item\_constraint\_criteria |
| `coupon_constraints` | `object` | No | Parameters for `coupon_constraints`. Multiple `coupon_constraints` can be passed by specifying unique indices. |

> [accordion] meta\_data full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] item\_constraints full type
>
> ```ts theme={null}
> {
>   constraint: (none | all | specific | criteria)[],
>   item_type: (plan | addon | charge)[],
>   item_price_ids?: any[][]
> }
> ```

> [accordion] item\_constraint\_criteria full type
>
> ```ts theme={null}
> {
>   item_type?: (plan | addon | charge)[],
>   item_family_ids?: any[][],
>   currencies?: any[][],
>   item_price_periods?: any[][]
> }
> ```

> [accordion] coupon\_constraints full type
>
> ```ts theme={null}
> {
>   entity_type: customer[],
>   type: (max_redemptions | unique_by | existing_customer | new_customer)[],
>   value?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `coupon` | `object \| null` | No | Overview -------- Coupons are deductions applied to invoices or invoice line items. They're designed to be consumed by your customers directly. A coupon deduction can either be for a fixed amount or for a percentage of the amount of the invoice or line item. **Note:** If you wish to provide discounts to your customers via API or the Chargebee app, see [Discounts API](https://docs.corsair.dev/docs/api/discounts) Order of application of coupons and discounts --------------------------------------------- When both [coupons](https://docs.corsair.dev/docs/api/coupons) and [discounts](https://docs.corsair.dev/docs/api/discounts) are applied simultaneously to a [subscription](https://docs.corsair.dev/docs/api/subscriptions) or [one-time invoice](https://docs.corsair.dev/docs/api/invoices/create-invoice-for-items-and-one-time-charges), they're applied in the following order: \|---\|---------------------------------------\|-------------------------------------------------------------------------------------\| \| \| **Summary** \| **Description** \| \| 1 \| Line-level, fixed amount coupons \| `coupon` with `apply_on` = `each_specified_item` and `discount_type` = `flat` \| \| 2 \| Line-level, fixed amount discounts \| `discount` with `apply_on` = `specific_item_price` and `type` = `fixed_amount` \| \| 3 \| Line-level, percentage coupons \| `coupon` with `apply_on` = `each_specified_item` and `discount_type` = `percentage` \| \| 4 \| Line-level, percentage discounts \| `discount` with `apply_on` = `specific_item_price` and `type` = `percentage` \| \| 5 \| Invoice-level, fixed amount coupons \| `coupon` with `apply_on` = `invoice_amount` and `discount_type` = `flat` \| \| 6 \| Invoice-level, fixed amount discounts \| `discount` with `apply_on` = `invoice_amount` and `type` = `fixed_amount` \| \| 7 \| Invoice-level, percentage coupons \| `coupon` with `apply_on` = `invoice_amount` and `discount_type` = `percentage` \| \| 8 \| Invoice-level, percentage discounts \| `discount` with `apply_on` = `invoice_amount` and `type` = `percentage` \| For example, consider the following scenario: A subscription is created with: \* a plan price of $200 per month * an addon price of $20 per month \* a flat $5 invoice discount * a 1% off coupon on the addon * a flat $2 coupon on the invoice The above coupons and discount are applied in the following order: \|---\|---------------------------------------------\|-----------------------------------------------\| \| \| **Discount or coupon applied** \| **Subtotal at each step** \| \| 1 \| Initial subtotal (plan price + addon price) \| $200 + $20 = $220 \| \| 2 \| 1% off coupon on the addon \| $200 + $(20 - 0.02) = $200 + $19.98 = $219.98 \| \| 3 \| Flat $2 coupon on the invoice \| $219.98 - $2 = $217.98 \| \| 4 \| Flat $5 invoice discount \| $217.98 - $5 = **$212.98\*\* \| |

> [accordion] coupon full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   invoice_name?: string | null,
>   discount_type?: string | null,
>   discount_percentage?: number | null,
>   discount_amount?: number | null,
>   discount_quantity?: number | null,
>   currency_code?: string | null,
>   duration_type?: string | null,
>   valid_from?: number | null,
>   valid_till?: number | null,
>   max_redemptions?: number | null,
>   status?: string | null,
>   apply_on?: string | null,
>   created_at?: number | null,
>   archived_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   period?: number | null,
>   period_unit?: string | null,
>   redemptions?: number | null,
>   invoice_notes?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   item_constraints?: {
>     item_type?: string | null,
>     constraint?: string | null,
>     item_price_ids?: any[] | null
>   }[] | null,
>   item_constraint_criteria?: {
>     item_type?: string | null,
>     currencies?: any[] | null,
>     item_family_ids?: any[] | null,
>     item_price_periods?: any[] | null
>   }[] | null,
>   coupon_constraints?: {
>     entity_type?: string | null,
>     type?: string | null,
>     value?: string | null
>   }[] | null
> } | null
> ```

***

### delete

`coupons.delete`

Delete a coupon. If no Subscriptions/Invoices are linked to this Coupon, the Coupon will be deleted from your Chargebee site. This action cannot be undone. To ensure that existing Subscriptions/Invoices are not affected, Coupons associated with them will not be deleted, but moved to "Archived" state.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.coupons.delete({ couponId: 'WELCOME10' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `couponId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `coupon` | `object \| null` | No | Overview -------- Coupons are deductions applied to invoices or invoice line items. They're designed to be consumed by your customers directly. A coupon deduction can either be for a fixed amount or for a percentage of the amount of the invoice or line item. **Note:** If you wish to provide discounts to your customers via API or the Chargebee app, see [Discounts API](https://docs.corsair.dev/docs/api/discounts) Order of application of coupons and discounts --------------------------------------------- When both [coupons](https://docs.corsair.dev/docs/api/coupons) and [discounts](https://docs.corsair.dev/docs/api/discounts) are applied simultaneously to a [subscription](https://docs.corsair.dev/docs/api/subscriptions) or [one-time invoice](https://docs.corsair.dev/docs/api/invoices/create-invoice-for-items-and-one-time-charges), they're applied in the following order: \|---\|---------------------------------------\|-------------------------------------------------------------------------------------\| \| \| **Summary** \| **Description** \| \| 1 \| Line-level, fixed amount coupons \| `coupon` with `apply_on` = `each_specified_item` and `discount_type` = `flat` \| \| 2 \| Line-level, fixed amount discounts \| `discount` with `apply_on` = `specific_item_price` and `type` = `fixed_amount` \| \| 3 \| Line-level, percentage coupons \| `coupon` with `apply_on` = `each_specified_item` and `discount_type` = `percentage` \| \| 4 \| Line-level, percentage discounts \| `discount` with `apply_on` = `specific_item_price` and `type` = `percentage` \| \| 5 \| Invoice-level, fixed amount coupons \| `coupon` with `apply_on` = `invoice_amount` and `discount_type` = `flat` \| \| 6 \| Invoice-level, fixed amount discounts \| `discount` with `apply_on` = `invoice_amount` and `type` = `fixed_amount` \| \| 7 \| Invoice-level, percentage coupons \| `coupon` with `apply_on` = `invoice_amount` and `discount_type` = `percentage` \| \| 8 \| Invoice-level, percentage discounts \| `discount` with `apply_on` = `invoice_amount` and `type` = `percentage` \| For example, consider the following scenario: A subscription is created with: \* a plan price of $200 per month * an addon price of $20 per month \* a flat $5 invoice discount * a 1% off coupon on the addon * a flat $2 coupon on the invoice The above coupons and discount are applied in the following order: \|---\|---------------------------------------------\|-----------------------------------------------\| \| \| **Discount or coupon applied** \| **Subtotal at each step** \| \| 1 \| Initial subtotal (plan price + addon price) \| $200 + $20 = $220 \| \| 2 \| 1% off coupon on the addon \| $200 + $(20 - 0.02) = $200 + $19.98 = $219.98 \| \| 3 \| Flat $2 coupon on the invoice \| $219.98 - $2 = $217.98 \| \| 4 \| Flat $5 invoice discount \| $217.98 - $5 = **$212.98\*\* \| |

> [accordion] coupon full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   invoice_name?: string | null,
>   discount_type?: string | null,
>   discount_percentage?: number | null,
>   discount_amount?: number | null,
>   discount_quantity?: number | null,
>   currency_code?: string | null,
>   duration_type?: string | null,
>   valid_from?: number | null,
>   valid_till?: number | null,
>   max_redemptions?: number | null,
>   status?: string | null,
>   apply_on?: string | null,
>   created_at?: number | null,
>   archived_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   period?: number | null,
>   period_unit?: string | null,
>   redemptions?: number | null,
>   invoice_notes?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   item_constraints?: {
>     item_type?: string | null,
>     constraint?: string | null,
>     item_price_ids?: any[] | null
>   }[] | null,
>   item_constraint_criteria?: {
>     item_type?: string | null,
>     currencies?: any[] | null,
>     item_family_ids?: any[] | null,
>     item_price_periods?: any[] | null
>   }[] | null,
>   coupon_constraints?: {
>     entity_type?: string | null,
>     type?: string | null,
>     value?: string | null
>   }[] | null
> } | null
> ```

***

### get

`coupons.get`

Retrieve a coupon. This API retrieves a specific coupon using the coupon ID.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.coupons.get({ couponId: 'WELCOME10' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `couponId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `coupon` | `object \| null` | No | Overview -------- Coupons are deductions applied to invoices or invoice line items. They're designed to be consumed by your customers directly. A coupon deduction can either be for a fixed amount or for a percentage of the amount of the invoice or line item. **Note:** If you wish to provide discounts to your customers via API or the Chargebee app, see [Discounts API](https://docs.corsair.dev/docs/api/discounts) Order of application of coupons and discounts --------------------------------------------- When both [coupons](https://docs.corsair.dev/docs/api/coupons) and [discounts](https://docs.corsair.dev/docs/api/discounts) are applied simultaneously to a [subscription](https://docs.corsair.dev/docs/api/subscriptions) or [one-time invoice](https://docs.corsair.dev/docs/api/invoices/create-invoice-for-items-and-one-time-charges), they're applied in the following order: \|---\|---------------------------------------\|-------------------------------------------------------------------------------------\| \| \| **Summary** \| **Description** \| \| 1 \| Line-level, fixed amount coupons \| `coupon` with `apply_on` = `each_specified_item` and `discount_type` = `flat` \| \| 2 \| Line-level, fixed amount discounts \| `discount` with `apply_on` = `specific_item_price` and `type` = `fixed_amount` \| \| 3 \| Line-level, percentage coupons \| `coupon` with `apply_on` = `each_specified_item` and `discount_type` = `percentage` \| \| 4 \| Line-level, percentage discounts \| `discount` with `apply_on` = `specific_item_price` and `type` = `percentage` \| \| 5 \| Invoice-level, fixed amount coupons \| `coupon` with `apply_on` = `invoice_amount` and `discount_type` = `flat` \| \| 6 \| Invoice-level, fixed amount discounts \| `discount` with `apply_on` = `invoice_amount` and `type` = `fixed_amount` \| \| 7 \| Invoice-level, percentage coupons \| `coupon` with `apply_on` = `invoice_amount` and `discount_type` = `percentage` \| \| 8 \| Invoice-level, percentage discounts \| `discount` with `apply_on` = `invoice_amount` and `type` = `percentage` \| For example, consider the following scenario: A subscription is created with: \* a plan price of $200 per month * an addon price of $20 per month \* a flat $5 invoice discount * a 1% off coupon on the addon * a flat $2 coupon on the invoice The above coupons and discount are applied in the following order: \|---\|---------------------------------------------\|-----------------------------------------------\| \| \| **Discount or coupon applied** \| **Subtotal at each step** \| \| 1 \| Initial subtotal (plan price + addon price) \| $200 + $20 = $220 \| \| 2 \| 1% off coupon on the addon \| $200 + $(20 - 0.02) = $200 + $19.98 = $219.98 \| \| 3 \| Flat $2 coupon on the invoice \| $219.98 - $2 = $217.98 \| \| 4 \| Flat $5 invoice discount \| $217.98 - $5 = **$212.98\*\* \| |

> [accordion] coupon full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   invoice_name?: string | null,
>   discount_type?: string | null,
>   discount_percentage?: number | null,
>   discount_amount?: number | null,
>   discount_quantity?: number | null,
>   currency_code?: string | null,
>   duration_type?: string | null,
>   valid_from?: number | null,
>   valid_till?: number | null,
>   max_redemptions?: number | null,
>   status?: string | null,
>   apply_on?: string | null,
>   created_at?: number | null,
>   archived_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   period?: number | null,
>   period_unit?: string | null,
>   redemptions?: number | null,
>   invoice_notes?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   item_constraints?: {
>     item_type?: string | null,
>     constraint?: string | null,
>     item_price_ids?: any[] | null
>   }[] | null,
>   item_constraint_criteria?: {
>     item_type?: string | null,
>     currencies?: any[] | null,
>     item_family_ids?: any[] | null,
>     item_price_periods?: any[] | null
>   }[] | null,
>   coupon_constraints?: {
>     entity_type?: string | null,
>     type?: string | null,
>     value?: string | null
>   }[] | null
> } | null
> ```

***

### list

`coupons.list`

List coupons. List all the available coupons that are created for a specific promotion or offers. You can find list of coupon codes that are currently active, expired, archived or deleted.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.coupons.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `id` | `object` | No | optional, string filter Used to uniquely identify the coupon in your website/application and to integrate with Chargebee. **Note:** When the coupon ID contains a special character; for example: `#`, the API returns an error. Make sure that you [encode](https://www.urlencoder.org/) the coupon ID in the path parameter before making an API call. . **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *id\\\[is\\] = "OFF2008"* |
| `name` | `object` | No | optional, string filter The display name used in web interface for identifying the coupon. **Note:** When the name of the coupon set contains a special character; for example: `#`, the API returns an error. Make sure that you [encode](https://www.urlencoder.org/) the name of the coupon set in the path parameter before making an API call. . **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *name\\\[is\_not\\] = "Offer 10"* |
| `discount_type` | `object` | No | optional, enumerated string filter The type of deduction. Possible values are : fixed\_amount, percentage. **Supported operators :** is, is\_not, in, not\_in **Example →** *discount\_type\\\[is\\] = "fixed\_amount"* |
| `duration_type` | `object` | No | optional, enumerated string filter Specifies the time duration for which this coupon is attached to the subscription. Possible values are : one\_time, forever, limited\_period. **Supported operators :** is, is\_not, in, not\_in **Example →** *duration\_type\\\[is\\] = "forever"* |
| `status` | `object` | No | optional, enumerated string filter Status of the coupon. Possible values are : active, expired, archived, deleted. **Supported operators :** is, is\_not, in, not\_in **Example →** *status\\\[is\_not\\] = "active"* |
| `apply_on` | `object` | No | optional, enumerated string filter The amount on the invoice to which the coupon is applied. Possible values are : invoice\_amount, each\_specified\_item. **Supported operators :** is, is\_not, in, not\_in **Example →** *apply\_on\\\[is\\] = "invoice\_amount"* |
| `created_at` | `object` | No | optional, timestamp(UTC) in seconds filter Timestamp indicating when this coupon is created. **Supported operators :** after, before, on, between **Example →** *created\_at\\\[before\\] = "145222875"* |
| `updated_at` | `object` | No | optional, timestamp(UTC) in seconds filter To filter based on updated at. This attribute will be present only if the resource has been updated after 2016-11-09. **Supported operators :** after, before, on, between **Example →** *updated\_at\\\[on\\] = "1243545465"* |
| `sort_by` | `object` | No | optional, string filter Sorts based on the specified attribute. **Supported attributes :** created\_at **Supported sort-orders :** asc, desc **Example →** *sort\_by\\\[asc\\] = "created\_at"* This will sort the result based on the 'created\_at' attribute in ascending(earliest first) order. |
| `currency_code` | `object` | No | optional, string filter The currency code ([ISO 4217 format](https://www.chargebee.com/docs/supported-currencies.html) ) of the coupon. Applicable for *fixed\_amount* coupons alone. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *currency\_code\\\[is\\] = "USD"* |
| `applicable_item_price_ids` | `object` | No | optional, string filter List of itemPrice ids for which these coupons are applicable. **Supported operators :** in, is **Example →** *applicable\_item\_price\_ids\\\[is\\] = "day-pass-USD"* |

> [accordion] id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] name full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] discount\_type full type
>
> ```ts theme={null}
> {
>   is?: fixed_amount | percentage | offer_quantity,
>   is_not?: fixed_amount | percentage | offer_quantity,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] duration\_type full type
>
> ```ts theme={null}
> {
>   is?: one_time | forever | limited_period,
>   is_not?: one_time | forever | limited_period,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] status full type
>
> ```ts theme={null}
> {
>   is?: active | expired | archived | deleted | future,
>   is_not?: active | expired | archived | deleted | future,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] apply\_on full type
>
> ```ts theme={null}
> {
>   is?: invoice_amount | each_specified_item,
>   is_not?: invoice_amount | each_specified_item,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] created\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] updated\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] sort\_by full type
>
> ```ts theme={null}
> {
>   asc?: created_at,
>   desc?: created_at
> }
> ```

> [accordion] currency\_code full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] applicable\_item\_price\_ids full type
>
> ```ts theme={null}
> {
>   is?: string,
>   in?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   coupon?: {
>     id?: string | null,
>     name?: string | null,
>     invoice_name?: string | null,
>     discount_type?: string | null,
>     discount_percentage?: number | null,
>     discount_amount?: number | null,
>     discount_quantity?: number | null,
>     currency_code?: string | null,
>     duration_type?: string | null,
>     valid_from?: number | null,
>     valid_till?: number | null,
>     max_redemptions?: number | null,
>     status?: string | null,
>     apply_on?: string | null,
>     created_at?: number | null,
>     archived_at?: number | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     period?: number | null,
>     period_unit?: string | null,
>     redemptions?: number | null,
>     invoice_notes?: string | null,
>     meta_data?: {
>     } | null,
>     deleted?: boolean | null,
>     item_constraints?: {
>       item_type?: string | null,
>       constraint?: string | null,
>       item_price_ids?: any[] | null
>     }[] | null,
>     item_constraint_criteria?: {
>       item_type?: string | null,
>       currencies?: any[] | null,
>       item_family_ids?: any[] | null,
>       item_price_periods?: any[] | null
>     }[] | null,
>     coupon_constraints?: {
>       entity_type?: string | null,
>       type?: string | null,
>       value?: string | null
>     }[] | null
>   } | null
> }[] | null
> ```

***

### unarchive

`coupons.unarchive`

Unarchive a coupon. This API unarchives a specific coupon using the coupon ID.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.coupons.unarchive({ couponId: 'WELCOME10' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `couponId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `coupon` | `object \| null` | No | Overview -------- Coupons are deductions applied to invoices or invoice line items. They're designed to be consumed by your customers directly. A coupon deduction can either be for a fixed amount or for a percentage of the amount of the invoice or line item. **Note:** If you wish to provide discounts to your customers via API or the Chargebee app, see [Discounts API](https://docs.corsair.dev/docs/api/discounts) Order of application of coupons and discounts --------------------------------------------- When both [coupons](https://docs.corsair.dev/docs/api/coupons) and [discounts](https://docs.corsair.dev/docs/api/discounts) are applied simultaneously to a [subscription](https://docs.corsair.dev/docs/api/subscriptions) or [one-time invoice](https://docs.corsair.dev/docs/api/invoices/create-invoice-for-items-and-one-time-charges), they're applied in the following order: \|---\|---------------------------------------\|-------------------------------------------------------------------------------------\| \| \| **Summary** \| **Description** \| \| 1 \| Line-level, fixed amount coupons \| `coupon` with `apply_on` = `each_specified_item` and `discount_type` = `flat` \| \| 2 \| Line-level, fixed amount discounts \| `discount` with `apply_on` = `specific_item_price` and `type` = `fixed_amount` \| \| 3 \| Line-level, percentage coupons \| `coupon` with `apply_on` = `each_specified_item` and `discount_type` = `percentage` \| \| 4 \| Line-level, percentage discounts \| `discount` with `apply_on` = `specific_item_price` and `type` = `percentage` \| \| 5 \| Invoice-level, fixed amount coupons \| `coupon` with `apply_on` = `invoice_amount` and `discount_type` = `flat` \| \| 6 \| Invoice-level, fixed amount discounts \| `discount` with `apply_on` = `invoice_amount` and `type` = `fixed_amount` \| \| 7 \| Invoice-level, percentage coupons \| `coupon` with `apply_on` = `invoice_amount` and `discount_type` = `percentage` \| \| 8 \| Invoice-level, percentage discounts \| `discount` with `apply_on` = `invoice_amount` and `type` = `percentage` \| For example, consider the following scenario: A subscription is created with: \* a plan price of $200 per month * an addon price of $20 per month \* a flat $5 invoice discount * a 1% off coupon on the addon * a flat $2 coupon on the invoice The above coupons and discount are applied in the following order: \|---\|---------------------------------------------\|-----------------------------------------------\| \| \| **Discount or coupon applied** \| **Subtotal at each step** \| \| 1 \| Initial subtotal (plan price + addon price) \| $200 + $20 = $220 \| \| 2 \| 1% off coupon on the addon \| $200 + $(20 - 0.02) = $200 + $19.98 = $219.98 \| \| 3 \| Flat $2 coupon on the invoice \| $219.98 - $2 = $217.98 \| \| 4 \| Flat $5 invoice discount \| $217.98 - $5 = **$212.98\*\* \| |

> [accordion] coupon full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   invoice_name?: string | null,
>   discount_type?: string | null,
>   discount_percentage?: number | null,
>   discount_amount?: number | null,
>   discount_quantity?: number | null,
>   currency_code?: string | null,
>   duration_type?: string | null,
>   valid_from?: number | null,
>   valid_till?: number | null,
>   max_redemptions?: number | null,
>   status?: string | null,
>   apply_on?: string | null,
>   created_at?: number | null,
>   archived_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   period?: number | null,
>   period_unit?: string | null,
>   redemptions?: number | null,
>   invoice_notes?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   item_constraints?: {
>     item_type?: string | null,
>     constraint?: string | null,
>     item_price_ids?: any[] | null
>   }[] | null,
>   item_constraint_criteria?: {
>     item_type?: string | null,
>     currencies?: any[] | null,
>     item_family_ids?: any[] | null,
>     item_price_periods?: any[] | null
>   }[] | null,
>   coupon_constraints?: {
>     entity_type?: string | null,
>     type?: string | null,
>     value?: string | null
>   }[] | null
> } | null
> ```

***

### update

`coupons.update`

Update a coupon. When updating coupons that are already linked to an invoice or subscription you can only update the following parameters: \* name \* invoice name \* plan\_constraint - Applicable when apply\_on is set as each\_specified\_item. Allows change from none to all, none to specific, and specific to all. Product Catalog 1.0 sites only.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.coupons.update({ couponId: 'WELCOME10' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `couponId` | `string` | Yes | — |
| `name` | `string` | No | The display name used in web interface for identifying the coupon. **Note:** When the name of the coupon set contains a special character; for example: `#`, the API returns an error. Make sure that you [encode](https://www.urlencoder.org/) the name of the coupon set in the path parameter before making an API call. . |
| `invoice_name` | `string` | No | Display name used in invoice. If it is not configured then name is used in invoice. |
| `discount_type` | `fixed_amount \| percentage \| offer_quantity` | No | Specifies the type of discount to be applied. \* fixed\_amount - A fixed amount is deducted as a discount. The discount amount is specified in [discount\_amount](https://docs.corsair.dev/docs/api/v2/pcv-1/coupons/update-a-coupon#discount_amount). [Learn more](https://www.chargebee.com/docs/1.0/coupons.html#fixed-amount) about `fixed_amount` coupons. \* percentage - A percentage of the original price is deducted as a discount. The discount percentage is specified in [discount\_percentage](https://docs.corsair.dev/docs/api/v2/pcv-1/coupons/update-a-coupon#discount_percentage). [Learn more](https://www.chargebee.com/docs/1.0/coupons.html#percentage) about `percentage` coupons. \* offer\_quantity - A specified number of units of the plan or addon are offered for free. The number of free units is specified in [discount\_quantity](https://docs.corsair.dev/docs/api/v2/pcv-1/coupons/update-a-coupon#discount_quantity). The `offer_quantity` option is valid only when [apply\_on](https://docs.corsair.dev/docs/api/v2/pcv-1/coupons/update-a-coupon#apply_on) is set to `each_specified_item` and the `pricing_model` of the [plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object#pricing_model) or addon is `per_unit`. [Learn more](https://www.chargebee.com/docs/1.0/coupons.html#offer-quantity) about `offer_quantity` coupons. |
| `discount_amount` | `number` | No | The value of the deduction. The format of this value depends on the [kind of currency](https://docs.corsair.dev/docs/api/currencies) . |
| `currency_code` | `string` | No | The currency code ([ISO 4217 format](https://www.chargebee.com/docs/2.0/supported-currencies.html) ) of the coupon. Applicable for *fixed\_amount* coupons alone. |
| `discount_percentage` | `number` | No | The percentage of the original amount that should be deducted from it. |
| `discount_quantity` | `number` | No | Specifies the number of free units provided for the [plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans) or [addon](https://docs.corsair.dev/docs/api/v2/pcv-1/addons) , without affecting the total quantity sold. This parameter is applicable only when the [discount\_type](https://docs.corsair.dev/docs/api/v2/pcv-1/coupons/update-a-coupon#discount_type) is set to `offer_quantity` . |
| `apply_on` | `invoice_amount \| each_specified_item` | No | The amount on the invoice to which the coupon is applied. \* invoice\_amount - The coupon is applied to the invoice `sub_total` . \* each\_specified\_item - The coupon is applied to the `invoice.line_item.amount` that corresponds to the plan or addon specified by `plan_ids` and `addon_ids` . |
| `duration_type` | `one_time \| forever \| limited_period` | No | Specifies the time duration for which this coupon is attached to the subscription. \* forever - The coupon is attached to the subscription and applied on the invoices until explicitly removed. \* 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` . \* one\_time - The coupon stays attached to the subscription till it is applied on an invoice **once**. It is removed after that from the subscription. |
| `duration_month` | `number` | No | **(Deprecated)** The duration of time in months for which the coupon is attached to the subscription. Applicable only when `duration_type` is `limited_period`. **Note:** This parameter has been deprecated. Use `period` and `period_unit` instead. |
| `valid_till` | `number` | No | Date upto which the coupon can be applied to new subscriptions. |
| `max_redemptions` | `number` | No | Maximum number of times this coupon can be redeemed. **Note:** If not specified, the coupon can be redeemed an indefinite number of times. . |
| `invoice_notes` | `string` | No | A customer-facing note added to all invoices associated with this API resource. This note becomes one among [all the notes](https://docs.corsair.dev/docs/api/invoices/invoice-object#notes) displayed on the invoice PDF. |
| `meta_data` | `object` | No | A collection of key-value pairs that provides extra information about the coupon. **Note:** There's a character limit of 65,535. [Learn more](https://docs.corsair.dev/docs/api/v2/pcv-1/advanced-features) . |
| `included_in_mrr` | `boolean` | No | The coupon is included in MRR calculations for your site. This attribute is only applicable for coupons of `duration_type = one_time` and when the feature is enabled in Chargebee. Note: If the site-level setting is to exclude one-time coupons from MRR calculations, this value is always returned `false` . |
| `period` | `number` | No | The duration of time for which the coupon is attached to the subscription, in `period_units`. Applicable only when [duration\_type](https://docs.corsair.dev/docs/api/coupons/coupon-object#duration_type) is [limited\_period](https://docs.corsair.dev/docs/api/coupons/coupon-object#duration_type) . |
| `period_unit` | `day \| week \| month \| year` | No | The unit of time for period. Applicable only when [duration\_type](https://docs.corsair.dev/docs/api/coupons/coupon-object#duration_type) is [limited\_period](https://docs.corsair.dev/docs/api/coupons/coupon-object#duration_type) . \* year - A period of 1 calendar year. \* month - A period of 1 calendar month. \* week - A period of 7 days. \* day - A period of 24 hours. |
| `plan_constraint` | `none \| all \| specific` | No | Plans the coupon can be applied to. \* all - Coupon applicable to all plans. \* specific - Coupon only applicable to specified plans. If used, it is mandatory to specify the plan(s). \* none - Coupon not applicable to any plans. |
| `addon_constraint` | `none \| all \| specific` | No | Addons the coupon can be applied to. \* specific - Coupon only applicable to specified addons. If used, it is mandatory to specify the addon(s). \* all - Coupon applicable to all addons. \* none - Coupon not applicable to any addons. |
| `plan_ids` | `string[]` | No | Identifier of the plan. |
| `addon_ids` | `string[]` | No | Identifier of the addon. |

> [accordion] meta\_data full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `coupon` | `object \| null` | No | Overview -------- Coupons are deductions applied to invoices or invoice line items. They're designed to be consumed by your customers directly. A coupon deduction can either be for a fixed amount or for a percentage of the amount of the invoice or line item. Order of application of coupons ------------------------------- When multiple [coupons](https://docs.corsair.dev/docs/api/coupons) are applied to a [subscription](https://docs.corsair.dev/docs/api/subscriptions) or [one-time invoice](https://docs.corsair.dev/docs/api/v2/pcv-1/invoices/create-an-invoice), they're applied in the following order: \|---\|-------------------------------------\|-------------------------------------------------------------------------------------\| \| \| **Summary** \| **Description** \| \| 1 \| Line-level, fixed amount coupons \| `coupon` with `apply_on` = `each_specified_item` and `discount_type` = `flat` \| \| 2 \| Line-level, percentage coupons \| `coupon` with `apply_on` = `each_specified_item` and `discount_type` = `percentage` \| \| 3 \| Invoice-level, fixed amount coupons \| `coupon` with `apply_on` = `invoice_amount` and `discount_type` = `flat` \| \| 4 \| Invoice-level, percentage coupons \| `coupon` with `apply_on` = `invoice_amount` and `discount_type` = `percentage` \| For example, consider the following scenario: A subscription is created with: \* a plan price of $200 per month * an addon price of $20 per month \* a flat $5 coupon on the invoice * a 1% off coupon on the addon * a flat $10 coupon on the plan The above coupons are applied in the following order: \|---\|---------------------------------------------\|--------------------------------------------\| \| \| **Discount or coupon applied** \| **Subtotal at each step** \| \| 1 \| Initial subtotal (plan price + addon price) \| $200 + $20 = $220 \| \| 2 \| Flat $10 coupon on the plan \| $(200 - 10) + $20 = $190 + $20 = $210 \| \| 3 \| 1% off coupon on the addon \| $190 + $(20 - 0.2) = $190 + $19.8 = $209.8 \| \| 4 \| Flat $5 coupon on the invoice \| $209.8 - $5 = **$204.8\*\* \| |

> [accordion] coupon full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   invoice_name?: string | null,
>   discount_type?: string | null,
>   discount_percentage?: number | null,
>   discount_amount?: number | null,
>   discount_quantity?: number | null,
>   currency_code?: string | null,
>   duration_type?: string | null,
>   valid_till?: number | null,
>   max_redemptions?: number | null,
>   status?: string | null,
>   apply_on?: string | null,
>   plan_constraint?: string | null,
>   addon_constraint?: string | null,
>   created_at?: number | null,
>   archived_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   included_in_mrr?: boolean | null,
>   period?: number | null,
>   period_unit?: string | null,
>   plan_ids?: string[] | null,
>   addon_ids?: string[] | null,
>   redemptions?: number | null,
>   invoice_notes?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null
> } | null
> ```

***

### updateForItems

`coupons.updateForItems`

Update a coupon for items. This API updates a coupon that is created for a specific promotion or offers.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.coupons.updateForItems({ couponId: 'WELCOME10' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `couponId` | `string` | Yes | — |
| `name` | `string` | No | The display name used in web interface for identifying the coupon. **Note:** When the name of the coupon set contains a special character; for example: `#`, the API returns an error. Make sure that you [encode](https://www.urlencoder.org/) the name of the coupon set in the path parameter before making an API call. . |
| `invoice_name` | `string` | No | Display name used in invoice. If it is not configured then name is used in invoice. |
| `discount_type` | `fixed_amount \| percentage \| offer_quantity` | No | Specifies the type of discount to be applied. \* percentage - A percentage of the original price is deducted as a discount. The discount percentage is specified in [discount\_percentage](https://docs.corsair.dev/docs/api/coupons/update-a-coupon-for-items#discount_percentage). [Learn more](https://www.chargebee.com/docs/2.0/coupons.html#percentage-coupons) about `percentage` coupons. \* fixed\_amount - A fixed amount is deducted as a discount. The discount amount is specified in [discount\_amount](https://docs.corsair.dev/docs/api/coupons/update-a-coupon-for-items#discount_amount). [Learn more](https://www.chargebee.com/docs/2.0/coupons.html#fixed-amount-coupons) about `fixed_amount` coupons. \* offer\_quantity - A specified number of units of the item price are offered for free. The number of free units is specified in [discount\_quantity](https://docs.corsair.dev/docs/api/coupons/update-a-coupon-for-items#discount_quantity). The `offer_quantity` option is valid only when [apply\_on](https://docs.corsair.dev/docs/api/coupons/update-a-coupon-for-items#apply_on) is set to `each_specified_item` and the [pricing\_model](https://docs.corsair.dev/docs/api/item_prices/item_price-object#pricing_model) of the item price is `per_unit`. [Learn more](https://www.chargebee.com/docs/2.0/coupons.html#offer-quantity-coupons) about `offer_quantity` coupons. |
| `discount_amount` | `number` | No | The value of the deduction. The format of this value depends on the [kind of currency](https://docs.corsair.dev/docs/api/currencies) . |
| `currency_code` | `string` | No | The currency code ([ISO 4217 format](https://www.chargebee.com/docs/2.0/supported-currencies.html) ) of the coupon. Applicable for *fixed\_amount* coupons alone. |
| `discount_percentage` | `number` | No | The percentage of the original amount that should be deducted from it. |
| `discount_quantity` | `number` | No | Specifies the number of free units provided for the [item price](https://docs.corsair.dev/docs/api/item_prices) , without affecting the total quantity sold. This parameter is applicable only when the [discount\_type](https://docs.corsair.dev/docs/api/coupons/update-a-coupon-for-items#discount_type) is set to `offer_quantity` . |
| `apply_on` | `invoice_amount \| each_specified_item` | No | The amount on the invoice to which the coupon is applied. \* invoice\_amount - The coupon is applied to the invoice `sub_total` . \* each\_specified\_item - Applies the coupon to specified items (plans, addons, or charges), with the discount applied to each matching `invoice.line_item.amount`. Requires applicability to be configured using [`item_constraints`](https://docs.corsair.dev/docs/api/coupons/update-a-coupon-for-items#item_constraints)---for example `all`, `criteria`, or `specific` with `item_price_ids`. When you attach this coupon to a subscription, at least one of that subscription's plans, addons, or charges must match those rules. If none do, the request fails. |
| `duration_type` | `one_time \| forever \| limited_period` | No | Specifies the time duration for which this coupon is attached to the subscription. \* forever - The coupon is attached to the subscription and applied on the invoices until explicitly removed. \* one\_time - The coupon stays attached to the subscription till it is applied on an invoice **once**. It is removed after that from the subscription. \* 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` . |
| `duration_month` | `number` | No | **(Deprecated)** The duration of time in months for which the coupon is attached to the subscription. Applicable only when `duration_type` is `limited_period`. **Note:** This parameter has been deprecated. Use `period` and `period_unit` instead. |
| `valid_from` | `number` | No | The date from which the coupon can be applied to subscriptions. |
| `valid_till` | `number` | No | Date upto which the coupon can be applied to new subscriptions. |
| `max_redemptions` | `number` | No | Maximum number of times this coupon can be redeemed. **Note:** If not specified, the coupon can be redeemed an indefinite number of times. . |
| `invoice_notes` | `string` | No | A customer-facing note added to all invoices associated with this API resource. This note becomes one among [all the notes](https://docs.corsair.dev/docs/api/invoices/invoice-object#notes) displayed on the invoice PDF. |
| `meta_data` | `object` | No | A collection of key-value pairs that provides extra information about the coupon. **Note:** There's a character limit of 65,535. [Learn more](https://docs.corsair.dev/docs/api/advanced-features) . |
| `included_in_mrr` | `boolean` | No | The coupon is included in MRR calculations for your site. This attribute is only applicable for coupons of `duration_type = one_time` and when the feature is enabled in Chargebee. Note: If the site-level setting is to exclude one-time coupons from MRR calculations, this value is always returned `false` . |
| `period` | `number` | No | The duration of time for which the coupon is attached to the subscription, in `period_units`. Applicable only when [duration\_type](https://docs.corsair.dev/docs/api/coupons/coupon-object#duration_type) is [limited\_period](https://docs.corsair.dev/docs/api/coupons/coupon-object#duration_type) . |
| `period_unit` | `day \| week \| month \| year` | No | The unit of time for period. Applicable only when [duration\_type](https://docs.corsair.dev/docs/api/coupons/coupon-object#duration_type) is [limited\_period](https://docs.corsair.dev/docs/api/coupons/coupon-object#duration_type) . \* month - A period of 1 calendar month. \* week - A period of 7 days. \* year - A period of 1 calendar year. \* day - A period of 24 hours. |
| `item_constraints` | `object` | No | Parameters for item\_constraints |
| `item_constraint_criteria` | `object` | No | Parameters for item\_constraint\_criteria |
| `coupon_constraints` | `object` | No | Parameters for `coupon_constraints`. Multiple `coupon_constraints` can be passed by specifying unique indices. |

> [accordion] meta\_data full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] item\_constraints full type
>
> ```ts theme={null}
> {
>   constraint: (none | all | specific | criteria)[],
>   item_type: (plan | addon | charge)[],
>   item_price_ids?: any[][]
> }
> ```

> [accordion] item\_constraint\_criteria full type
>
> ```ts theme={null}
> {
>   item_type?: (plan | addon | charge)[],
>   item_family_ids?: any[][],
>   currencies?: any[][],
>   item_price_periods?: any[][]
> }
> ```

> [accordion] coupon\_constraints full type
>
> ```ts theme={null}
> {
>   entity_type: customer[],
>   type: (max_redemptions | unique_by | existing_customer | new_customer)[],
>   value?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `coupon` | `object \| null` | No | Overview -------- Coupons are deductions applied to invoices or invoice line items. They're designed to be consumed by your customers directly. A coupon deduction can either be for a fixed amount or for a percentage of the amount of the invoice or line item. **Note:** If you wish to provide discounts to your customers via API or the Chargebee app, see [Discounts API](https://docs.corsair.dev/docs/api/discounts) Order of application of coupons and discounts --------------------------------------------- When both [coupons](https://docs.corsair.dev/docs/api/coupons) and [discounts](https://docs.corsair.dev/docs/api/discounts) are applied simultaneously to a [subscription](https://docs.corsair.dev/docs/api/subscriptions) or [one-time invoice](https://docs.corsair.dev/docs/api/invoices/create-invoice-for-items-and-one-time-charges), they're applied in the following order: \|---\|---------------------------------------\|-------------------------------------------------------------------------------------\| \| \| **Summary** \| **Description** \| \| 1 \| Line-level, fixed amount coupons \| `coupon` with `apply_on` = `each_specified_item` and `discount_type` = `flat` \| \| 2 \| Line-level, fixed amount discounts \| `discount` with `apply_on` = `specific_item_price` and `type` = `fixed_amount` \| \| 3 \| Line-level, percentage coupons \| `coupon` with `apply_on` = `each_specified_item` and `discount_type` = `percentage` \| \| 4 \| Line-level, percentage discounts \| `discount` with `apply_on` = `specific_item_price` and `type` = `percentage` \| \| 5 \| Invoice-level, fixed amount coupons \| `coupon` with `apply_on` = `invoice_amount` and `discount_type` = `flat` \| \| 6 \| Invoice-level, fixed amount discounts \| `discount` with `apply_on` = `invoice_amount` and `type` = `fixed_amount` \| \| 7 \| Invoice-level, percentage coupons \| `coupon` with `apply_on` = `invoice_amount` and `discount_type` = `percentage` \| \| 8 \| Invoice-level, percentage discounts \| `discount` with `apply_on` = `invoice_amount` and `type` = `percentage` \| For example, consider the following scenario: A subscription is created with: \* a plan price of $200 per month * an addon price of $20 per month \* a flat $5 invoice discount * a 1% off coupon on the addon * a flat $2 coupon on the invoice The above coupons and discount are applied in the following order: \|---\|---------------------------------------------\|-----------------------------------------------\| \| \| **Discount or coupon applied** \| **Subtotal at each step** \| \| 1 \| Initial subtotal (plan price + addon price) \| $200 + $20 = $220 \| \| 2 \| 1% off coupon on the addon \| $200 + $(20 - 0.02) = $200 + $19.98 = $219.98 \| \| 3 \| Flat $2 coupon on the invoice \| $219.98 - $2 = $217.98 \| \| 4 \| Flat $5 invoice discount \| $217.98 - $5 = **$212.98\*\* \| |

> [accordion] coupon full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   invoice_name?: string | null,
>   discount_type?: string | null,
>   discount_percentage?: number | null,
>   discount_amount?: number | null,
>   discount_quantity?: number | null,
>   currency_code?: string | null,
>   duration_type?: string | null,
>   valid_from?: number | null,
>   valid_till?: number | null,
>   max_redemptions?: number | null,
>   status?: string | null,
>   apply_on?: string | null,
>   created_at?: number | null,
>   archived_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   period?: number | null,
>   period_unit?: string | null,
>   redemptions?: number | null,
>   invoice_notes?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   item_constraints?: {
>     item_type?: string | null,
>     constraint?: string | null,
>     item_price_ids?: any[] | null
>   }[] | null,
>   item_constraint_criteria?: {
>     item_type?: string | null,
>     currencies?: any[] | null,
>     item_family_ids?: any[] | null,
>     item_price_periods?: any[] | null
>   }[] | null,
>   coupon_constraints?: {
>     entity_type?: string | null,
>     type?: string | null,
>     value?: string | null
>   }[] | null
> } | null
> ```

***

## Coupon Sets

### addCouponCodes

`couponSets.addCouponCodes`

Add coupon codes to coupon set. This API add coupon codes to an existing coupon set.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.couponSets.addCouponCodes({ couponSetId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `couponSetId` | `string` | Yes | — |
| `code` | `string[]` | No | You can pass up to 100 values per API call. You can also use the Chargebee UI to pass up to 1000 codes per operation. There is no limit on the total number of coupon codes that can be included in a coupon set. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `coupon_set` | `object \| null` | No | A coupon set contains a bunch of coupon codes that can be redeemed by your customers when they are checking out. It belongs to an existing coupon and will usually be combined with other coupons that share similar promotion or discount offers. Using this resource, you can create, update, retrieve, delete coupon sets and add coupon codes to a coupon set. |

> [accordion] coupon\_set full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   coupon_id?: string | null,
>   name?: string | null,
>   total_count?: number | null,
>   redeemed_count?: number | null,
>   archived_count?: number | null,
>   meta_data?: {
>   } | null
> } | null
> ```

***

### create

`couponSets.create`

Create a coupon set. with a coupon code compatible to your product offers and promotional discounts.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.couponSets.create({ coupon_id: 'example', id: 'cust_8gsnbYfsMLds', name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `coupon_id` | `string` | Yes | Coupon id linked to coupon set. |
| `name` | `string` | Yes | Name of the coupon set. |
| `id` | `string` | Yes | Uniquely identifies a coupon\_set. |
| `meta_data` | `object` | No | A collection of key-value pairs that provides extra information about the coupon set. **Note:** There's a character limit of 65,535. [Learn more](https://docs.corsair.dev/docs/api/advanced-features) . |

> [accordion] meta\_data full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `coupon_set` | `object \| null` | No | A coupon set contains a bunch of coupon codes that can be redeemed by your customers when they are checking out. It belongs to an existing coupon and will usually be combined with other coupons that share similar promotion or discount offers. Using this resource, you can create, update, retrieve, delete coupon sets and add coupon codes to a coupon set. |

> [accordion] coupon\_set full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   coupon_id?: string | null,
>   name?: string | null,
>   total_count?: number | null,
>   redeemed_count?: number | null,
>   archived_count?: number | null,
>   meta_data?: {
>   } | null
> } | null
> ```

***

### delete

`couponSets.delete`

Delete a coupon set. Use this endpoint to delete a specific coupon set.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.couponSets.delete({ couponSetId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `couponSetId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `coupon_set` | `object \| null` | No | A coupon set contains a bunch of coupon codes that can be redeemed by your customers when they are checking out. It belongs to an existing coupon and will usually be combined with other coupons that share similar promotion or discount offers. Using this resource, you can create, update, retrieve, delete coupon sets and add coupon codes to a coupon set. |

> [accordion] coupon\_set full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   coupon_id?: string | null,
>   name?: string | null,
>   total_count?: number | null,
>   redeemed_count?: number | null,
>   archived_count?: number | null,
>   meta_data?: {
>   } | null
> } | null
> ```

***

### deleteUnusedCouponCodes

`couponSets.deleteUnusedCouponCodes`

Delete unused coupon codes. Use this API to delete all the unutilised coupon codes from a specific coupon set.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.couponSets.deleteUnusedCouponCodes({ couponSetId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `couponSetId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `coupon_set` | `object \| null` | No | A coupon set contains a bunch of coupon codes that can be redeemed by your customers when they are checking out. It belongs to an existing coupon and will usually be combined with other coupons that share similar promotion or discount offers. Using this resource, you can create, update, retrieve, delete coupon sets and add coupon codes to a coupon set. |

> [accordion] coupon\_set full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   coupon_id?: string | null,
>   name?: string | null,
>   total_count?: number | null,
>   redeemed_count?: number | null,
>   archived_count?: number | null,
>   meta_data?: {
>   } | null
> } | null
> ```

***

### get

`couponSets.get`

Retrieve a coupon set. Use this API to retrieve a specific coupon set.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.couponSets.get({ couponSetId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `couponSetId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `coupon_set` | `object \| null` | No | A coupon set contains a bunch of coupon codes that can be redeemed by your customers when they are checking out. It belongs to an existing coupon and will usually be combined with other coupons that share similar promotion or discount offers. Using this resource, you can create, update, retrieve, delete coupon sets and add coupon codes to a coupon set. |

> [accordion] coupon\_set full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   coupon_id?: string | null,
>   name?: string | null,
>   total_count?: number | null,
>   redeemed_count?: number | null,
>   archived_count?: number | null,
>   meta_data?: {
>   } | null
> } | null
> ```

***

### list

`couponSets.list`

List coupon sets. Use this API to get the list of all the coupon sets.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.couponSets.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `id` | `object` | No | optional, string filter Uniquely identifies a coupon\_set. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *id\\\[is\\] = "bulk-codes-1"* |
| `name` | `object` | No | optional, string filter Name of the coupon set. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *name\\\[is\_not\\] = "bulk-codes-1"* |
| `coupon_id` | `object` | No | optional, string filter Coupon id linked to coupon set. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *coupon\_id\\\[is\\] = "OFF2008"* |
| `total_count` | `object` | No | optional, integer filter No of coupon codes present in coupon set. **Supported operators :** is, is\_not, lt, lte, gt, gte, between **Example →** *total\_count\\\[gt\\] = "10"* |
| `redeemed_count` | `object` | No | optional, integer filter No of redeemed codes. **Supported operators :** is, is\_not, lt, lte, gt, gte, between **Example →** *redeemed\_count\\\[is\\] = "5"* |
| `archived_count` | `object` | No | optional, integer filter No of archived codes. **Supported operators :** is, is\_not, lt, lte, gt, gte, between **Example →** *archived\_count\\\[is\\] = "2"* |

> [accordion] id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] name full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] coupon\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] total\_count full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   lt?: string,
>   lte?: string,
>   gt?: string,
>   gte?: string,
>   between?: string
> }
> ```

> [accordion] redeemed\_count full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   lt?: string,
>   lte?: string,
>   gt?: string,
>   gte?: string,
>   between?: string
> }
> ```

> [accordion] archived\_count full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   lt?: string,
>   lte?: string,
>   gt?: string,
>   gte?: string,
>   between?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   coupon_set?: {
>     id?: string | null,
>     coupon_id?: string | null,
>     name?: string | null,
>     total_count?: number | null,
>     redeemed_count?: number | null,
>     archived_count?: number | null,
>     meta_data?: {
>     } | null
>   } | null
> }[] | null
> ```

***

### update

`couponSets.update`

Update a coupon set. Use this API to update a specific coupon set by updating its name and the meta\_data.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.couponSets.update({ couponSetId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `couponSetId` | `string` | Yes | — |
| `name` | `string` | No | Name of the coupon set. |
| `meta_data` | `object` | No | A collection of key-value pairs that provides extra information about the coupon set. **Note:** There's a character limit of 65,535. [Learn more](https://docs.corsair.dev/docs/api/advanced-features) . |

> [accordion] meta\_data full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `coupon_set` | `object \| null` | No | A coupon set contains a bunch of coupon codes that can be redeemed by your customers when they are checking out. It belongs to an existing coupon and will usually be combined with other coupons that share similar promotion or discount offers. Using this resource, you can create, update, retrieve, delete coupon sets and add coupon codes to a coupon set. |

> [accordion] coupon\_set full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   coupon_id?: string | null,
>   name?: string | null,
>   total_count?: number | null,
>   redeemed_count?: number | null,
>   archived_count?: number | null,
>   meta_data?: {
>   } | null
> } | null
> ```

***

## Credit Notes

### create

`creditNotes.create`

Create credit note. Creates a credit note for the specified invoice. ### Impacts Invoice See Impact on reference invoice. Credit note \* A new credit note of the specified type is created. \* If the credit note type is adjustment: \* total and amount\_allocated are set to the adjusted amount. \* status is set to adjusted.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.creditNotes.create({ type: 'adjustment' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `reference_invoice_id` | `string` | No | The identifier of the invoice against which this credit note is issued. **Required when** \* `type` is `adjustment` or `store`. **Note** When not provided and `type` is `refundable`, then `customer_id` must be provided because this creates a [standalone credit note](https://www.chargebee.com/docs/billing/2.0/invoices-credit-notes-and-quotes/credit-notes#standalone-credits). |
| `customer_id` | `string` | No | The identifier of the customer for whom this credit note is issued. **Required when** \* `type` is `refundable` and `reference_invoice_id` is not provided. This creates a [standalone credit note](https://www.chargebee.com/docs/billing/2.0/invoices-credit-notes-and-quotes/credit-notes#standalone-credits). |
| `total` | `number` | No | The total credit note amount. **Constraints** \* Pass either the `total` or `line_items` parameter. \* If `type` is `adjustment`, `total` must not exceed the amount due on the invoice minus the total amount of any transactions in progress for the invoice. Calculate this as `invoice.amount_due` minus the sum of `invoice.linked_payments[i].amount` where `invoice.linked_payments[i].txn_status` is `in_progress`. \* If `type` is `refundable` or `store`: \* If `reference_invoice_id` is provided, `total` must not exceed the refundable amount on the invoice. Calculate the refundable amount as the sum of: \* Sum of `linked_payments[i].amount` where `linked_payments[i].txn_status` is `success` \* Sum of `applied_credits[i].applied_amount` where `applied_credits[i].status` is not `voided` \* Sum of `linked_taxes_withheld[].amount` \* Minus the sum of `issued_credit_notes[i].cn_total` where `issued_credit_notes[i].status` is not `voided` \* If `reference_invoice_id` is not provided, there is no limit on the `total` because this creates a [standalone credit note](https://www.chargebee.com/docs/billing/2.0/invoices-credit-notes-and-quotes/credit-notes#standalone-credits). |
| `type` | `adjustment \| refundable \| store` | Yes | The [type](https://docs.corsair.dev/docs/api/credit_notes/credit-note-object) of credit note to create. **Prerequisites** \* If `type` is `adjustment`, the `invoice.status` must be `payment_due`, `posted` or `not_paid`. \* If `type` is `refundable` or `store`, the `invoice.status` must be `paid`, `payment_due`, `posted`, or `not_paid`. \* refundable - Creates a refundable credit note. **Prerequisites** \* The `invoice.status` must be `paid`, `payment_due`, `posted`, or `not_paid`. \* store - Creates a store credit note. **Prerequisites** \* The `invoice.status` must be `paid`, `payment_due`, `posted`, or `not_paid`. \* adjustment - Creates an adjustment credit note. **Prerequisites** \* The `invoice.status` must be `payment_due`, `posted` or `not_paid`. |
| `reason_code` | `product_unsatisfactory \| service_unsatisfactory \| order_change \| order_cancellation \| waiver \| other` | No | The reason for issuing this Credit Note. The following reason codes are supported now\\\[Deprecated; use the [create\_reason\_code](https://docs.corsair.dev/docs/api/credit_notes/credit_note-object#create_reason_code) parameter instead\\]. \* waiver - Waiver \* order\_cancellation - Order Cancellation \* order\_change - Order Change \* product\_unsatisfactory - Product Unsatisfactory \* service\_unsatisfactory - Service Unsatisfactory \* other - Can be set when none of the above reason codes are applicable |
| `create_reason_code` | `string` | No | Reason code for creating the credit note. **Constraints** \* Must be one of the case-sensitive [reason codes](https://www.chargebee.com/docs/billing/2.0/site-configuration/reason-codes#managing-reason-codes-for-credit-notes) set in Chargebee Billing. **Required when** \* Reason codes are configured as mandatory on the site. |
| `date` | `number` | No | The date on which the credit note is issued. **Constraints** \* Must be on or after the `invoice.date` and cannot be a future date. |
| `customer_notes` | `string` | No | A note to be added for this operation, to the credit note. This note is displayed on customer-facing documents such as the [Credit Note PDF](https://docs.corsair.dev/docs/api/credit_notes/retrieve-credit-note-as-pdf) . |
| `currency_code` | `string` | No | The currency code (ISO 4217 format) for the credit note. It is required for a standalone credit note if Multicurrency is enabled. |
| `comment` | `string` | No | An internal [comment](https://docs.corsair.dev/docs/api/comments) to be added for this operation, to the credit note. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](https://docs.corsair.dev/docs/api/hosted_pages) or any document such as the [Credit Note PDF](https://docs.corsair.dev/docs/api/credit_notes/retrieve-credit-note-as-pdf) . |
| `line_items` | `object` | No | Parameters for line\_items |

> [accordion] line\_items full type
>
> ```ts theme={null}
> {
>   reference_line_item_id?: string[],
>   unit_amount?: number[],
>   unit_amount_in_decimal?: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   amount?: number[],
>   date_from?: number[],
>   date_to?: number[],
>   description?: string[],
>   entity_type?: (adhoc | plan_item_price | addon_item_price | charge_item_price)[],
>   entity_id?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `credit_note` | `object \| null` | No | A [Credit Note](https://www.chargebee.com/docs/credit-notes.html) is a document that specifies the money owed by a business to its customer. The seller usually issues a Credit Note for the same or lower amount than the invoice, and then repays the money to the customer or set it off against other 'due' invoices. ### Credit Note Types Credit notes in Chargebee are categorized into three types: 1. `adjustment`: Adjustment credit notes are used to adjust the amount of an existing invoice in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Use this type of credit note to reduce the invoice amount, typically as a discount to the customer. Adjustment credit notes are automatically created in the following cases: \* When an invoice is written off. \* When a subscription is modified with proration enabled, and the invoice for the current term is in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). 2. `refundable`: Refundable credit notes allow you to return a certain amount to the customer. These credits can be: \* Retained for automatic application on future invoices. \* Applied to existing unpaid invoices. \* Refunded to the customer. Refundable credit notes are automatically created in the following cases: \* When an invoice is refunded. \* When a subscription is changed or canceled with proration enabled, the invoice for the current term is in the `paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Refundable credits are applied to future invoices or can be refunded to the original payment method. 3. `store`: Store credit notes are created for `paid` or `partially_paid` invoice [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status) during subscription changes, such as upgrades, downgrades, or cancellations. Key characteristics of store credits: \* No tax component is included at the time of creation. \* A credit note document is generated, similar to refundable credits. \* Store credits are applied before tax calculations on future invoices. **Note:** If you have enabled *consolidated invoicing* , to know the subscriptions attached with a credit note you have to refer [line\_item's](https://docs.corsair.dev/docs/api/credit_notes/credit_note-object#line_items) *subscription\_id* . The credit note's *subscription\_id* should **not** be used (which will be *null* if the credit note has lines from multiple subscriptions). Impact on reference invoice The following updates are made to the reference invoice when a credit note is created/imported: \* If the credit note `type` is `adjustment`: \* The adjustment credit note details are added to the `adjustment_credit_notes[]` attribute of the invoice. \* The invoice `amount_due` is reduced by the credit note `total`. \* The invoice `status` is updated to `paid` if the invoice `amount_due` equals the credit note `total`. \* The invoice `status` does not change if the invoice `amount_due` is greater than credit note `total`. \* If the credit note `type` is `refundable`: \* The refundable credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. \* If the credit note `type` is `store`: \* The store credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |

> [accordion] credit\_note full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   reference_invoice_id?: string | null,
>   type?: string | null,
>   reason_code?: string | null,
>   status?: string | null,
>   vat_number?: string | null,
>   date?: number | null,
>   price_type?: string | null,
>   currency_code?: string | null,
>   total?: number | null,
>   amount_allocated?: number | null,
>   amount_refunded?: number | null,
>   amount_available?: number | null,
>   refunded_at?: number | null,
>   voided_at?: number | null,
>   generated_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   channel?: string | null,
>   line_items_next_offset?: string | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total_in_local_currency?: number | null,
>   local_currency_code?: string | null,
>   round_off_amount?: number | null,
>   fractional_correction?: number | null,
>   notes?: string[] | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   local_currency_exchange_rate?: number | null,
>   create_reason_code?: string | null,
>   vat_number_prefix?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_refunds?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     refund_reason_code?: string | null
>   }[] | null,
>   linked_tax_withheld_refunds?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   allocations?: {
>     invoice_id?: string | null,
>     allocated_amount?: number | null,
>     allocated_at?: number | null,
>     invoice_date?: number | null,
>     invoice_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### delete

`creditNotes.delete`

Delete a credit note. This API deletes a credit note. A credit note once deleted, is deleted permanently. You cannot delete a credit which has already been deleted or refunded. If you try to delete a refunded or deleted credit note, an error message will be displayed.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.creditNotes.delete({ creditNoteId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `creditNoteId` | `string` | Yes | — |
| `comment` | `string` | No | An internal [comment](https://docs.corsair.dev/docs/api/comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](https://docs.corsair.dev/docs/api/hosted_pages) or any document such as the [Invoice PDF](https://docs.corsair.dev/docs/api/invoices/retrieve-invoice-as-pdf) . |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `credit_note` | `object \| null` | No | A [Credit Note](https://www.chargebee.com/docs/credit-notes.html) is a document that specifies the money owed by a business to its customer. The seller usually issues a Credit Note for the same or lower amount than the invoice, and then repays the money to the customer or set it off against other 'due' invoices. ### Credit Note Types Credit notes in Chargebee are categorized into three types: 1. `adjustment`: Adjustment credit notes are used to adjust the amount of an existing invoice in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Use this type of credit note to reduce the invoice amount, typically as a discount to the customer. Adjustment credit notes are automatically created in the following cases: \* When an invoice is written off. \* When a subscription is modified with proration enabled, and the invoice for the current term is in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). 2. `refundable`: Refundable credit notes allow you to return a certain amount to the customer. These credits can be: \* Retained for automatic application on future invoices. \* Applied to existing unpaid invoices. \* Refunded to the customer. Refundable credit notes are automatically created in the following cases: \* When an invoice is refunded. \* When a subscription is changed or canceled with proration enabled, the invoice for the current term is in the `paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Refundable credits are applied to future invoices or can be refunded to the original payment method. 3. `store`: Store credit notes are created for `paid` or `partially_paid` invoice [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status) during subscription changes, such as upgrades, downgrades, or cancellations. Key characteristics of store credits: \* No tax component is included at the time of creation. \* A credit note document is generated, similar to refundable credits. \* Store credits are applied before tax calculations on future invoices. **Note:** If you have enabled *consolidated invoicing* , to know the subscriptions attached with a credit note you have to refer [line\_item's](https://docs.corsair.dev/docs/api/credit_notes/credit_note-object#line_items) *subscription\_id* . The credit note's *subscription\_id* should **not** be used (which will be *null* if the credit note has lines from multiple subscriptions). Impact on reference invoice The following updates are made to the reference invoice when a credit note is created/imported: \* If the credit note `type` is `adjustment`: \* The adjustment credit note details are added to the `adjustment_credit_notes[]` attribute of the invoice. \* The invoice `amount_due` is reduced by the credit note `total`. \* The invoice `status` is updated to `paid` if the invoice `amount_due` equals the credit note `total`. \* The invoice `status` does not change if the invoice `amount_due` is greater than credit note `total`. \* If the credit note `type` is `refundable`: \* The refundable credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. \* If the credit note `type` is `store`: \* The store credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. |

> [accordion] credit\_note full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   reference_invoice_id?: string | null,
>   type?: string | null,
>   reason_code?: string | null,
>   status?: string | null,
>   vat_number?: string | null,
>   date?: number | null,
>   price_type?: string | null,
>   currency_code?: string | null,
>   total?: number | null,
>   amount_allocated?: number | null,
>   amount_refunded?: number | null,
>   amount_available?: number | null,
>   refunded_at?: number | null,
>   voided_at?: number | null,
>   generated_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   channel?: string | null,
>   line_items_next_offset?: string | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total_in_local_currency?: number | null,
>   local_currency_code?: string | null,
>   round_off_amount?: number | null,
>   fractional_correction?: number | null,
>   notes?: string[] | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   local_currency_exchange_rate?: number | null,
>   create_reason_code?: string | null,
>   vat_number_prefix?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_refunds?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     refund_reason_code?: string | null
>   }[] | null,
>   linked_tax_withheld_refunds?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   allocations?: {
>     invoice_id?: string | null,
>     allocated_amount?: number | null,
>     allocated_at?: number | null,
>     invoice_date?: number | null,
>     invoice_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### downloadEinvoice

`creditNotes.downloadEinvoice`

Download e-invoice for credit note. Download the e-invoice for the credit note in both XML and PDF formats. The response consists of a download object for each format. The XML format follows the structure as per Peppol BIS Billing v3.0. Note \* You can only download e-invoices when their status is success or registered.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.creditNotes.downloadEinvoice({ creditNoteId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `creditNoteId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `downloads` | `object[] \| null` | No | Resource object representing download |

> [accordion] downloads full type
>
> ```ts theme={null}
> {
>   download_url?: string | null,
>   valid_till?: number | null,
>   mime_type?: string | null
> }[] | null
> ```

***

### get

`creditNotes.get`

Retrieve a credit note. Retrieves the Credit Note identified by the specified Credit Note number.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.creditNotes.get({ creditNoteId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `line_items_limit` | `number` | No | Specify the maximum number of line items to include in the response. **Note:** \* Applicable only when Enterprise-scale Invoicing is enabled. \* Enterprise-scale Invoicing is currently in **Private Beta** . Please reach out to [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. |
| `line_items_offset` | `string` | No | Specify the starting point for retrieving line items. Use the value from the `line_items_next_offset` attribute of the previous retrieve API response. **Note:** \* Applicable only when Enterprise-scale Invoicing is enabled. \* Enterprise-scale Invoicing is currently in **Private Beta** . Please reach out to [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. |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `creditNoteId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `credit_note` | `object \| null` | No | A [Credit Note](https://www.chargebee.com/docs/credit-notes.html) is a document that specifies the money owed by a business to its customer. The seller usually issues a Credit Note for the same or lower amount than the invoice, and then repays the money to the customer or set it off against other 'due' invoices. ### Credit Note Types Credit notes in Chargebee are categorized into three types: 1. `adjustment`: Adjustment credit notes are used to adjust the amount of an existing invoice in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Use this type of credit note to reduce the invoice amount, typically as a discount to the customer. Adjustment credit notes are automatically created in the following cases: \* When an invoice is written off. \* When a subscription is modified with proration enabled, and the invoice for the current term is in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). 2. `refundable`: Refundable credit notes allow you to return a certain amount to the customer. These credits can be: \* Retained for automatic application on future invoices. \* Applied to existing unpaid invoices. \* Refunded to the customer. Refundable credit notes are automatically created in the following cases: \* When an invoice is refunded. \* When a subscription is changed or canceled with proration enabled, the invoice for the current term is in the `paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Refundable credits are applied to future invoices or can be refunded to the original payment method. 3. `store`: Store credit notes are created for `paid` or `partially_paid` invoice [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status) during subscription changes, such as upgrades, downgrades, or cancellations. Key characteristics of store credits: \* No tax component is included at the time of creation. \* A credit note document is generated, similar to refundable credits. \* Store credits are applied before tax calculations on future invoices. **Note:** If you have enabled *consolidated invoicing* , to know the subscriptions attached with a credit note you have to refer [line\_item's](https://docs.corsair.dev/docs/api/credit_notes/credit_note-object#line_items) *subscription\_id* . The credit note's *subscription\_id* should **not** be used (which will be *null* if the credit note has lines from multiple subscriptions). Impact on reference invoice The following updates are made to the reference invoice when a credit note is created/imported: \* If the credit note `type` is `adjustment`: \* The adjustment credit note details are added to the `adjustment_credit_notes[]` attribute of the invoice. \* The invoice `amount_due` is reduced by the credit note `total`. \* The invoice `status` is updated to `paid` if the invoice `amount_due` equals the credit note `total`. \* The invoice `status` does not change if the invoice `amount_due` is greater than credit note `total`. \* If the credit note `type` is `refundable`: \* The refundable credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. \* If the credit note `type` is `store`: \* The store credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. |

> [accordion] credit\_note full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   reference_invoice_id?: string | null,
>   type?: string | null,
>   reason_code?: string | null,
>   status?: string | null,
>   vat_number?: string | null,
>   date?: number | null,
>   price_type?: string | null,
>   currency_code?: string | null,
>   total?: number | null,
>   amount_allocated?: number | null,
>   amount_refunded?: number | null,
>   amount_available?: number | null,
>   refunded_at?: number | null,
>   voided_at?: number | null,
>   generated_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   channel?: string | null,
>   line_items_next_offset?: string | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total_in_local_currency?: number | null,
>   local_currency_code?: string | null,
>   round_off_amount?: number | null,
>   fractional_correction?: number | null,
>   notes?: string[] | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   local_currency_exchange_rate?: number | null,
>   create_reason_code?: string | null,
>   vat_number_prefix?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_refunds?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     refund_reason_code?: string | null
>   }[] | null,
>   linked_tax_withheld_refunds?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   allocations?: {
>     invoice_id?: string | null,
>     allocated_amount?: number | null,
>     allocated_at?: number | null,
>     invoice_date?: number | null,
>     invoice_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### getPdf

`creditNotes.getPdf`

Retrieve credit note as PDF. Gets the credit note as PDF. The returned URL is secure and allows download. The URL will expire in 60 minutes.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.creditNotes.getPdf({ creditNoteId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `creditNoteId` | `string` | Yes | — |
| `disposition_type` | `attachment \| inline` | No | Determines the pdf should be rendered as inline or attachment in the browser. \* attachment - PDF is rendered as attachment in the browser \* inline - PDF is rendered as inline in the browser |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `download` | `object \| null` | No | Requesting to download a file through this API will return the `download_url` attribute as the response. This attribute will contain a URL that will allow the requested content to be downloaded. |

> [accordion] download full type
>
> ```ts theme={null}
> {
>   download_url?: string | null,
>   valid_till?: number | null,
>   mime_type?: string | null
> } | null
> ```

***

### import

`creditNotes.import`

Import credit note. Imports a credit note into Chargebee Billing. This endpoint allows you to import a credit note from external systems, such as accounting software, into Chargebee. Use this operation during data migration or reconciliation to ensure historical credits are represented in the system.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.creditNotes.import({
	create_reason_code: 'example',
	date: 1,
	id: 'cust_8gsnbYfsMLds',
	reference_invoice_id: 'example',
	type: 'adjustment',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `id` | `string` | Yes | The unique identifier for the credit note (credit note number). **Constraints** \* Must not conflict with existing credit note numbers in your Chargebee Billing site. \* Must not conflict with future credit note numbers that your Chargebee Billing site may [generate](https://www.chargebee.com/docs/billing/2.0/invoices-credit-notes-and-quotes/invoice-numbering). |
| `customer_id` | `string` | No | The unique identifier of the customer for whom the credit note is created. **Required if** \* `subscription_id` is not provided. **Constraints** \* Must match the [customer](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_customer_id) of the `reference_invoice_id`. |
| `subscription_id` | `string` | No | The unique identifier of the subscription for which this credit note is created. **Required if** \* `customer_id` is not provided. **Constraints** \* Must match the [subscription](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_subscription_id) of the `reference_invoice_id`. \* Must not be provided if `line_items[subscription_id][]` is provided. |
| `reference_invoice_id` | `string` | Yes | The unique identifier of the invoice against which this credit note is issued. The invoice must already exist in your Chargebee Billing site. |
| `type` | `adjustment \| refundable \| store` | Yes | The credit note type. Determines how the credit note can be used. [Learn more](https://docs.corsair.dev/docs/api/credit_notes/credit-note-object#credit_note_types) about credit note types. \* refundable - Refundable credit note. \* store - Store credit note. **Constraints** \* The `type` value `store` is not supported for this API operation. \* adjustment - Adjustment credit note. |
| `currency_code` | `string` | No | The currency code ([ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) format) for the credit note. **Required if** \* [Multi-currency pricing](https://www.chargebee.com/docs/billing/2.0/site-configuration/multi-currency-pricing) is enabled for the site and `customer_id` is provided. |
| `create_reason_code` | `string` | Yes | The [reason code](https://www.chargebee.com/docs/billing/2.0/site-configuration/reason-codes#managing-reason-codes-for-credit-notes) for creating the credit note. **Required if** \* Reason codes are mandatory in Chargebee Billing. **Constraints** \* Must be a valid and enabled reason code from the list configured in Chargebee Billing. \* The reason code can also be from **Refund Credit Note** reason codes. \* The codes are case-sensitive. |
| `date` | `number` | Yes | The date when the credit note was issued. **Constraints** \* Must be a date in the past. \* Must be after the [`date`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_date) of the reference invoice. |
| `customer_notes` | `string` | No | — |
| `status` | `adjusted \| refunded \| refund_due \| voided` | No | The status of the credit note. Determines the current state of the credit note and how it can be used. **Default value** \* `adjusted` if `type` is `adjustment`. \* if `type` is `refundable`: \* `refunded` if the credit note `total` is equal to the sum of `linked_refunds[amount][]` plus the sum of `allocations[allocated_amount][]`. \* `refund_due` otherwise. \* refund\_due - The credits are yet to be used or have been partially used. **Constraints** \* Must only be set when `type` is `refundable`. \* The credit note `total` must be greater than the sum of `linked_refunds[amount][]` plus the sum of `allocations[allocated_amount][]`. \* refunded - The entire credit note amount has been used (either allocated to invoices or refunded). **Constraints** \* Must only be set when `type` is `refundable`. \* Requires `linked_refunds[]` and/or `allocations[]` to be provided. \* The sum of `linked_refunds[amount][]` plus the sum of `allocations[allocated_amount][]` must equal the credit note `total`. \* voided - The credit note has been cancelled. **Constraints** \* `linked_refunds[]` and `allocations[]` must not be provided when `status` is `voided`. \* adjusted - The credit note has been adjusted against an invoice. **Constraints** \* Must only be set when `type` is `adjustment`. \* Requires `allocations[]` to be provided and `linked_refunds[]` must not be provided. |
| `total` | `number` | No | The total amount of the credit note. **Constraints** \* For refundable credit notes (`type` = `refundable`), this must be less than or equal to the reference invoice's [refundable amount](https://docs.corsair.dev/docs/api/invoices/invoice-object#refundable-amount). \* For adjustment credit notes (`type` = `adjustment`), this must be less than or equal to the reference invoice's [`amount_to_collect`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_to_collect). |
| `refunded_at` | `number` | No | The timestamp when this credit note was fully used (refunded or allocated). This field is automatically set when the credit note `status` becomes `refunded` or `adjusted`. |
| `voided_at` | `number` | No | The timestamp indicating when this credit note was voided. **Constraints** \* `status` must be `voided`. **Default value** \* The credit note `date`. |
| `sub_total` | `number` | No | The credit note sub-total (total before round-off, fractional correction, and taxes). |
| `round_off_amount` | `number` | No | The rounded-off amount for the credit note. For example, if the credit note amount is $99.99 and it is rounded off to $100.00, then \$0.01 is the `round_off_amount`. **Constraints** \* Not supported for zero-decimal [currencies](https://docs.corsair.dev/docs/api/currencies). |
| `fractional_correction` | `number` | No | Indicates the fractional correction amount. |
| `vat_number_prefix` | `string` | No | 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](https://docs.corsair.dev/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](https://docs.corsair.dev/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. |
| `line_items` | `object` | No | Parameters for line items. At least one line item is required. |
| `line_item_tiers` | `object` | No | Parameters for line item tiers. Used to specify tiered pricing details for line items with `tiered`, `volume`, or `stairstep` pricing models. |
| `discounts` | `object` | No | Parameters for discounts. Used to specify discounts, coupons, or promotional credits applied to the credit note at the document level or item level. |
| `taxes` | `object` | No | Parameters for document-level taxes. Used to specify tax information at the credit note level. **Prerequisite** \* `taxes[]` must not be provided if the reference invoice has **all** line items exempted from tax for any one of the following reasons: `customer_exempt`, `reverse_charge`, or `export` (i.e. if all [`line_items[].tax_exempt_reason`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_line_items) on the reference invoice are set to `customer_exempt`, `reverse_charge`, or `export`). |
| `allocations` | `object` | No | Parameters for credit allocations. Used to specify how the credit note amount is allocated to invoices. **Required if** \* `status` is `adjusted`. **Constraints** \* For adjustment credit notes (`type` = `adjustment`), only one allocation is allowed. \* Must not be provided if `status` is `voided`. |
| `linked_refunds` | `object` | No | Parameters for linked refunds. Used to record refund transactions associated with this credit note. **Required if** \* `status` is `refunded` and no `allocations[]` are provided. **Constraints** \* Must not be provided if `status` is `adjusted` or `voided`. |

> [accordion] line\_items full type
>
> ```ts theme={null}
> {
>   reference_line_item_id?: string[],
>   id?: string[],
>   date_from?: number[],
>   date_to?: number[],
>   subscription_id?: string[],
>   description: string[],
>   unit_amount?: number[],
>   quantity?: number[],
>   amount?: number[],
>   unit_amount_in_decimal?: string[],
>   quantity_in_decimal?: string[],
>   amount_in_decimal?: string[],
>   entity_type?: (adhoc | plan_item_price | addon_item_price | charge_item_price)[],
>   entity_id?: string[],
>   item_level_discount1_entity_id?: string[],
>   item_level_discount1_amount?: number[],
>   item_level_discount2_entity_id?: string[],
>   item_level_discount2_amount?: number[],
>   tax1_name?: string[],
>   tax1_amount?: number[],
>   tax2_name?: string[],
>   tax2_amount?: number[],
>   tax3_name?: string[],
>   tax3_amount?: number[],
>   tax4_name?: string[],
>   tax4_amount?: number[],
>   tax5_name?: string[],
>   tax5_amount?: number[],
>   tax6_name?: string[],
>   tax6_amount?: number[],
>   tax7_name?: string[],
>   tax7_amount?: number[],
>   tax8_name?: string[],
>   tax8_amount?: number[],
>   tax9_name?: string[],
>   tax9_amount?: number[],
>   tax10_name?: string[],
>   tax10_amount?: number[],
>   is_partial_tax_applied?: boolean[],
>   taxable_amount?: number[],
>   proration_mode?: (reset | delta | service_period_revision | adjusted_term)[]
> }
> ```

> [accordion] line\_item\_tiers full type
>
> ```ts theme={null}
> {
>   line_item_id: string[],
>   starting_unit?: number[],
>   ending_unit?: number[],
>   quantity_used?: number[],
>   unit_amount?: number[],
>   starting_unit_in_decimal?: string[],
>   ending_unit_in_decimal?: string[],
>   quantity_used_in_decimal?: string[],
>   unit_amount_in_decimal?: string[]
> }
> ```

> [accordion] discounts full type
>
> ```ts theme={null}
> {
>   line_item_id?: string[],
>   entity_type: (item_level_coupon | document_level_coupon | promotional_credits | item_level_discount | document_level_discount)[],
>   entity_id?: string[],
>   description?: string[],
>   amount: number[]
> }
> ```

> [accordion] taxes full type
>
> ```ts theme={null}
> {
>   name: string[],
>   rate: number[],
>   amount?: number[],
>   description?: string[],
>   juris_type?: (country | federal | state | county | city | special | unincorporated | other)[],
>   juris_name?: string[],
>   juris_code?: string[]
> }
> ```

> [accordion] allocations full type
>
> ```ts theme={null}
> {
>   invoice_id: string[],
>   allocated_amount: number[],
>   allocated_at: number[]
> }
> ```

> [accordion] linked\_refunds full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   amount: number[],
>   payment_method: (cash | check | bank_transfer | other | custom)[],
>   date: number[],
>   reference_number?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `credit_note` | `object \| null` | No | A [Credit Note](https://www.chargebee.com/docs/credit-notes.html) is a document that specifies the money owed by a business to its customer. The seller usually issues a Credit Note for the same or lower amount than the invoice, and then repays the money to the customer or set it off against other 'due' invoices. ### Credit Note Types Credit notes in Chargebee are categorized into three types: 1. `adjustment`: Adjustment credit notes are used to adjust the amount of an existing invoice in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Use this type of credit note to reduce the invoice amount, typically as a discount to the customer. Adjustment credit notes are automatically created in the following cases: \* When an invoice is written off. \* When a subscription is modified with proration enabled, and the invoice for the current term is in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). 2. `refundable`: Refundable credit notes allow you to return a certain amount to the customer. These credits can be: \* Retained for automatic application on future invoices. \* Applied to existing unpaid invoices. \* Refunded to the customer. Refundable credit notes are automatically created in the following cases: \* When an invoice is refunded. \* When a subscription is changed or canceled with proration enabled, the invoice for the current term is in the `paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Refundable credits are applied to future invoices or can be refunded to the original payment method. 3. `store`: Store credit notes are created for `paid` or `partially_paid` invoice [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status) during subscription changes, such as upgrades, downgrades, or cancellations. Key characteristics of store credits: \* No tax component is included at the time of creation. \* A credit note document is generated, similar to refundable credits. \* Store credits are applied before tax calculations on future invoices. **Note:** If you have enabled *consolidated invoicing* , to know the subscriptions attached with a credit note you have to refer [line\_item's](https://docs.corsair.dev/docs/api/credit_notes/credit_note-object#line_items) *subscription\_id* . The credit note's *subscription\_id* should **not** be used (which will be *null* if the credit note has lines from multiple subscriptions). Impact on reference invoice The following updates are made to the reference invoice when a credit note is created/imported: \* If the credit note `type` is `adjustment`: \* The adjustment credit note details are added to the `adjustment_credit_notes[]` attribute of the invoice. \* The invoice `amount_due` is reduced by the credit note `total`. \* The invoice `status` is updated to `paid` if the invoice `amount_due` equals the credit note `total`. \* The invoice `status` does not change if the invoice `amount_due` is greater than credit note `total`. \* If the credit note `type` is `refundable`: \* The refundable credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. \* If the credit note `type` is `store`: \* The store credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. |

> [accordion] credit\_note full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   reference_invoice_id?: string | null,
>   type?: string | null,
>   reason_code?: string | null,
>   status?: string | null,
>   vat_number?: string | null,
>   date?: number | null,
>   price_type?: string | null,
>   currency_code?: string | null,
>   total?: number | null,
>   amount_allocated?: number | null,
>   amount_refunded?: number | null,
>   amount_available?: number | null,
>   refunded_at?: number | null,
>   voided_at?: number | null,
>   generated_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   channel?: string | null,
>   line_items_next_offset?: string | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total_in_local_currency?: number | null,
>   local_currency_code?: string | null,
>   round_off_amount?: number | null,
>   fractional_correction?: number | null,
>   notes?: string[] | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   local_currency_exchange_rate?: number | null,
>   create_reason_code?: string | null,
>   vat_number_prefix?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_refunds?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     refund_reason_code?: string | null
>   }[] | null,
>   linked_tax_withheld_refunds?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   allocations?: {
>     invoice_id?: string | null,
>     allocated_amount?: number | null,
>     allocated_at?: number | null,
>     invoice_date?: number | null,
>     invoice_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### list

`creditNotes.list`

List credit notes. Lists all the Credit Notes.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.creditNotes.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `include_deleted` | `boolean` | No | If set to true, includes the deleted resources in the response. For the deleted resources in the response, the '**deleted** ' attribute will be '**true** '. |
| `id` | `object` | No | optional, string filter Credit-note id. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *id\\\[is\\] = "CN\_123"* |
| `customer_id` | `object` | No | optional, string filter The identifier of the customer this Credit Note belongs to. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *customer\_id\\\[is\\] = "4gmiXbsjdm"* |
| `subscription_id` | `object` | No | optional, string filter To filter based on subscription\_id. NOTE: Not to be used if *consolidated invoicing* feature is enabled. **Supported operators :** is, is\_not, starts\_with, is\_present, in, not\_in **Example →** *subscription\_id\\\[is\\] = "4gmiXbsjdm"* |
| `reference_invoice_id` | `object` | No | optional, string filter The identifier of the invoice against which this Credit Note is issued. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *reference\_invoice\_id\\\[is\\] = "INVOICE\_876"* |
| `type` | `object` | No | optional, enumerated string filter The credit note type. Possible values are : adjustment, refundable. **Supported operators :** is, is\_not, in, not\_in **Example →** *type\\\[is\_not\\] = "adjustment"* |
| `reason_code` | `object` | No | optional, enumerated string filter The reason for issuing this Credit Note. The following reason codes are supported now\\\[Deprecated; use the [create\_reason\_code](https://docs.corsair.dev/docs/api/credit_notes/credit_note-object#create_reason_code) parameter instead\\]. Possible values are : write\_off, subscription\_change, subscription\_cancellation, subscription\_pause, chargeback, product\_unsatisfactory, service\_unsatisfactory, order\_change, order\_cancellation, waiver, other, fraudulent. **Supported operators :** is, is\_not, in, not\_in **Example →** *reason\_code\\\[is\\] = "waiver"* |
| `create_reason_code` | `object` | No | optional, string filter Reason code for creating the credit note. Must be one from a list of reason codes set in the Chargebee app in **Settings \\> Configure Chargebee \\> Reason Codes \\> Credit Notes \\> Create Credit Note** . Must be passed if set as mandatory in the app. The codes are case-sensitive. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *create\_reason\_code\\\[is\\] = "Other"* |
| `status` | `object` | No | optional, enumerated string filter The credit note status. Possible values are : adjusted, refunded, refund\_due, voided. **Supported operators :** is, is\_not, in, not\_in **Example →** *status\\\[is\\] = "adjusted"* |
| `date` | `object` | No | optional, timestamp(UTC) in seconds filter The date the Credit Note is issued. **Supported operators :** after, before, on, between **Example →** *date\\\[on\\] = "1435054328"* |
| `total` | `object` | No | optional, in cents filter Credit Note amount in cents. **Supported operators :** is, is\_not, lt, lte, gt, gte, between **Example →** *total\\\[is\\] = "1200"* |
| `price_type` | `object` | No | optional, enumerated string filter The price type of the Credit Note. Possible values are : tax\_exclusive, tax\_inclusive. **Supported operators :** is, is\_not, in, not\_in **Example →** *price\_type\\\[is\_not\\] = "tax\_exclusive"* |
| `amount_allocated` | `object` | No | optional, in cents filter The amount allocated to the invoices. **Supported operators :** is, is\_not, lt, lte, gt, gte, between **Example →** *amount\_allocated\\\[is\\] = "1200"* |
| `amount_refunded` | `object` | No | optional, in cents filter The refunds issued from this Credit Note. **Supported operators :** is, is\_not, lt, lte, gt, gte, between **Example →** *amount\_refunded\\\[lte\\] = "130"* |
| `amount_available` | `object` | No | optional, in cents filter The yet to be used credits of this Credit Note. **Supported operators :** is, is\_not, lt, lte, gt, gte, between **Example →** *amount\_available\\\[gt\\] = "1400"* |
| `voided_at` | `object` | No | optional, timestamp(UTC) in seconds filter Timestamp indicating the date and time this Credit Note gets voided. **Supported operators :** after, before, on, between **Example →** *voided\_at\\\[before\\] = "1435054328"* |
| `updated_at` | `object` | No | optional, timestamp(UTC) in seconds filter To filter based on updated at. This attribute will be present only if the resource has been updated after 2016-09-28. **Supported operators :** after, before, on, between **Example →** *updated\_at\\\[on\\] = "1243545465"* |
| `sort_by` | `object` | No | optional, string filter Sorts based on the specified attribute. **Supported attributes :** date **Supported sort-orders :** asc, desc **Example →** *sort\_by\\\[asc\\] = "date"* This will sort the result based on the 'date' attribute in ascending(earliest first) order. |
| `channel` | `object` | No | optional, enumerated string filter The subscription channel this object originated from and is maintained in. Possible values are : web, app\_store, play\_store. **Supported operators :** is, is\_not, in, not\_in **Example →** *channel\\\[is\\] = "APP STORE"* |
| `einvoice` | `object` | No | Parameters for einvoice |

> [accordion] id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] customer\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] subscription\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   is_present?: true | false,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] reference\_invoice\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   is_present?: true | false,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] type full type
>
> ```ts theme={null}
> {
>   is?: adjustment | refundable | store,
>   is_not?: adjustment | refundable | store,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] reason\_code full type
>
> ```ts theme={null}
> {
>   is?: write_off | subscription_change | subscription_cancellation | subscription_pause | chargeback | product_unsatisfactory | service_unsatisfactory | order_change | order_cancellation | waiver | other | fraudulent,
>   is_not?: write_off | subscription_change | subscription_cancellation | subscription_pause | chargeback | product_unsatisfactory | service_unsatisfactory | order_change | order_cancellation | waiver | other | fraudulent,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] create\_reason\_code full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] status full type
>
> ```ts theme={null}
> {
>   is?: adjusted | refunded | refund_due | voided,
>   is_not?: adjusted | refunded | refund_due | voided,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] date full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] total full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   lt?: string,
>   lte?: string,
>   gt?: string,
>   gte?: string,
>   between?: string
> }
> ```

> [accordion] price\_type full type
>
> ```ts theme={null}
> {
>   is?: tax_exclusive | tax_inclusive,
>   is_not?: tax_exclusive | tax_inclusive,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] amount\_allocated full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   lt?: string,
>   lte?: string,
>   gt?: string,
>   gte?: string,
>   between?: string
> }
> ```

> [accordion] amount\_refunded full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   lt?: string,
>   lte?: string,
>   gt?: string,
>   gte?: string,
>   between?: string
> }
> ```

> [accordion] amount\_available full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   lt?: string,
>   lte?: string,
>   gt?: string,
>   gte?: string,
>   between?: string
> }
> ```

> [accordion] voided\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] updated\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] sort\_by full type
>
> ```ts theme={null}
> {
>   asc?: date,
>   desc?: date
> }
> ```

> [accordion] channel full type
>
> ```ts theme={null}
> {
>   is?: web | app_store | play_store,
>   is_not?: web | app_store | play_store,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] einvoice full type
>
> ```ts theme={null}
> {
>   status?: {
>     is?: scheduled | skipped | in_progress | success | failed | registered | accepted | rejected | message_acknowledgement | in_process | under_query | conditionally_accepted | paid,
>     is_not?: scheduled | skipped | in_progress | success | failed | registered | accepted | rejected | message_acknowledgement | in_process | under_query | conditionally_accepted | paid,
>     in?: string,
>     not_in?: string
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   credit_note?: {
>     id?: string | null,
>     customer_id?: string | null,
>     subscription_id?: string | null,
>     reference_invoice_id?: string | null,
>     type?: string | null,
>     reason_code?: string | null,
>     status?: string | null,
>     vat_number?: string | null,
>     date?: number | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     total?: number | null,
>     amount_allocated?: number | null,
>     amount_refunded?: number | null,
>     amount_available?: number | null,
>     refunded_at?: number | null,
>     voided_at?: number | null,
>     generated_at?: number | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     channel?: string | null,
>     line_items_next_offset?: string | null,
>     sub_total?: number | null,
>     sub_total_in_local_currency?: number | null,
>     total_in_local_currency?: number | null,
>     local_currency_code?: string | null,
>     round_off_amount?: number | null,
>     fractional_correction?: number | null,
>     notes?: string[] | null,
>     deleted?: boolean | null,
>     tax_category?: string | null,
>     local_currency_exchange_rate?: number | null,
>     create_reason_code?: string | null,
>     vat_number_prefix?: string | null,
>     business_entity_id?: string | null,
>     brand_id?: string | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     tax_origin?: {
>       country?: string | null,
>       registration_number?: string | null
>     } | null,
>     linked_refunds?: {
>       txn_id?: string | null,
>       applied_amount?: number | null,
>       applied_at?: number | null,
>       txn_status?: string | null,
>       txn_date?: number | null,
>       txn_amount?: number | null,
>       refund_reason_code?: string | null
>     }[] | null,
>     linked_tax_withheld_refunds?: {
>       id?: string | null,
>       amount?: number | null,
>       description?: string | null,
>       date?: number | null,
>       reference_number?: string | null
>     }[] | null,
>     allocations?: {
>       invoice_id?: string | null,
>       allocated_amount?: number | null,
>       allocated_at?: number | null,
>       invoice_date?: number | null,
>       invoice_status?: string | null,
>       tax_application?: string | null
>     }[] | null,
>     exchange_rates?: {
>       currency_code?: string | null,
>       rate?: number | null
>     }[] | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     billing_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     einvoice?: {
>       id?: string | null,
>       reference_id?: string | null,
>       reference_number?: string | null,
>       status?: string | null,
>       message?: string | null,
>       provider_references?: any[] | null
>     } | null,
>     site_details_at_creation?: {
>       timezone?: string | null,
>       organization_address?: {
>       } | null
>     } | null
>   } | null
> }[] | null
> ```

***

### recordRefund

`creditNotes.recordRefund`

Record refund for a credit note. Records a refund for a refundable credit note. This API does not process an actual refund for online payments by returning money to customers.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.creditNotes.recordRefund({ creditNoteId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `creditNoteId` | `string` | Yes | — |
| `refund_reason_code` | `string` | No | Reason code for the refund. Must be one from a list of reason codes set in the Chargebee app in **Settings \\> Configure Chargebee \\> Reason Codes \\> Credit Notes \\> Refund Credit Note**. Must be passed if set as mandatory in the app. The codes are case-sensitive. |
| `comment` | `string` | No | Remarks, if any, on the refund. |
| `transaction` | `object` | No | Parameters for transaction |

> [accordion] transaction full type
>
> ```ts theme={null}
> {
>   id?: string,
>   amount?: number,
>   payment_method: cash | check | chargeback | bank_transfer | other | custom,
>   reference_number?: string,
>   custom_payment_method_id?: string,
>   date: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `credit_note` | `object \| null` | No | A [Credit Note](https://www.chargebee.com/docs/credit-notes.html) is a document that specifies the money owed by a business to its customer. The seller usually issues a Credit Note for the same or lower amount than the invoice, and then repays the money to the customer or set it off against other 'due' invoices. ### Credit Note Types Credit notes in Chargebee are categorized into three types: 1. `adjustment`: Adjustment credit notes are used to adjust the amount of an existing invoice in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Use this type of credit note to reduce the invoice amount, typically as a discount to the customer. Adjustment credit notes are automatically created in the following cases: \* When an invoice is written off. \* When a subscription is modified with proration enabled, and the invoice for the current term is in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). 2. `refundable`: Refundable credit notes allow you to return a certain amount to the customer. These credits can be: \* Retained for automatic application on future invoices. \* Applied to existing unpaid invoices. \* Refunded to the customer. Refundable credit notes are automatically created in the following cases: \* When an invoice is refunded. \* When a subscription is changed or canceled with proration enabled, the invoice for the current term is in the `paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Refundable credits are applied to future invoices or can be refunded to the original payment method. 3. `store`: Store credit notes are created for `paid` or `partially_paid` invoice [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status) during subscription changes, such as upgrades, downgrades, or cancellations. Key characteristics of store credits: \* No tax component is included at the time of creation. \* A credit note document is generated, similar to refundable credits. \* Store credits are applied before tax calculations on future invoices. **Note:** If you have enabled *consolidated invoicing* , to know the subscriptions attached with a credit note you have to refer [line\_item's](https://docs.corsair.dev/docs/api/credit_notes/credit_note-object#line_items) *subscription\_id* . The credit note's *subscription\_id* should **not** be used (which will be *null* if the credit note has lines from multiple subscriptions). Impact on reference invoice The following updates are made to the reference invoice when a credit note is created/imported: \* If the credit note `type` is `adjustment`: \* The adjustment credit note details are added to the `adjustment_credit_notes[]` attribute of the invoice. \* The invoice `amount_due` is reduced by the credit note `total`. \* The invoice `status` is updated to `paid` if the invoice `amount_due` equals the credit note `total`. \* The invoice `status` does not change if the invoice `amount_due` is greater than credit note `total`. \* If the credit note `type` is `refundable`: \* The refundable credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. \* If the credit note `type` is `store`: \* The store credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. |
| `transaction` | `object \| null` | No | This resource represents the [transaction](https://www.chargebee.com/docs/transactions.html) event that has happened in your account. |

> [accordion] credit\_note full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   reference_invoice_id?: string | null,
>   type?: string | null,
>   reason_code?: string | null,
>   status?: string | null,
>   vat_number?: string | null,
>   date?: number | null,
>   price_type?: string | null,
>   currency_code?: string | null,
>   total?: number | null,
>   amount_allocated?: number | null,
>   amount_refunded?: number | null,
>   amount_available?: number | null,
>   refunded_at?: number | null,
>   voided_at?: number | null,
>   generated_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   channel?: string | null,
>   line_items_next_offset?: string | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total_in_local_currency?: number | null,
>   local_currency_code?: string | null,
>   round_off_amount?: number | null,
>   fractional_correction?: number | null,
>   notes?: string[] | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   local_currency_exchange_rate?: number | null,
>   create_reason_code?: string | null,
>   vat_number_prefix?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_refunds?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     refund_reason_code?: string | null
>   }[] | null,
>   linked_tax_withheld_refunds?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   allocations?: {
>     invoice_id?: string | null,
>     allocated_amount?: number | null,
>     allocated_at?: number | null,
>     invoice_date?: number | null,
>     invoice_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

> [accordion] transaction full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   gateway_account_id?: string | null,
>   payment_source_id?: string | null,
>   payment_method?: string | null,
>   reference_number?: string | null,
>   gateway?: string | null,
>   type?: string | null,
>   date?: number | null,
>   settled_at?: number | null,
>   exchange_rate?: number | null,
>   currency_code?: string | null,
>   amount?: number | null,
>   id_at_gateway?: string | null,
>   status?: string | null,
>   fraud_flag?: string | null,
>   initiator_type?: string | null,
>   three_d_secure?: boolean | null,
>   authorization_reason?: string | null,
>   error_code?: string | null,
>   error_text?: string | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   fraud_reason?: string | null,
>   custom_payment_method_id?: string | null,
>   amount_unused?: number | null,
>   masked_card_number?: string | null,
>   reference_transaction_id?: string | null,
>   refunded_txn_id?: string | null,
>   reference_authorization_id?: string | null,
>   amount_capturable?: number | null,
>   reversal_transaction_id?: string | null,
>   deleted?: boolean | null,
>   iin?: string | null,
>   last4?: string | null,
>   merchant_reference_id?: string | null,
>   business_entity_id?: string | null,
>   payment_method_details?: string | null,
>   custom_payment_method_name?: string | null,
>   linked_invoices?: {
>     invoice_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     invoice_date?: number | null,
>     invoice_total?: number | null,
>     invoice_status?: string | null
>   }[] | null,
>   linked_credit_notes?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null,
>     cn_reference_invoice_id?: string | null
>   }[] | null,
>   linked_refunds?: {
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   linked_payments?: {
>     id?: string | null,
>     status?: string | null,
>     amount?: number | null,
>     date?: number | null
>   }[] | null,
>   gateway_metadata?: {
>     acquirer_reference_id?: string | null
>   } | null,
>   error_detail?: {
>     request_id?: string | null,
>     error_category?: string | null,
>     error_code?: string | null,
>     error_message?: string | null,
>     decline_code?: string | null,
>     decline_message?: string | null,
>     network_error_code?: string | null,
>     network_error_message?: string | null,
>     error_field?: string | null,
>     recommendation_code?: string | null,
>     recommendation_message?: string | null,
>     processor_error_code?: string | null,
>     processor_error_message?: string | null,
>     error_cause_id?: string | null,
>     processor_advice_code?: string | null
>   } | null,
>   network_transaction_details?: {
>     network_transaction_id?: string | null,
>     original_network_transaction_id?: string | null
>   } | null
> } | null
> ```

***

### refund

`creditNotes.refund`

Refund a credit note. Refunds a specified amount from a refundable credit note back to the customer's payment source. This operation supports only refunds against online payments. The refund amount is returned to the customer through the payment\_source associated with the transaction.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.creditNotes.refund({ creditNoteId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `creditNoteId` | `string` | Yes | — |
| `refund_amount` | `number` | No | The amount to be refunded. **Constraints** \* If multiple [transactions](https://docs.corsair.dev/docs/api/invoices/invoice-object#linked_payments) are associated with the credit note, the refund can be processed only for one transaction at a time. \* Offline refunds, including those for [`linked_taxes_withheld`](https://docs.corsair.dev/docs/api/invoices/invoice-object#linked_taxes_withheld), cannot be refunded via this operation. Use the [Record refund for a credit note](https://docs.corsair.dev/docs/api/credit_notes/refund-a-credit-note) API instead. **Default behavior** \* If not specified, the `amount_available` for this credit note is implied. |
| `customer_notes` | `string` | No | A note to be added for this operation, to the credit note. This note is displayed on customer-facing documents such as the [Credit Note PDF](https://docs.corsair.dev/docs/api/credit_notes/retrieve-credit-note-as-pdf) . |
| `refund_reason_code` | `string` | No | Reason code for the refund. Must be one from a list of reason codes set in the Chargebee app in **Settings \\> Configure Chargebee \\> Reason Codes \\> Credit Notes \\> Refund Credit Note**. Must be passed if set as mandatory in the app. The codes are case-sensitive. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `credit_note` | `object \| null` | No | A [Credit Note](https://www.chargebee.com/docs/credit-notes.html) is a document that specifies the money owed by a business to its customer. The seller usually issues a Credit Note for the same or lower amount than the invoice, and then repays the money to the customer or set it off against other 'due' invoices. ### Credit Note Types Credit notes in Chargebee are categorized into three types: 1. `adjustment`: Adjustment credit notes are used to adjust the amount of an existing invoice in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Use this type of credit note to reduce the invoice amount, typically as a discount to the customer. Adjustment credit notes are automatically created in the following cases: \* When an invoice is written off. \* When a subscription is modified with proration enabled, and the invoice for the current term is in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). 2. `refundable`: Refundable credit notes allow you to return a certain amount to the customer. These credits can be: \* Retained for automatic application on future invoices. \* Applied to existing unpaid invoices. \* Refunded to the customer. Refundable credit notes are automatically created in the following cases: \* When an invoice is refunded. \* When a subscription is changed or canceled with proration enabled, the invoice for the current term is in the `paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Refundable credits are applied to future invoices or can be refunded to the original payment method. 3. `store`: Store credit notes are created for `paid` or `partially_paid` invoice [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status) during subscription changes, such as upgrades, downgrades, or cancellations. Key characteristics of store credits: \* No tax component is included at the time of creation. \* A credit note document is generated, similar to refundable credits. \* Store credits are applied before tax calculations on future invoices. **Note:** If you have enabled *consolidated invoicing* , to know the subscriptions attached with a credit note you have to refer [line\_item's](https://docs.corsair.dev/docs/api/credit_notes/credit_note-object#line_items) *subscription\_id* . The credit note's *subscription\_id* should **not** be used (which will be *null* if the credit note has lines from multiple subscriptions). Impact on reference invoice The following updates are made to the reference invoice when a credit note is created/imported: \* If the credit note `type` is `adjustment`: \* The adjustment credit note details are added to the `adjustment_credit_notes[]` attribute of the invoice. \* The invoice `amount_due` is reduced by the credit note `total`. \* The invoice `status` is updated to `paid` if the invoice `amount_due` equals the credit note `total`. \* The invoice `status` does not change if the invoice `amount_due` is greater than credit note `total`. \* If the credit note `type` is `refundable`: \* The refundable credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. \* If the credit note `type` is `store`: \* The store credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. |
| `transaction` | `object \| null` | No | This resource represents the [transaction](https://www.chargebee.com/docs/transactions.html) event that has happened in your account. |

> [accordion] credit\_note full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   reference_invoice_id?: string | null,
>   type?: string | null,
>   reason_code?: string | null,
>   status?: string | null,
>   vat_number?: string | null,
>   date?: number | null,
>   price_type?: string | null,
>   currency_code?: string | null,
>   total?: number | null,
>   amount_allocated?: number | null,
>   amount_refunded?: number | null,
>   amount_available?: number | null,
>   refunded_at?: number | null,
>   voided_at?: number | null,
>   generated_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   channel?: string | null,
>   line_items_next_offset?: string | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total_in_local_currency?: number | null,
>   local_currency_code?: string | null,
>   round_off_amount?: number | null,
>   fractional_correction?: number | null,
>   notes?: string[] | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   local_currency_exchange_rate?: number | null,
>   create_reason_code?: string | null,
>   vat_number_prefix?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_refunds?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     refund_reason_code?: string | null
>   }[] | null,
>   linked_tax_withheld_refunds?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   allocations?: {
>     invoice_id?: string | null,
>     allocated_amount?: number | null,
>     allocated_at?: number | null,
>     invoice_date?: number | null,
>     invoice_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

> [accordion] transaction full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   gateway_account_id?: string | null,
>   payment_source_id?: string | null,
>   payment_method?: string | null,
>   reference_number?: string | null,
>   gateway?: string | null,
>   type?: string | null,
>   date?: number | null,
>   settled_at?: number | null,
>   exchange_rate?: number | null,
>   currency_code?: string | null,
>   amount?: number | null,
>   id_at_gateway?: string | null,
>   status?: string | null,
>   fraud_flag?: string | null,
>   initiator_type?: string | null,
>   three_d_secure?: boolean | null,
>   authorization_reason?: string | null,
>   error_code?: string | null,
>   error_text?: string | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   fraud_reason?: string | null,
>   custom_payment_method_id?: string | null,
>   amount_unused?: number | null,
>   masked_card_number?: string | null,
>   reference_transaction_id?: string | null,
>   refunded_txn_id?: string | null,
>   reference_authorization_id?: string | null,
>   amount_capturable?: number | null,
>   reversal_transaction_id?: string | null,
>   deleted?: boolean | null,
>   iin?: string | null,
>   last4?: string | null,
>   merchant_reference_id?: string | null,
>   business_entity_id?: string | null,
>   payment_method_details?: string | null,
>   custom_payment_method_name?: string | null,
>   linked_invoices?: {
>     invoice_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     invoice_date?: number | null,
>     invoice_total?: number | null,
>     invoice_status?: string | null
>   }[] | null,
>   linked_credit_notes?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null,
>     cn_reference_invoice_id?: string | null
>   }[] | null,
>   linked_refunds?: {
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   linked_payments?: {
>     id?: string | null,
>     status?: string | null,
>     amount?: number | null,
>     date?: number | null
>   }[] | null,
>   gateway_metadata?: {
>     acquirer_reference_id?: string | null
>   } | null,
>   error_detail?: {
>     request_id?: string | null,
>     error_category?: string | null,
>     error_code?: string | null,
>     error_message?: string | null,
>     decline_code?: string | null,
>     decline_message?: string | null,
>     network_error_code?: string | null,
>     network_error_message?: string | null,
>     error_field?: string | null,
>     recommendation_code?: string | null,
>     recommendation_message?: string | null,
>     processor_error_code?: string | null,
>     processor_error_message?: string | null,
>     error_cause_id?: string | null,
>     processor_advice_code?: string | null
>   } | null,
>   network_transaction_details?: {
>     network_transaction_id?: string | null,
>     original_network_transaction_id?: string | null
>   } | null
> } | null
> ```

***

### removeTaxWithheldRefund

`creditNotes.removeTaxWithheldRefund`

Remove tax withheld refunds from a credit note. Removes a linked\_tax\_withheld\_refunds record from the credit\_note .

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.creditNotes.removeTaxWithheldRefund({ creditNoteId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `creditNoteId` | `string` | Yes | — |
| `tax_withheld` | `object` | No | Parameters for tax\_withheld |

> [accordion] tax\_withheld full type
>
> ```ts theme={null}
> {
>   id: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `credit_note` | `object \| null` | No | A [Credit Note](https://www.chargebee.com/docs/credit-notes.html) is a document that specifies the money owed by a business to its customer. The seller usually issues a Credit Note for the same or lower amount than the invoice, and then repays the money to the customer or set it off against other 'due' invoices. ### Credit Note Types Credit notes in Chargebee are categorized into three types: 1. `adjustment`: Adjustment credit notes are used to adjust the amount of an existing invoice in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Use this type of credit note to reduce the invoice amount, typically as a discount to the customer. Adjustment credit notes are automatically created in the following cases: \* When an invoice is written off. \* When a subscription is modified with proration enabled, and the invoice for the current term is in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). 2. `refundable`: Refundable credit notes allow you to return a certain amount to the customer. These credits can be: \* Retained for automatic application on future invoices. \* Applied to existing unpaid invoices. \* Refunded to the customer. Refundable credit notes are automatically created in the following cases: \* When an invoice is refunded. \* When a subscription is changed or canceled with proration enabled, the invoice for the current term is in the `paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Refundable credits are applied to future invoices or can be refunded to the original payment method. 3. `store`: Store credit notes are created for `paid` or `partially_paid` invoice [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status) during subscription changes, such as upgrades, downgrades, or cancellations. Key characteristics of store credits: \* No tax component is included at the time of creation. \* A credit note document is generated, similar to refundable credits. \* Store credits are applied before tax calculations on future invoices. **Note:** If you have enabled *consolidated invoicing* , to know the subscriptions attached with a credit note you have to refer [line\_item's](https://docs.corsair.dev/docs/api/credit_notes/credit_note-object#line_items) *subscription\_id* . The credit note's *subscription\_id* should **not** be used (which will be *null* if the credit note has lines from multiple subscriptions). Impact on reference invoice The following updates are made to the reference invoice when a credit note is created/imported: \* If the credit note `type` is `adjustment`: \* The adjustment credit note details are added to the `adjustment_credit_notes[]` attribute of the invoice. \* The invoice `amount_due` is reduced by the credit note `total`. \* The invoice `status` is updated to `paid` if the invoice `amount_due` equals the credit note `total`. \* The invoice `status` does not change if the invoice `amount_due` is greater than credit note `total`. \* If the credit note `type` is `refundable`: \* The refundable credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. \* If the credit note `type` is `store`: \* The store credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. |

> [accordion] credit\_note full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   reference_invoice_id?: string | null,
>   type?: string | null,
>   reason_code?: string | null,
>   status?: string | null,
>   vat_number?: string | null,
>   date?: number | null,
>   price_type?: string | null,
>   currency_code?: string | null,
>   total?: number | null,
>   amount_allocated?: number | null,
>   amount_refunded?: number | null,
>   amount_available?: number | null,
>   refunded_at?: number | null,
>   voided_at?: number | null,
>   generated_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   channel?: string | null,
>   line_items_next_offset?: string | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total_in_local_currency?: number | null,
>   local_currency_code?: string | null,
>   round_off_amount?: number | null,
>   fractional_correction?: number | null,
>   notes?: string[] | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   local_currency_exchange_rate?: number | null,
>   create_reason_code?: string | null,
>   vat_number_prefix?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_refunds?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     refund_reason_code?: string | null
>   }[] | null,
>   linked_tax_withheld_refunds?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   allocations?: {
>     invoice_id?: string | null,
>     allocated_amount?: number | null,
>     allocated_at?: number | null,
>     invoice_date?: number | null,
>     invoice_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### resendEinvoice

`creditNotes.resendEinvoice`

Resend failed einvoice in credit notes. (POST /credit\_notes/\{credit-note-id}/resend\_einvoice)

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.creditNotes.resendEinvoice({ creditNoteId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `creditNoteId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `credit_note` | `object \| null` | No | A [Credit Note](https://www.chargebee.com/docs/credit-notes.html) is a document that specifies the money owed by a business to its customer. The seller usually issues a Credit Note for the same or lower amount than the invoice, and then repays the money to the customer or set it off against other 'due' invoices. ### Credit Note Types Credit notes in Chargebee are categorized into three types: 1. `adjustment`: Adjustment credit notes are used to adjust the amount of an existing invoice in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Use this type of credit note to reduce the invoice amount, typically as a discount to the customer. Adjustment credit notes are automatically created in the following cases: \* When an invoice is written off. \* When a subscription is modified with proration enabled, and the invoice for the current term is in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). 2. `refundable`: Refundable credit notes allow you to return a certain amount to the customer. These credits can be: \* Retained for automatic application on future invoices. \* Applied to existing unpaid invoices. \* Refunded to the customer. Refundable credit notes are automatically created in the following cases: \* When an invoice is refunded. \* When a subscription is changed or canceled with proration enabled, the invoice for the current term is in the `paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Refundable credits are applied to future invoices or can be refunded to the original payment method. 3. `store`: Store credit notes are created for `paid` or `partially_paid` invoice [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status) during subscription changes, such as upgrades, downgrades, or cancellations. Key characteristics of store credits: \* No tax component is included at the time of creation. \* A credit note document is generated, similar to refundable credits. \* Store credits are applied before tax calculations on future invoices. **Note:** If you have enabled *consolidated invoicing* , to know the subscriptions attached with a credit note you have to refer [line\_item's](https://docs.corsair.dev/docs/api/credit_notes/credit_note-object#line_items) *subscription\_id* . The credit note's *subscription\_id* should **not** be used (which will be *null* if the credit note has lines from multiple subscriptions). Impact on reference invoice The following updates are made to the reference invoice when a credit note is created/imported: \* If the credit note `type` is `adjustment`: \* The adjustment credit note details are added to the `adjustment_credit_notes[]` attribute of the invoice. \* The invoice `amount_due` is reduced by the credit note `total`. \* The invoice `status` is updated to `paid` if the invoice `amount_due` equals the credit note `total`. \* The invoice `status` does not change if the invoice `amount_due` is greater than credit note `total`. \* If the credit note `type` is `refundable`: \* The refundable credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. \* If the credit note `type` is `store`: \* The store credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. |

> [accordion] credit\_note full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   reference_invoice_id?: string | null,
>   type?: string | null,
>   reason_code?: string | null,
>   status?: string | null,
>   vat_number?: string | null,
>   date?: number | null,
>   price_type?: string | null,
>   currency_code?: string | null,
>   total?: number | null,
>   amount_allocated?: number | null,
>   amount_refunded?: number | null,
>   amount_available?: number | null,
>   refunded_at?: number | null,
>   voided_at?: number | null,
>   generated_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   channel?: string | null,
>   line_items_next_offset?: string | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total_in_local_currency?: number | null,
>   local_currency_code?: string | null,
>   round_off_amount?: number | null,
>   fractional_correction?: number | null,
>   notes?: string[] | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   local_currency_exchange_rate?: number | null,
>   create_reason_code?: string | null,
>   vat_number_prefix?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_refunds?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     refund_reason_code?: string | null
>   }[] | null,
>   linked_tax_withheld_refunds?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   allocations?: {
>     invoice_id?: string | null,
>     allocated_amount?: number | null,
>     allocated_at?: number | null,
>     invoice_date?: number | null,
>     invoice_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### sendEinvoice

`creditNotes.sendEinvoice`

Send an einvoice for credit notes. This endpoint is used to send an e-invoice for invoice. To support cases like TDS and invoice edits, we need to stop auto e-invoice sending and be able to send e-invoices manually. This endpoint schedules e-invoices manually.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.creditNotes.sendEinvoice({ creditNoteId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `creditNoteId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `credit_note` | `object \| null` | No | A [Credit Note](https://www.chargebee.com/docs/credit-notes.html) is a document that specifies the money owed by a business to its customer. The seller usually issues a Credit Note for the same or lower amount than the invoice, and then repays the money to the customer or set it off against other 'due' invoices. ### Credit Note Types Credit notes in Chargebee are categorized into three types: 1. `adjustment`: Adjustment credit notes are used to adjust the amount of an existing invoice in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Use this type of credit note to reduce the invoice amount, typically as a discount to the customer. Adjustment credit notes are automatically created in the following cases: \* When an invoice is written off. \* When a subscription is modified with proration enabled, and the invoice for the current term is in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). 2. `refundable`: Refundable credit notes allow you to return a certain amount to the customer. These credits can be: \* Retained for automatic application on future invoices. \* Applied to existing unpaid invoices. \* Refunded to the customer. Refundable credit notes are automatically created in the following cases: \* When an invoice is refunded. \* When a subscription is changed or canceled with proration enabled, the invoice for the current term is in the `paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Refundable credits are applied to future invoices or can be refunded to the original payment method. 3. `store`: Store credit notes are created for `paid` or `partially_paid` invoice [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status) during subscription changes, such as upgrades, downgrades, or cancellations. Key characteristics of store credits: \* No tax component is included at the time of creation. \* A credit note document is generated, similar to refundable credits. \* Store credits are applied before tax calculations on future invoices. **Note:** If you have enabled *consolidated invoicing* , to know the subscriptions attached with a credit note you have to refer [line\_item's](https://docs.corsair.dev/docs/api/credit_notes/credit_note-object#line_items) *subscription\_id* . The credit note's *subscription\_id* should **not** be used (which will be *null* if the credit note has lines from multiple subscriptions). Impact on reference invoice The following updates are made to the reference invoice when a credit note is created/imported: \* If the credit note `type` is `adjustment`: \* The adjustment credit note details are added to the `adjustment_credit_notes[]` attribute of the invoice. \* The invoice `amount_due` is reduced by the credit note `total`. \* The invoice `status` is updated to `paid` if the invoice `amount_due` equals the credit note `total`. \* The invoice `status` does not change if the invoice `amount_due` is greater than credit note `total`. \* If the credit note `type` is `refundable`: \* The refundable credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. \* If the credit note `type` is `store`: \* The store credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. |

> [accordion] credit\_note full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   reference_invoice_id?: string | null,
>   type?: string | null,
>   reason_code?: string | null,
>   status?: string | null,
>   vat_number?: string | null,
>   date?: number | null,
>   price_type?: string | null,
>   currency_code?: string | null,
>   total?: number | null,
>   amount_allocated?: number | null,
>   amount_refunded?: number | null,
>   amount_available?: number | null,
>   refunded_at?: number | null,
>   voided_at?: number | null,
>   generated_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   channel?: string | null,
>   line_items_next_offset?: string | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total_in_local_currency?: number | null,
>   local_currency_code?: string | null,
>   round_off_amount?: number | null,
>   fractional_correction?: number | null,
>   notes?: string[] | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   local_currency_exchange_rate?: number | null,
>   create_reason_code?: string | null,
>   vat_number_prefix?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_refunds?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     refund_reason_code?: string | null
>   }[] | null,
>   linked_tax_withheld_refunds?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   allocations?: {
>     invoice_id?: string | null,
>     allocated_amount?: number | null,
>     allocated_at?: number | null,
>     invoice_date?: number | null,
>     invoice_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### sendEmail

`creditNotes.sendEmail`

Send Credit Note Email. Sends the credit note email to the customer using the site's published Send Credit Note Email Engage notification template. Use this operation to resend or manually trigger the credit note email for a customer outside the normal notification schedule. Async-only This operation is asynchronous only.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.creditNotes.sendEmail({ creditNoteId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `prefer` | `string` | No | Must be set to `respond-async`. Instructs Chargebee to process the request asynchronously and return `202 Accepted` immediately. |
| `requestId` | `string` | No | A client-generated unique identifier (UUID recommended) for this request. Echoed back as `request.id` in the async callback payload, allowing you to correlate each callback to its originating request. |
| `asyncCallbackUrl` | `string` | No | The callback URL where Chargebee will `POST` the async result. Must be an `https://` URL and may embed basic-auth credentials, e.g. `https://username:password@example.com`. |
| `creditNoteId` | `string` | Yes | — |

**Output:** `object`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   email_logs?: {
>     id?: string | null,
>     template_name?: string | null,
>     from_address?: string | null,
>     to_address?: string | null,
>     subject?: string | null,
>     status?: string | null,
>     sent_on?: number | null,
>     customer_id?: string | null,
>     email_conversation_id?: string | null,
>     site_id?: string | null,
>     business_entity_id?: string | null,
>     brand_id?: string | null,
>     error_message?: string | null
>   }[] | null
> } | {
>   success: true
> }
> ```

***

### update

`creditNotes.update`

Update Credit Note Details. Updates the custom fields and comment of a credit note. Use this operation to add or change custom field values, or to attach an internal comment, without modifying other credit note attributes. Pass at least one credit note custom field or comment; otherwise the credit note is returned unchanged.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.creditNotes.update({ creditNoteId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `creditNoteId` | `string` | Yes | — |
| `comment` | `string` | No | An internal [comment](https://docs.corsair.dev/docs/api/comments) to be added for this operation, to the credit note. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](https://docs.corsair.dev/docs/api/hosted_pages) or any document such as the [Credit Note PDF](https://docs.corsair.dev/docs/api/credit_notes/retrieve-credit-note-as-pdf) . |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `credit_note` | `object \| null` | No | A [Credit Note](https://www.chargebee.com/docs/credit-notes.html) is a document that specifies the money owed by a business to its customer. The seller usually issues a Credit Note for the same or lower amount than the invoice, and then repays the money to the customer or set it off against other 'due' invoices. ### Credit Note Types Credit notes in Chargebee are categorized into three types: 1. `adjustment`: Adjustment credit notes are used to adjust the amount of an existing invoice in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Use this type of credit note to reduce the invoice amount, typically as a discount to the customer. Adjustment credit notes are automatically created in the following cases: \* When an invoice is written off. \* When a subscription is modified with proration enabled, and the invoice for the current term is in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). 2. `refundable`: Refundable credit notes allow you to return a certain amount to the customer. These credits can be: \* Retained for automatic application on future invoices. \* Applied to existing unpaid invoices. \* Refunded to the customer. Refundable credit notes are automatically created in the following cases: \* When an invoice is refunded. \* When a subscription is changed or canceled with proration enabled, the invoice for the current term is in the `paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Refundable credits are applied to future invoices or can be refunded to the original payment method. 3. `store`: Store credit notes are created for `paid` or `partially_paid` invoice [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status) during subscription changes, such as upgrades, downgrades, or cancellations. Key characteristics of store credits: \* No tax component is included at the time of creation. \* A credit note document is generated, similar to refundable credits. \* Store credits are applied before tax calculations on future invoices. **Note:** If you have enabled *consolidated invoicing* , to know the subscriptions attached with a credit note you have to refer [line\_item's](https://docs.corsair.dev/docs/api/credit_notes/credit_note-object#line_items) *subscription\_id* . The credit note's *subscription\_id* should **not** be used (which will be *null* if the credit note has lines from multiple subscriptions). Impact on reference invoice The following updates are made to the reference invoice when a credit note is created/imported: \* If the credit note `type` is `adjustment`: \* The adjustment credit note details are added to the `adjustment_credit_notes[]` attribute of the invoice. \* The invoice `amount_due` is reduced by the credit note `total`. \* The invoice `status` is updated to `paid` if the invoice `amount_due` equals the credit note `total`. \* The invoice `status` does not change if the invoice `amount_due` is greater than credit note `total`. \* If the credit note `type` is `refundable`: \* The refundable credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. \* If the credit note `type` is `store`: \* The store credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. |

> [accordion] credit\_note full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   reference_invoice_id?: string | null,
>   type?: string | null,
>   reason_code?: string | null,
>   status?: string | null,
>   vat_number?: string | null,
>   date?: number | null,
>   price_type?: string | null,
>   currency_code?: string | null,
>   total?: number | null,
>   amount_allocated?: number | null,
>   amount_refunded?: number | null,
>   amount_available?: number | null,
>   refunded_at?: number | null,
>   voided_at?: number | null,
>   generated_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   channel?: string | null,
>   line_items_next_offset?: string | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total_in_local_currency?: number | null,
>   local_currency_code?: string | null,
>   round_off_amount?: number | null,
>   fractional_correction?: number | null,
>   notes?: string[] | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   local_currency_exchange_rate?: number | null,
>   create_reason_code?: string | null,
>   vat_number_prefix?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_refunds?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     refund_reason_code?: string | null
>   }[] | null,
>   linked_tax_withheld_refunds?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   allocations?: {
>     invoice_id?: string | null,
>     allocated_amount?: number | null,
>     allocated_at?: number | null,
>     invoice_date?: number | null,
>     invoice_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### void

`creditNotes.void`

Void a credit note. Void or invalidate the specified credit note. Use this operation for incorrectly generated credit notes, such as those with wrong details or created by mistake.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.creditNotes.void({ creditNoteId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `creditNoteId` | `string` | Yes | — |
| `comment` | `string` | No | An internal [comment](https://docs.corsair.dev/docs/api/comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](https://docs.corsair.dev/docs/api/hosted_pages) or any document such as the [Invoice PDF](https://docs.corsair.dev/docs/api/invoices/retrieve-invoice-as-pdf) . |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `credit_note` | `object \| null` | No | A [Credit Note](https://www.chargebee.com/docs/credit-notes.html) is a document that specifies the money owed by a business to its customer. The seller usually issues a Credit Note for the same or lower amount than the invoice, and then repays the money to the customer or set it off against other 'due' invoices. ### Credit Note Types Credit notes in Chargebee are categorized into three types: 1. `adjustment`: Adjustment credit notes are used to adjust the amount of an existing invoice in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Use this type of credit note to reduce the invoice amount, typically as a discount to the customer. Adjustment credit notes are automatically created in the following cases: \* When an invoice is written off. \* When a subscription is modified with proration enabled, and the invoice for the current term is in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). 2. `refundable`: Refundable credit notes allow you to return a certain amount to the customer. These credits can be: \* Retained for automatic application on future invoices. \* Applied to existing unpaid invoices. \* Refunded to the customer. Refundable credit notes are automatically created in the following cases: \* When an invoice is refunded. \* When a subscription is changed or canceled with proration enabled, the invoice for the current term is in the `paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Refundable credits are applied to future invoices or can be refunded to the original payment method. 3. `store`: Store credit notes are created for `paid` or `partially_paid` invoice [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status) during subscription changes, such as upgrades, downgrades, or cancellations. Key characteristics of store credits: \* No tax component is included at the time of creation. \* A credit note document is generated, similar to refundable credits. \* Store credits are applied before tax calculations on future invoices. **Note:** If you have enabled *consolidated invoicing* , to know the subscriptions attached with a credit note you have to refer [line\_item's](https://docs.corsair.dev/docs/api/credit_notes/credit_note-object#line_items) *subscription\_id* . The credit note's *subscription\_id* should **not** be used (which will be *null* if the credit note has lines from multiple subscriptions). Impact on reference invoice The following updates are made to the reference invoice when a credit note is created/imported: \* If the credit note `type` is `adjustment`: \* The adjustment credit note details are added to the `adjustment_credit_notes[]` attribute of the invoice. \* The invoice `amount_due` is reduced by the credit note `total`. \* The invoice `status` is updated to `paid` if the invoice `amount_due` equals the credit note `total`. \* The invoice `status` does not change if the invoice `amount_due` is greater than credit note `total`. \* If the credit note `type` is `refundable`: \* The refundable credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. \* If the credit note `type` is `store`: \* The store credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. |

> [accordion] credit\_note full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   reference_invoice_id?: string | null,
>   type?: string | null,
>   reason_code?: string | null,
>   status?: string | null,
>   vat_number?: string | null,
>   date?: number | null,
>   price_type?: string | null,
>   currency_code?: string | null,
>   total?: number | null,
>   amount_allocated?: number | null,
>   amount_refunded?: number | null,
>   amount_available?: number | null,
>   refunded_at?: number | null,
>   voided_at?: number | null,
>   generated_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   channel?: string | null,
>   line_items_next_offset?: string | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total_in_local_currency?: number | null,
>   local_currency_code?: string | null,
>   round_off_amount?: number | null,
>   fractional_correction?: number | null,
>   notes?: string[] | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   local_currency_exchange_rate?: number | null,
>   create_reason_code?: string | null,
>   vat_number_prefix?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_refunds?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     refund_reason_code?: string | null
>   }[] | null,
>   linked_tax_withheld_refunds?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   allocations?: {
>     invoice_id?: string | null,
>     allocated_amount?: number | null,
>     allocated_at?: number | null,
>     invoice_date?: number | null,
>     invoice_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

## Credit Units

### archive

`creditUnits.archive`

Archive a credit unit. Archives an active credit unit. Once archived, the credit unit can no longer be used to create grant configurations for items and grant configuration overrides for subscriptions. Any grants that were already configured for this credit unit will continue to be effective.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.creditUnits.archive({ creditUnitId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `creditUnitId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `credit_unit` | `object \| null` | No | Credit units power credit-based billing for usage-based products, letting you get paid upfront while customers spend credits as they use your product's features. Each credit unit is a customizable consumption unit, such as AI credits or API calls, that you define beyond Chargebee's built-in pricing dimensions. When should you use credit units? --------------------------------- Credit units are a good fit when: \* Customers have widely varying usage patterns \* Business costs scale with consumption \* Upfront cash flow is preferred How does it work? ----------------- 1. Create a credit unit (say, "AI Credits") 2. Configure credit grants on your plans (e.g., a Pro Plan priced at \$20 USD includes 100 AI Credits) 3. Track customer usage in real time 4. Bill for actual consumption **What happens when credits are exhausted?** Once the provisioned credits are exhausted, further consumption draws from the overdraft balance up to its configured limit. Configure overdraft behavior for a credit unit using [**is\_unlimited**](#is_unlimited) and [**overdraft\_amount**](#overdraft_amount), so customers can continue consuming, purchase more, or pay for overage depending on your setup. |

> [accordion] credit\_unit full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   external_name?: string | null,
>   status?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   created_by?: string | null,
>   updated_by?: string | null,
>   is_unlimited?: boolean | null,
>   overdraft_amount?: string | null
> } | null
> ```

***

### create

`creditUnits.create`

Create a credit unit. Creates a new credit unit in the active status.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.creditUnits.create({ id: 'cust_8gsnbYfsMLds', is_unlimited: true, name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `id` | `string` | Yes | Unique identifier for the credit unit. Must be unique across the site. |
| `name` | `string` | Yes | Internal display name for the credit unit. Must be unique across the site. |
| `is_unlimited` | `boolean` | Yes | Indicates whether the credit unit allows unlimited overdraft consumption. When `true`, grace consumption continues without a cap after the allocated grants are exhausted. When `false`, provide `overdraft_amount` to cap the grace consumption. |
| `overdraft_amount` | `string` | No | The amount up to which grace consumption is allowed after the allocated grants are exhausted. A non-negative decimal value that applies only when `is_unlimited` is `false`; zero is accepted. |
| `external_name` | `string` | No | Customer-facing display name for the credit unit. Must be unique across the site. Defaults to `name` when omitted. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `credit_unit` | `object \| null` | No | Credit units power credit-based billing for usage-based products, letting you get paid upfront while customers spend credits as they use your product's features. Each credit unit is a customizable consumption unit, such as AI credits or API calls, that you define beyond Chargebee's built-in pricing dimensions. When should you use credit units? --------------------------------- Credit units are a good fit when: \* Customers have widely varying usage patterns \* Business costs scale with consumption \* Upfront cash flow is preferred How does it work? ----------------- 1. Create a credit unit (say, "AI Credits") 2. Configure credit grants on your plans (e.g., a Pro Plan priced at \$20 USD includes 100 AI Credits) 3. Track customer usage in real time 4. Bill for actual consumption **What happens when credits are exhausted?** Once the provisioned credits are exhausted, further consumption draws from the overdraft balance up to its configured limit. Configure overdraft behavior for a credit unit using [**is\_unlimited**](#is_unlimited) and [**overdraft\_amount**](#overdraft_amount), so customers can continue consuming, purchase more, or pay for overage depending on your setup. |

> [accordion] credit\_unit full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   external_name?: string | null,
>   status?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   created_by?: string | null,
>   updated_by?: string | null,
>   is_unlimited?: boolean | null,
>   overdraft_amount?: string | null
> } | null
> ```

***

### list

`creditUnits.list`

List credit units. Retrieves a paginated list of credit units meeting all the conditions specified in the filter parameters.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.creditUnits.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `status` | `object` | No | optional, enumerated string filter The current lifecycle status of the credit unit. Possible values are : active, archived. **Supported operators :** is, in **Example →** *status\\\[is\\] = "active"* |
| `id` | `object` | No | optional, string filter The unique identifier of the credit unit. **Supported operators :** is, in **Example →** *id\\\[is\\] = "ai\_tokens\_001"* |

> [accordion] status full type
>
> ```ts theme={null}
> {
>   is?: active | archived,
>   in?: string
> }
> ```

> [accordion] id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   in?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   credit_unit?: {
>     id?: string | null,
>     name?: string | null,
>     external_name?: string | null,
>     status?: string | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     created_at?: number | null,
>     created_by?: string | null,
>     updated_by?: string | null,
>     is_unlimited?: boolean | null,
>     overdraft_amount?: string | null
>   } | null
> }[] | null
> ```

***

### reactivate

`creditUnits.reactivate`

Reactivate a credit unit. Reactivates an archived credit unit. Once reactivated, the credit unit can be used to configure grants for plans, add-ons, and charges, as well as grant configuration overrides for subscriptions.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.creditUnits.reactivate({ creditUnitId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `creditUnitId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `credit_unit` | `object \| null` | No | Credit units power credit-based billing for usage-based products, letting you get paid upfront while customers spend credits as they use your product's features. Each credit unit is a customizable consumption unit, such as AI credits or API calls, that you define beyond Chargebee's built-in pricing dimensions. When should you use credit units? --------------------------------- Credit units are a good fit when: \* Customers have widely varying usage patterns \* Business costs scale with consumption \* Upfront cash flow is preferred How does it work? ----------------- 1. Create a credit unit (say, "AI Credits") 2. Configure credit grants on your plans (e.g., a Pro Plan priced at \$20 USD includes 100 AI Credits) 3. Track customer usage in real time 4. Bill for actual consumption **What happens when credits are exhausted?** Once the provisioned credits are exhausted, further consumption draws from the overdraft balance up to its configured limit. Configure overdraft behavior for a credit unit using [**is\_unlimited**](#is_unlimited) and [**overdraft\_amount**](#overdraft_amount), so customers can continue consuming, purchase more, or pay for overage depending on your setup. |

> [accordion] credit\_unit full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   external_name?: string | null,
>   status?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   created_by?: string | null,
>   updated_by?: string | null,
>   is_unlimited?: boolean | null,
>   overdraft_amount?: string | null
> } | null
> ```

***

### update

`creditUnits.update`

Update a credit unit. Updates an existing credit unit.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.creditUnits.update({ creditUnitId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `creditUnitId` | `string` | Yes | — |
| `name` | `string` | No | Updated internal display name for the credit unit. Must be unique across the site. |
| `external_name` | `string` | No | Updated customer-facing display name for the credit unit. Must be unique across the site. At least one of `name` or `external_name` should be provided. Only credit units with the `active` status can be updated. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `credit_unit` | `object \| null` | No | Credit units power credit-based billing for usage-based products, letting you get paid upfront while customers spend credits as they use your product's features. Each credit unit is a customizable consumption unit, such as AI credits or API calls, that you define beyond Chargebee's built-in pricing dimensions. When should you use credit units? --------------------------------- Credit units are a good fit when: \* Customers have widely varying usage patterns \* Business costs scale with consumption \* Upfront cash flow is preferred How does it work? ----------------- 1. Create a credit unit (say, "AI Credits") 2. Configure credit grants on your plans (e.g., a Pro Plan priced at \$20 USD includes 100 AI Credits) 3. Track customer usage in real time 4. Bill for actual consumption **What happens when credits are exhausted?** Once the provisioned credits are exhausted, further consumption draws from the overdraft balance up to its configured limit. Configure overdraft behavior for a credit unit using [**is\_unlimited**](#is_unlimited) and [**overdraft\_amount**](#overdraft_amount), so customers can continue consuming, purchase more, or pay for overage depending on your setup. |

> [accordion] credit\_unit full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   external_name?: string | null,
>   status?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   created_by?: string | null,
>   updated_by?: string | null,
>   is_unlimited?: boolean | null,
>   overdraft_amount?: string | null
> } | null
> ```

***

## Csv Tax Rules

### create

`csvTaxRules.create`

Taxes Csv import. (POST /csv\_tax\_rules)

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.csvTaxRules.create({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `tax_profile_name` | `string` | No | — |
| `country` | `string` | No | — |
| `state` | `string` | No | — |
| `zip_code` | `string` | No | — |
| `zip_code_start` | `number` | No | — |
| `zip_code_end` | `number` | No | — |
| `tax1_name` | `string` | No | — |
| `tax1_rate` | `number` | No | — |
| `tax1_juris_type` | `country \| federal \| state \| county \| city \| special \| unincorporated \| other` | No | — |
| `tax1_juris_name` | `string` | No | — |
| `tax1_juris_code` | `string` | No | — |
| `tax2_name` | `string` | No | — |
| `tax2_rate` | `number` | No | — |
| `tax2_juris_type` | `country \| federal \| state \| county \| city \| special \| unincorporated \| other` | No | — |
| `tax2_juris_name` | `string` | No | — |
| `tax2_juris_code` | `string` | No | — |
| `tax3_name` | `string` | No | — |
| `tax3_rate` | `number` | No | — |
| `tax3_juris_type` | `country \| federal \| state \| county \| city \| special \| unincorporated \| other` | No | — |
| `tax3_juris_name` | `string` | No | — |
| `tax3_juris_code` | `string` | No | — |
| `tax4_name` | `string` | No | — |
| `tax4_rate` | `number` | No | — |
| `tax4_juris_type` | `country \| federal \| state \| county \| city \| special \| unincorporated \| other` | No | — |
| `tax4_juris_name` | `string` | No | — |
| `tax4_juris_code` | `string` | No | — |
| `service_type` | `digital \| other \| not_applicable` | No | — |
| `time_zone` | `string` | No | — |
| `valid_from` | `number` | No | — |
| `valid_till` | `number` | No | — |
| `overwrite` | `boolean` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `csv_tax_rule` | `object \| null` | No | — |

> [accordion] csv\_tax\_rule full type
>
> ```ts theme={null}
> {
>   tax_profile_name?: string | null,
>   country?: string | null,
>   state?: string | null,
>   zip_code?: string | null,
>   zip_code_start?: number | null,
>   zip_code_end?: number | null,
>   tax1_name?: string | null,
>   tax1_rate?: number | null,
>   tax1_juris_type?: string | null,
>   tax1_juris_name?: string | null,
>   tax1_juris_code?: string | null,
>   tax2_name?: string | null,
>   tax2_rate?: number | null,
>   tax2_juris_type?: string | null,
>   tax2_juris_name?: string | null,
>   tax2_juris_code?: string | null,
>   tax3_name?: string | null,
>   tax3_rate?: number | null,
>   tax3_juris_type?: string | null,
>   tax3_juris_name?: string | null,
>   tax3_juris_code?: string | null,
>   tax4_name?: string | null,
>   tax4_rate?: number | null,
>   tax4_juris_type?: string | null,
>   tax4_juris_name?: string | null,
>   tax4_juris_code?: string | null,
>   status?: string | null,
>   time_zone?: string | null,
>   valid_from?: number | null,
>   valid_till?: number | null,
>   service_type?: string | null,
>   rule_weight?: number | null,
>   overwrite?: boolean | null
> } | null
> ```

***

## Currencies

### addSchedule

`currencies.addSchedule`

Add schedule. This API is used to schedule exchange rate modification for a manual forex\_type currency.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.currencies.addSchedule({ siteCurrencyId: 'example', manual_exchange_rate: 'example', schedule_at: 1 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `siteCurrencyId` | `string` | Yes | — |
| `manual_exchange_rate` | `string` | Yes | This parameter allows you to pass the exchange rate in decimal format. When `forex_type` is `manual` you have to set the exchange rate for additional currencies in `manual_exchange_rate` parameter. A maximum of **nine** decimal values are allowed to pass in this field. |
| `schedule_at` | `number` | Yes | Timestamp at which the exchange rate scheduled has to be updated in your site. This timestamp must be a future date. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `scheduled_at` | `number \| null` | No | Timestamp at which the scheduled exchange rate is to be updated on your site. |
| `currency` | `object \| null` | No | Chargebee's Multi-currency feature allows you to create Plans in multiple currencies, enabling your customers to conveniently pay in their preferred local currency. Please review this [documentation](https://www.chargebee.com/docs/2.0/multi-currency-pricing.html) to understand the multi-currency feature in Chargebee. This currency resource contains exchange rate configurations associated with a specific currency. The multi-currency feature must be [enabled](https://www.chargebee.com/docs/2.0/multi-currency-pricing.html#1-adding-and-managing-currencies), and all prerequisites must be addressed to successfully add a new currency via the API. To invoke a single currency-specific API like update, retrieve, and more, the currency ID has to be passed as a path parameter. You can use list API to fetch the IDs of each currency configured in your site to use with the currency-specific APIs below. Chargebee supports billing in over [100 currencies](https://www.chargebee.com/docs/2.0/supported-currencies.html). On this page, you can find information about how currency units are expressed in the API, as well as some pointers to keep in mind when using multiple currencies. Currency values --------------- By default, the Chargebee API supports only whole numbers for currency values. To allow for fractional (decimal) values, you must enable the [multi-decimal pricing](https://www.chargebee.com/docs/2.0/multi-decimal-support.html) feature. Additionally, the units in which currencies are expressed in the API depend on whether the currency is zero-decimal and whether multi-decimal pricing is enabled. ### Whole number currency values By default, Chargebee supports currency values in whole numbers; fractions are not supported. In the API, currency values can be identified by checking their data types. For all whole number currency values in this API, the data type is indicated as "in cents" in this documentation. The specific unit used for the currency in the API depends on whether it is a zero-decimal currency: \* **Zero-decimal currencies** : For currencies that do not have decimal subunits, such as the Japanese Yen (JPY), the amount must be provided in the major unit of the currency. The major unit of a currency is the unit represented by its [ISO 4217 code](https://www.iso.org/iso-4217-currency-codes.html). For example, to specify an amount of JPY 15, set the amount as `15`. \* **Other currencies** : For currencies that are not zero-decimal, Chargebee supports values up to two decimal places in the major unit of the currency. This value with two decimal places must be converted to an integer by multiplying it by 100. For example, $1.53 should be provided as 1.53 x 100, which is `153`. ### Fractional currency values When [multi-decimal pricing](https://www.chargebee.com/docs/multi-decimal-support.html#configuring-multi-decimal-support) is enabled in Chargebee, you can work with fractional currency values using dedicated API parameters and attributes of the `String` type. Usually, these attributes and parameters have the suffix `_in_decimal` in their names. The value is expressed in the major unit of the currency, which is the unit represented by its [ISO 4217 code](https://www.iso.org/iso-4217-currency-codes.html). For example, $1.6782 should be provided as `1.6782`. The maximum number of decimal places supported by the API can be [configured](https://www.chargebee.com/docs/multi-decimal-support.html#configuring-multi-decimal-support) in the admin console. **Note:** For **zero-decimal currencies**, such as the Japanese Yen (JPY), decimal places are not allowed. #### Rounding of invoice line item amounts While Chargebee supports multiple decimal places for currency values, at the [invoice line item](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items_amount) -level, the `amount` attribute is always rounded off to two decimal places in the major unit of the currency. The major unit of a currency is the unit represented by its [ISO 4217 code](https://www.iso.org/iso-4217-currency-codes.html) . The rounding logic used is [ROUND\_HALF\_EVEN](https://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html#ROUND_HALF_EVEN) . For example, if the [quantity](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items_quantity) is 0.0765 and [unit\_amount](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items_unit_amount) is $10.674, the line item [amount](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items_amount) is (0.0765 x $10.674) = $0.816561 and is rounded off to $0.82. Multi-currency support ---------------------- By default, Chargebee is able to process transactions in only one currency. However, you can enable the [multi-currency](https://www.chargebee.com/docs/2.0/multi-currency-pricing.html) feature to support more currencies. The first currency enabled in Chargebee also becomes the "base currency" by default. If you have multiple currencies enabled and want to change the base currency for your site, reach out to [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) for assistance. **Warning** For some API endpoints, the `currency_code` parameter becomes *required* when the multi-currency feature is enabled. Before enabling the feature for your site, ensure that you update your code to provide the `currency_code` parameter when calling the endpoints listed in the next section. ### List of affected endpoints The following endpoints require the `currency_code` parameter to be passed when the multi-currency feature has been enabled. \* Customer-related endpoints \* [Add promotional credits for a customer](https://docs.corsair.dev/docs/api/promotional_credits/add-promotional-credits) \* [Deduct promotional credits from a customer](https://docs.corsair.dev/docs/api/promotional_credits/deduct-promotional-credits) \* [Set promotional credits for a customer](https://docs.corsair.dev/docs/api/promotional_credits/set-promotional-credits) \* [Record an excess payment for a customer](https://docs.corsair.dev/docs/api/customers/record-an-excess-payment-for-a-customer) \* Invoice-related endpoints \* [Create an invoice](https://docs.corsair.dev/docs/api/invoices/create-invoice-for-items-and-one-time-charges) \* Product catalog-related endpoints \* [Create an item price](https://docs.corsair.dev/docs/api/item_prices/create-an-item-price) \* [Create a coupon](https://docs.corsair.dev/docs/api/coupons/create-a-coupon-for-items) |

> [accordion] currency full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   enabled?: boolean | null,
>   forex_type?: string | null,
>   currency_code?: string | null,
>   is_base_currency?: boolean | null,
>   manual_exchange_rate?: string | null
> } | null
> ```

***

### create

`currencies.create`

Add a new currency. This API is used to add a new currency to your Chargebee site. Prior to using this API, ensure that the multi-currency feature is enabled. If the forex\_type is set to manual , you can specify the manual\_exchange\_rate .

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.currencies.create({ currency_code: 'exa', forex_type: 'manual' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `currency_code` | `string` | Yes | A three letter currency code. For example, GBR, INR, and more. |
| `forex_type` | `manual \| auto` | Yes | This represents the exchange rate type set for the currency. \* auto - If `forex_type` is `auto` , conversion rate will be auto updated by Chargebee every day with third party providers (using external currency conversion providers) \* manual - If `forex_type` is `manual` , you will be able to set the conversion rate for the currency. You need to update the exchange rate each time your exchange rate provider changes it |
| `manual_exchange_rate` | `string` | No | This parameter allows you to pass the exchange rate in decimal format. When `forex_type` is `manual` you have to set the exchange rate for additional currencies in `manual_exchange_rate` parameter. A maximum of **nine** decimal values are allowed to pass in this field. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `currency` | `object \| null` | No | Chargebee's Multi-currency feature allows you to create Plans in multiple currencies, enabling your customers to conveniently pay in their preferred local currency. Please review this [documentation](https://www.chargebee.com/docs/2.0/multi-currency-pricing.html) to understand the multi-currency feature in Chargebee. This currency resource contains exchange rate configurations associated with a specific currency. The multi-currency feature must be [enabled](https://www.chargebee.com/docs/2.0/multi-currency-pricing.html#1-adding-and-managing-currencies), and all prerequisites must be addressed to successfully add a new currency via the API. To invoke a single currency-specific API like update, retrieve, and more, the currency ID has to be passed as a path parameter. You can use list API to fetch the IDs of each currency configured in your site to use with the currency-specific APIs below. Chargebee supports billing in over [100 currencies](https://www.chargebee.com/docs/2.0/supported-currencies.html). On this page, you can find information about how currency units are expressed in the API, as well as some pointers to keep in mind when using multiple currencies. Currency values --------------- By default, the Chargebee API supports only whole numbers for currency values. To allow for fractional (decimal) values, you must enable the [multi-decimal pricing](https://www.chargebee.com/docs/2.0/multi-decimal-support.html) feature. Additionally, the units in which currencies are expressed in the API depend on whether the currency is zero-decimal and whether multi-decimal pricing is enabled. ### Whole number currency values By default, Chargebee supports currency values in whole numbers; fractions are not supported. In the API, currency values can be identified by checking their data types. For all whole number currency values in this API, the data type is indicated as "in cents" in this documentation. The specific unit used for the currency in the API depends on whether it is a zero-decimal currency: \* **Zero-decimal currencies** : For currencies that do not have decimal subunits, such as the Japanese Yen (JPY), the amount must be provided in the major unit of the currency. The major unit of a currency is the unit represented by its [ISO 4217 code](https://www.iso.org/iso-4217-currency-codes.html). For example, to specify an amount of JPY 15, set the amount as `15`. \* **Other currencies** : For currencies that are not zero-decimal, Chargebee supports values up to two decimal places in the major unit of the currency. This value with two decimal places must be converted to an integer by multiplying it by 100. For example, $1.53 should be provided as 1.53 x 100, which is `153`. ### Fractional currency values When [multi-decimal pricing](https://www.chargebee.com/docs/multi-decimal-support.html#configuring-multi-decimal-support) is enabled in Chargebee, you can work with fractional currency values using dedicated API parameters and attributes of the `String` type. Usually, these attributes and parameters have the suffix `_in_decimal` in their names. The value is expressed in the major unit of the currency, which is the unit represented by its [ISO 4217 code](https://www.iso.org/iso-4217-currency-codes.html). For example, $1.6782 should be provided as `1.6782`. The maximum number of decimal places supported by the API can be [configured](https://www.chargebee.com/docs/multi-decimal-support.html#configuring-multi-decimal-support) in the admin console. **Note:** For **zero-decimal currencies**, such as the Japanese Yen (JPY), decimal places are not allowed. #### Rounding of invoice line item amounts While Chargebee supports multiple decimal places for currency values, at the [invoice line item](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items_amount) -level, the `amount` attribute is always rounded off to two decimal places in the major unit of the currency. The major unit of a currency is the unit represented by its [ISO 4217 code](https://www.iso.org/iso-4217-currency-codes.html) . The rounding logic used is [ROUND\_HALF\_EVEN](https://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html#ROUND_HALF_EVEN) . For example, if the [quantity](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items_quantity) is 0.0765 and [unit\_amount](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items_unit_amount) is $10.674, the line item [amount](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items_amount) is (0.0765 x $10.674) = $0.816561 and is rounded off to $0.82. Multi-currency support ---------------------- By default, Chargebee is able to process transactions in only one currency. However, you can enable the [multi-currency](https://www.chargebee.com/docs/2.0/multi-currency-pricing.html) feature to support more currencies. The first currency enabled in Chargebee also becomes the "base currency" by default. If you have multiple currencies enabled and want to change the base currency for your site, reach out to [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) for assistance. **Warning** For some API endpoints, the `currency_code` parameter becomes *required* when the multi-currency feature is enabled. Before enabling the feature for your site, ensure that you update your code to provide the `currency_code` parameter when calling the endpoints listed in the next section. ### List of affected endpoints The following endpoints require the `currency_code` parameter to be passed when the multi-currency feature has been enabled. \* Customer-related endpoints \* [Add promotional credits for a customer](https://docs.corsair.dev/docs/api/promotional_credits/add-promotional-credits) \* [Deduct promotional credits from a customer](https://docs.corsair.dev/docs/api/promotional_credits/deduct-promotional-credits) \* [Set promotional credits for a customer](https://docs.corsair.dev/docs/api/promotional_credits/set-promotional-credits) \* [Record an excess payment for a customer](https://docs.corsair.dev/docs/api/customers/record-an-excess-payment-for-a-customer) \* Invoice-related endpoints \* [Create an invoice](https://docs.corsair.dev/docs/api/invoices/create-invoice-for-items-and-one-time-charges) \* Product catalog-related endpoints \* [Create an item price](https://docs.corsair.dev/docs/api/item_prices/create-an-item-price) \* [Create a coupon](https://docs.corsair.dev/docs/api/coupons/create-a-coupon-for-items) |

> [accordion] currency full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   enabled?: boolean | null,
>   forex_type?: string | null,
>   currency_code?: string | null,
>   is_base_currency?: boolean | null,
>   manual_exchange_rate?: string | null
> } | null
> ```

***

### get

`currencies.get`

Retrieve a currency. This API is used to retrieve an individual currency object configured within this site.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.currencies.get({ siteCurrencyId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `siteCurrencyId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `currency` | `object \| null` | No | Chargebee's Multi-currency feature allows you to create Plans in multiple currencies, enabling your customers to conveniently pay in their preferred local currency. Please review this [documentation](https://www.chargebee.com/docs/2.0/multi-currency-pricing.html) to understand the multi-currency feature in Chargebee. This currency resource contains exchange rate configurations associated with a specific currency. The multi-currency feature must be [enabled](https://www.chargebee.com/docs/2.0/multi-currency-pricing.html#1-adding-and-managing-currencies), and all prerequisites must be addressed to successfully add a new currency via the API. To invoke a single currency-specific API like update, retrieve, and more, the currency ID has to be passed as a path parameter. You can use list API to fetch the IDs of each currency configured in your site to use with the currency-specific APIs below. Chargebee supports billing in over [100 currencies](https://www.chargebee.com/docs/2.0/supported-currencies.html). On this page, you can find information about how currency units are expressed in the API, as well as some pointers to keep in mind when using multiple currencies. Currency values --------------- By default, the Chargebee API supports only whole numbers for currency values. To allow for fractional (decimal) values, you must enable the [multi-decimal pricing](https://www.chargebee.com/docs/2.0/multi-decimal-support.html) feature. Additionally, the units in which currencies are expressed in the API depend on whether the currency is zero-decimal and whether multi-decimal pricing is enabled. ### Whole number currency values By default, Chargebee supports currency values in whole numbers; fractions are not supported. In the API, currency values can be identified by checking their data types. For all whole number currency values in this API, the data type is indicated as "in cents" in this documentation. The specific unit used for the currency in the API depends on whether it is a zero-decimal currency: \* **Zero-decimal currencies** : For currencies that do not have decimal subunits, such as the Japanese Yen (JPY), the amount must be provided in the major unit of the currency. The major unit of a currency is the unit represented by its [ISO 4217 code](https://www.iso.org/iso-4217-currency-codes.html). For example, to specify an amount of JPY 15, set the amount as `15`. \* **Other currencies** : For currencies that are not zero-decimal, Chargebee supports values up to two decimal places in the major unit of the currency. This value with two decimal places must be converted to an integer by multiplying it by 100. For example, $1.53 should be provided as 1.53 x 100, which is `153`. ### Fractional currency values When [multi-decimal pricing](https://www.chargebee.com/docs/multi-decimal-support.html#configuring-multi-decimal-support) is enabled in Chargebee, you can work with fractional currency values using dedicated API parameters and attributes of the `String` type. Usually, these attributes and parameters have the suffix `_in_decimal` in their names. The value is expressed in the major unit of the currency, which is the unit represented by its [ISO 4217 code](https://www.iso.org/iso-4217-currency-codes.html). For example, $1.6782 should be provided as `1.6782`. The maximum number of decimal places supported by the API can be [configured](https://www.chargebee.com/docs/multi-decimal-support.html#configuring-multi-decimal-support) in the admin console. **Note:** For **zero-decimal currencies**, such as the Japanese Yen (JPY), decimal places are not allowed. #### Rounding of invoice line item amounts While Chargebee supports multiple decimal places for currency values, at the [invoice line item](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items_amount) -level, the `amount` attribute is always rounded off to two decimal places in the major unit of the currency. The major unit of a currency is the unit represented by its [ISO 4217 code](https://www.iso.org/iso-4217-currency-codes.html) . The rounding logic used is [ROUND\_HALF\_EVEN](https://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html#ROUND_HALF_EVEN) . For example, if the [quantity](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items_quantity) is 0.0765 and [unit\_amount](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items_unit_amount) is $10.674, the line item [amount](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items_amount) is (0.0765 x $10.674) = $0.816561 and is rounded off to $0.82. Multi-currency support ---------------------- By default, Chargebee is able to process transactions in only one currency. However, you can enable the [multi-currency](https://www.chargebee.com/docs/2.0/multi-currency-pricing.html) feature to support more currencies. The first currency enabled in Chargebee also becomes the "base currency" by default. If you have multiple currencies enabled and want to change the base currency for your site, reach out to [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) for assistance. **Warning** For some API endpoints, the `currency_code` parameter becomes *required* when the multi-currency feature is enabled. Before enabling the feature for your site, ensure that you update your code to provide the `currency_code` parameter when calling the endpoints listed in the next section. ### List of affected endpoints The following endpoints require the `currency_code` parameter to be passed when the multi-currency feature has been enabled. \* Customer-related endpoints \* [Add promotional credits for a customer](https://docs.corsair.dev/docs/api/promotional_credits/add-promotional-credits) \* [Deduct promotional credits from a customer](https://docs.corsair.dev/docs/api/promotional_credits/deduct-promotional-credits) \* [Set promotional credits for a customer](https://docs.corsair.dev/docs/api/promotional_credits/set-promotional-credits) \* [Record an excess payment for a customer](https://docs.corsair.dev/docs/api/customers/record-an-excess-payment-for-a-customer) \* Invoice-related endpoints \* [Create an invoice](https://docs.corsair.dev/docs/api/invoices/create-invoice-for-items-and-one-time-charges) \* Product catalog-related endpoints \* [Create an item price](https://docs.corsair.dev/docs/api/item_prices/create-an-item-price) \* [Create a coupon](https://docs.corsair.dev/docs/api/coupons/create-a-coupon-for-items) |

> [accordion] currency full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   enabled?: boolean | null,
>   forex_type?: string | null,
>   currency_code?: string | null,
>   is_base_currency?: boolean | null,
>   manual_exchange_rate?: string | null
> } | null
> ```

***

### getList

`currencies.getList`

List currencies. This API is used to retrieve the list of all currencies currently configured within the site.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.currencies.getList({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   currency?: {
>     id?: string | null,
>     enabled?: boolean | null,
>     forex_type?: string | null,
>     currency_code?: string | null,
>     is_base_currency?: boolean | null,
>     manual_exchange_rate?: string | null
>   } | null
> }[] | null
> ```

***

### removeSchedule

`currencies.removeSchedule`

Remove schedule. This API allows you to remove a scheduled exchange rate from a currency.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.currencies.removeSchedule({ siteCurrencyId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `siteCurrencyId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `scheduled_at` | `number \| null` | No | Timestamp at which the scheduled exchange rate is to be updated on your site. |
| `currency` | `object \| null` | No | Chargebee's Multi-currency feature allows you to create Plans in multiple currencies, enabling your customers to conveniently pay in their preferred local currency. Please review this [documentation](https://www.chargebee.com/docs/2.0/multi-currency-pricing.html) to understand the multi-currency feature in Chargebee. This currency resource contains exchange rate configurations associated with a specific currency. The multi-currency feature must be [enabled](https://www.chargebee.com/docs/2.0/multi-currency-pricing.html#1-adding-and-managing-currencies), and all prerequisites must be addressed to successfully add a new currency via the API. To invoke a single currency-specific API like update, retrieve, and more, the currency ID has to be passed as a path parameter. You can use list API to fetch the IDs of each currency configured in your site to use with the currency-specific APIs below. Chargebee supports billing in over [100 currencies](https://www.chargebee.com/docs/2.0/supported-currencies.html). On this page, you can find information about how currency units are expressed in the API, as well as some pointers to keep in mind when using multiple currencies. Currency values --------------- By default, the Chargebee API supports only whole numbers for currency values. To allow for fractional (decimal) values, you must enable the [multi-decimal pricing](https://www.chargebee.com/docs/2.0/multi-decimal-support.html) feature. Additionally, the units in which currencies are expressed in the API depend on whether the currency is zero-decimal and whether multi-decimal pricing is enabled. ### Whole number currency values By default, Chargebee supports currency values in whole numbers; fractions are not supported. In the API, currency values can be identified by checking their data types. For all whole number currency values in this API, the data type is indicated as "in cents" in this documentation. The specific unit used for the currency in the API depends on whether it is a zero-decimal currency: \* **Zero-decimal currencies** : For currencies that do not have decimal subunits, such as the Japanese Yen (JPY), the amount must be provided in the major unit of the currency. The major unit of a currency is the unit represented by its [ISO 4217 code](https://www.iso.org/iso-4217-currency-codes.html). For example, to specify an amount of JPY 15, set the amount as `15`. \* **Other currencies** : For currencies that are not zero-decimal, Chargebee supports values up to two decimal places in the major unit of the currency. This value with two decimal places must be converted to an integer by multiplying it by 100. For example, $1.53 should be provided as 1.53 x 100, which is `153`. ### Fractional currency values When [multi-decimal pricing](https://www.chargebee.com/docs/multi-decimal-support.html#configuring-multi-decimal-support) is enabled in Chargebee, you can work with fractional currency values using dedicated API parameters and attributes of the `String` type. Usually, these attributes and parameters have the suffix `_in_decimal` in their names. The value is expressed in the major unit of the currency, which is the unit represented by its [ISO 4217 code](https://www.iso.org/iso-4217-currency-codes.html). For example, $1.6782 should be provided as `1.6782`. The maximum number of decimal places supported by the API can be [configured](https://www.chargebee.com/docs/multi-decimal-support.html#configuring-multi-decimal-support) in the admin console. **Note:** For **zero-decimal currencies**, such as the Japanese Yen (JPY), decimal places are not allowed. #### Rounding of invoice line item amounts While Chargebee supports multiple decimal places for currency values, at the [invoice line item](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items_amount) -level, the `amount` attribute is always rounded off to two decimal places in the major unit of the currency. The major unit of a currency is the unit represented by its [ISO 4217 code](https://www.iso.org/iso-4217-currency-codes.html) . The rounding logic used is [ROUND\_HALF\_EVEN](https://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html#ROUND_HALF_EVEN) . For example, if the [quantity](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items_quantity) is 0.0765 and [unit\_amount](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items_unit_amount) is $10.674, the line item [amount](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items_amount) is (0.0765 x $10.674) = $0.816561 and is rounded off to $0.82. Multi-currency support ---------------------- By default, Chargebee is able to process transactions in only one currency. However, you can enable the [multi-currency](https://www.chargebee.com/docs/2.0/multi-currency-pricing.html) feature to support more currencies. The first currency enabled in Chargebee also becomes the "base currency" by default. If you have multiple currencies enabled and want to change the base currency for your site, reach out to [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) for assistance. **Warning** For some API endpoints, the `currency_code` parameter becomes *required* when the multi-currency feature is enabled. Before enabling the feature for your site, ensure that you update your code to provide the `currency_code` parameter when calling the endpoints listed in the next section. ### List of affected endpoints The following endpoints require the `currency_code` parameter to be passed when the multi-currency feature has been enabled. \* Customer-related endpoints \* [Add promotional credits for a customer](https://docs.corsair.dev/docs/api/promotional_credits/add-promotional-credits) \* [Deduct promotional credits from a customer](https://docs.corsair.dev/docs/api/promotional_credits/deduct-promotional-credits) \* [Set promotional credits for a customer](https://docs.corsair.dev/docs/api/promotional_credits/set-promotional-credits) \* [Record an excess payment for a customer](https://docs.corsair.dev/docs/api/customers/record-an-excess-payment-for-a-customer) \* Invoice-related endpoints \* [Create an invoice](https://docs.corsair.dev/docs/api/invoices/create-invoice-for-items-and-one-time-charges) \* Product catalog-related endpoints \* [Create an item price](https://docs.corsair.dev/docs/api/item_prices/create-an-item-price) \* [Create a coupon](https://docs.corsair.dev/docs/api/coupons/create-a-coupon-for-items) |

> [accordion] currency full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   enabled?: boolean | null,
>   forex_type?: string | null,
>   currency_code?: string | null,
>   is_base_currency?: boolean | null,
>   manual_exchange_rate?: string | null
> } | null
> ```

***

### update

`currencies.update`

Update a currency. This API is used to update the configured currencies within your Chargebee site. Additionally, If the forex\_type is set to manual , you can specify the manual\_exchange\_rate .

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.currencies.update({ siteCurrencyId: 'example', forex_type: 'manual' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `siteCurrencyId` | `string` | Yes | — |
| `forex_type` | `manual \| auto` | Yes | This represents the exchange rate type set for the currency. \* auto - If `forex_type` is `auto` , conversion rate will be auto updated by Chargebee every day with third party providers (using external currency conversion providers) \* manual - If `forex_type` is `manual` , you will be able to set the conversion rate for the currency. You need to update the exchange rate each time your exchange rate provider changes it |
| `manual_exchange_rate` | `string` | No | This parameter allows you to pass the exchange rate in decimal format. When `forex_type` is `manual` you have to set the exchange rate for additional currencies in `manual_exchange_rate` parameter. A maximum of **nine** decimal values are allowed to pass in this field. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `currency` | `object \| null` | No | Chargebee's Multi-currency feature allows you to create Plans in multiple currencies, enabling your customers to conveniently pay in their preferred local currency. Please review this [documentation](https://www.chargebee.com/docs/2.0/multi-currency-pricing.html) to understand the multi-currency feature in Chargebee. This currency resource contains exchange rate configurations associated with a specific currency. The multi-currency feature must be [enabled](https://www.chargebee.com/docs/2.0/multi-currency-pricing.html#1-adding-and-managing-currencies), and all prerequisites must be addressed to successfully add a new currency via the API. To invoke a single currency-specific API like update, retrieve, and more, the currency ID has to be passed as a path parameter. You can use list API to fetch the IDs of each currency configured in your site to use with the currency-specific APIs below. Chargebee supports billing in over [100 currencies](https://www.chargebee.com/docs/2.0/supported-currencies.html). On this page, you can find information about how currency units are expressed in the API, as well as some pointers to keep in mind when using multiple currencies. Currency values --------------- By default, the Chargebee API supports only whole numbers for currency values. To allow for fractional (decimal) values, you must enable the [multi-decimal pricing](https://www.chargebee.com/docs/2.0/multi-decimal-support.html) feature. Additionally, the units in which currencies are expressed in the API depend on whether the currency is zero-decimal and whether multi-decimal pricing is enabled. ### Whole number currency values By default, Chargebee supports currency values in whole numbers; fractions are not supported. In the API, currency values can be identified by checking their data types. For all whole number currency values in this API, the data type is indicated as "in cents" in this documentation. The specific unit used for the currency in the API depends on whether it is a zero-decimal currency: \* **Zero-decimal currencies** : For currencies that do not have decimal subunits, such as the Japanese Yen (JPY), the amount must be provided in the major unit of the currency. The major unit of a currency is the unit represented by its [ISO 4217 code](https://www.iso.org/iso-4217-currency-codes.html). For example, to specify an amount of JPY 15, set the amount as `15`. \* **Other currencies** : For currencies that are not zero-decimal, Chargebee supports values up to two decimal places in the major unit of the currency. This value with two decimal places must be converted to an integer by multiplying it by 100. For example, $1.53 should be provided as 1.53 x 100, which is `153`. ### Fractional currency values When [multi-decimal pricing](https://www.chargebee.com/docs/multi-decimal-support.html#configuring-multi-decimal-support) is enabled in Chargebee, you can work with fractional currency values using dedicated API parameters and attributes of the `String` type. Usually, these attributes and parameters have the suffix `_in_decimal` in their names. The value is expressed in the major unit of the currency, which is the unit represented by its [ISO 4217 code](https://www.iso.org/iso-4217-currency-codes.html). For example, $1.6782 should be provided as `1.6782`. The maximum number of decimal places supported by the API can be [configured](https://www.chargebee.com/docs/multi-decimal-support.html#configuring-multi-decimal-support) in the admin console. **Note:** For **zero-decimal currencies**, such as the Japanese Yen (JPY), decimal places are not allowed. #### Rounding of invoice line item amounts While Chargebee supports multiple decimal places for currency values, at the [invoice line item](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items_amount) -level, the `amount` attribute is always rounded off to two decimal places in the major unit of the currency. The major unit of a currency is the unit represented by its [ISO 4217 code](https://www.iso.org/iso-4217-currency-codes.html) . The rounding logic used is [ROUND\_HALF\_EVEN](https://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html#ROUND_HALF_EVEN) . For example, if the [quantity](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items_quantity) is 0.0765 and [unit\_amount](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items_unit_amount) is $10.674, the line item [amount](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items_amount) is (0.0765 x $10.674) = $0.816561 and is rounded off to $0.82. Multi-currency support ---------------------- By default, Chargebee is able to process transactions in only one currency. However, you can enable the [multi-currency](https://www.chargebee.com/docs/2.0/multi-currency-pricing.html) feature to support more currencies. The first currency enabled in Chargebee also becomes the "base currency" by default. If you have multiple currencies enabled and want to change the base currency for your site, reach out to [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) for assistance. **Warning** For some API endpoints, the `currency_code` parameter becomes *required* when the multi-currency feature is enabled. Before enabling the feature for your site, ensure that you update your code to provide the `currency_code` parameter when calling the endpoints listed in the next section. ### List of affected endpoints The following endpoints require the `currency_code` parameter to be passed when the multi-currency feature has been enabled. \* Customer-related endpoints \* [Add promotional credits for a customer](https://docs.corsair.dev/docs/api/promotional_credits/add-promotional-credits) \* [Deduct promotional credits from a customer](https://docs.corsair.dev/docs/api/promotional_credits/deduct-promotional-credits) \* [Set promotional credits for a customer](https://docs.corsair.dev/docs/api/promotional_credits/set-promotional-credits) \* [Record an excess payment for a customer](https://docs.corsair.dev/docs/api/customers/record-an-excess-payment-for-a-customer) \* Invoice-related endpoints \* [Create an invoice](https://docs.corsair.dev/docs/api/invoices/create-invoice-for-items-and-one-time-charges) \* Product catalog-related endpoints \* [Create an item price](https://docs.corsair.dev/docs/api/item_prices/create-an-item-price) \* [Create a coupon](https://docs.corsair.dev/docs/api/coupons/create-a-coupon-for-items) |

> [accordion] currency full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   enabled?: boolean | null,
>   forex_type?: string | null,
>   currency_code?: string | null,
>   is_base_currency?: boolean | null,
>   manual_exchange_rate?: string | null
> } | null
> ```

***

## Customers

### addContact

`customers.addContact`

Add contacts to a customer. Add a contact to a customer resource. ### Prerequisites & Constraints \* The customer must have fewer than 10 contacts already added. ### Impacts Email notifications \* If you set contact\[send\_billing\_email] to true, the contact receives billing emails.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.customers.addContact({ customerId: 'cust_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customerId` | `string` | Yes | — |
| `contact` | `object` | No | Parameters for contact |

> [accordion] contact full type
>
> ```ts theme={null}
> {
>   id?: string,
>   first_name?: string,
>   last_name?: string,
>   email: string,
>   phone?: string,
>   label?: string,
>   enabled?: boolean,
>   send_billing_email?: boolean,
>   send_account_email?: boolean
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] card full type
>
> ```ts theme={null}
> {
>   payment_source_id?: string | null,
>   status?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   ref_tx_id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   iin?: string | null,
>   last4?: string | null,
>   card_type?: string | null,
>   funding_type?: string | null,
>   expiry_month?: number | null,
>   expiry_year?: number | null,
>   issuing_country?: string | null,
>   billing_addr1?: string | null,
>   billing_addr2?: string | null,
>   billing_city?: string | null,
>   billing_state_code?: string | null,
>   billing_state?: string | null,
>   billing_country?: string | null,
>   billing_zip?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   ip_address?: string | null,
>   powered_by?: string | null,
>   customer_id?: string | null,
>   masked_number?: string | null
> } | null
> ```

***

### assignPaymentRole

`customers.assignPaymentRole`

Assign payment role. Assign or unassign the primary or backup payment role for a payment source.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.customers.assignPaymentRole({ customerId: 'cust_8gsnbYfsMLds', payment_source_id: 'example', role: 'primary' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customerId` | `string` | Yes | — |
| `payment_source_id` | `string` | Yes | Payment source id this role will be assigned to. |
| `role` | `primary \| backup \| none` | Yes | Indicates whether the payment source is Primary, Backup, or neither. \* backup - Backup \* none - None \* primary - Primary |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `payment_source` | `object \| null` | No | **Updates** This API obsoletes the [Cards API](https://docs.corsair.dev/docs/api/cards) in Chargebee. Represents the payment source for the customer. Specific types of payment source (Card, Direct Debit, Paypal Express Checkout, etc.) is defined as sub-resource in the response object. You can find the list of supported payment sources and the expected input parameters [here](https://docs.corsair.dev/docs/api/payment_parameters). See [Payment source attributes](https://docs.corsair.dev/docs/api/payment_sources/payment-source-object) for a descriptive list of attributes and payment source types. |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] payment\_source full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   customer_id?: string | null,
>   type?: string | null,
>   reference_id?: string | null,
>   status?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   ip_address?: string | null,
>   issuing_country?: string | null,
>   vault_token?: {
>   } | null,
>   deleted?: boolean | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   card?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     iin?: string | null,
>     last4?: string | null,
>     brand?: string | null,
>     funding_type?: string | null,
>     expiry_month?: number | null,
>     expiry_year?: number | null,
>     billing_addr1?: string | null,
>     billing_addr2?: string | null,
>     billing_city?: string | null,
>     billing_state_code?: string | null,
>     billing_state?: string | null,
>     billing_country?: string | null,
>     billing_zip?: string | null,
>     masked_number?: string | null
>   } | null,
>   bank_account?: {
>     last4?: string | null,
>     name_on_account?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     direct_debit_scheme?: string | null,
>     bank_name?: string | null,
>     mandate_id?: string | null,
>     account_type?: string | null,
>     echeck_type?: string | null,
>     account_holder_type?: string | null,
>     email?: string | null
>   } | null,
>   boleto?: {
>     last4?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   amazon_payment?: {
>     email?: string | null,
>     agreement_id?: string | null
>   } | null,
>   upi?: {
>     vpa?: string | null
>   } | null,
>   paypal?: {
>     email?: string | null,
>     agreement_id?: string | null
>   } | null,
>   venmo?: {
>     user_name?: string | null
>   } | null,
>   klarna_pay_now?: {
>     email?: string | null
>   } | null,
>   mandates?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   network_transaction_reference?: {
>     original_network_transaction_id?: string | null,
>     transaction_link_id?: string | null
>   } | null
> } | null
> ```

***

### changeBillingDate

`customers.changeBillingDate`

Change billing date. Applicable when *calendar billing* (with customer specific billing date support) is enabled. Changes the customer's *billing\_date* and/or *billing\_day\_of\_week*. During this operation the upcoming renewal dates are not updated to align immediately with the new date.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.customers.changeBillingDate({ customerId: 'cust_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customerId` | `string` | Yes | — |
| `billing_date` | `number` | No | Applicable when *calendar billing* (with customer specific billing date support) is enabled. When set, renewals of all the monthly and yearly subscriptions of this customer will be aligned to this date. |
| `billing_month` | `number` | No | `billing_month`, together with `billing_date`, specify, for this customer, the day of the year when the renewals of all the year-based subscriptions take place. For example, the renewals happen on 15th July when `billing_month` is `7` and `billing_date` is `15`. **Note** Applicable when [Calendar Billing](https://www.chargebee.com/docs/calendar-billing.html) (with customer-specific billing date support) is enabled and `billing_date_mode` is `manually_set`. |
| `billing_date_mode` | `using_defaults \| manually_set` | No | Indicates whether this customer's *billing\_date* value is derived as per configurations or its specifically set (overriden). When specifically set, the *billing\_date* will not be reset even when all of the monthly/yearly subscriptions are cancelled. \* manually\_set - Billing date is specifically set (default configuration is overridden) \* using\_defaults - Billing date is set based on defaults configured. |
| `billing_day_of_week` | `sunday \| monday \| tuesday \| wednesday \| thursday \| friday \| saturday` | No | Applicable when *calendar billing* (with customer specific billing date support) is enabled. When set, renewals of all the weekly subscriptions of this customer will be aligned to this week day. \* sunday - Sunday \* wednesday - Wednesday \* tuesday - Tuesday \* monday - Monday \* saturday - Saturday \* friday - Friday \* thursday - Thursday |
| `billing_day_of_week_mode` | `using_defaults \| manually_set` | No | Indicates whether this customer's *billing\_day\_of\_week* value is derived as per configurations or its specifically set (overriden). When specifically set, the *billing\_day\_of\_week* will not be reset even when all of the weekly subscriptions are cancelled. \* manually\_set - Billing date is specifically set (default configuration is overridden) \* using\_defaults - Billing date is set based on defaults configured. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

***

### clearPersonalData

`customers.clearPersonalData`

Clear personal data of a customer. Clear personal details of a customer using this API. Erases the customer's personal data (GDPR); it cannot be restored.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.customers.clearPersonalData({ customerId: 'cust_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customerId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

***

### collectPayment

`customers.collectPayment`

Collect payment for customer. Note: This operation optionally supports 3DS verification flow. To achieve the same, create the Payment Intent and pass it as input parameter to this API. This API can be used to collect the payments for customer's payment\_due and not\_paid invoices. Charges the customer's payment method.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.customers.collectPayment({ customerId: 'cust_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customerId` | `string` | Yes | — |
| `amount` | `number` | No | Amount to be collected. If this parameter is not passed then the invoice(s) amount to collect will be collected. |
| `payment_source_id` | `string` | No | Payment source used for the payment. |
| `token_id` | `string` | No | Token generated by Chargebee.js representing payment method details. |
| `replace_primary_payment_source` | `boolean` | No | Indicates whether the primary payment source should be replaced with this payment source. In case of Create Subscription for Customer endpoint, the default value is True. Otherwise, the default value is False. |
| `retain_payment_source` | `boolean` | No | Indicates whether the payment source should be retained for the customer. |
| `payment_initiator` | `customer \| merchant` | No | The type of initiator to be used for the payment request triggered by this operation. \* customer - Pass this value to indicate that the request is initiated by the customer \* merchant - Pass this value to indicate that the request is initiated by the merchant |
| `payment_method` | `object` | No | Parameters for payment\_method |
| `card` | `object` | No | Parameters for card |
| `payment_intent` | `object` | No | Parameters for payment\_intent |
| `invoice_allocations` | `object` | No | Parameters for invoice\_allocations |

> [accordion] payment\_method full type
>
> ```ts theme={null}
> {
>   type?: card | paypal_express_checkout | amazon_payments | direct_debit | generic | alipay | unionpay | apple_pay | wechat_pay | ideal | google_pay | sofort | bancontact | giropay | dotpay | upi | netbanking_emandates | venmo | pay_to | faster_payments | sepa_instant_transfer | automated_bank_transfer | klarna_pay_now | online_banking_poland | payconiq_by_bancontact | electronic_payment_standard | kbc_payment_button | pay_by_bank | trustly | stablecoin | kakao_pay | naver_pay | revolut_pay | cash_app_pay | twint | go_pay | grab_pay | pay_co | after_pay | swish | payme | pix | klarna | alipay_hk | paypay | gcash | south_korean_cards | paynow | bizum | promptpay | dana | touch_n_go | tamara | qpay | ovo | momo | mercado_pago | nequi | nupay | picpay | thai_qr | blik | fpx | wero | p24 | affirm_pay | rakuten_pay,
>   gateway_account_id?: string,
>   reference_id?: string,
>   tmp_token?: string,
>   additional_information?: {
>   }
> }
> ```

> [accordion] card full type
>
> ```ts theme={null}
> {
>   gateway_account_id?: string,
>   first_name?: string,
>   last_name?: string,
>   number?: string,
>   expiry_month?: number,
>   expiry_year?: number,
>   cvv?: string,
>   preferred_scheme?: cartes_bancaires | mastercard | visa | dankort,
>   billing_addr1?: string,
>   billing_addr2?: string,
>   billing_city?: string,
>   billing_state_code?: string,
>   billing_state?: string,
>   billing_zip?: string,
>   billing_country?: string,
>   additional_information?: {
>   }
> }
> ```

> [accordion] payment\_intent full type
>
> ```ts theme={null}
> {
>   id?: string,
>   gateway_account_id?: string,
>   gw_token?: string,
>   payment_method_type?: card | ideal | sofort | bancontact | google_pay | dotpay | giropay | apple_pay | upi | netbanking_emandates | paypal_express_checkout | direct_debit | boleto | venmo | amazon_payments | pay_to | faster_payments | sepa_instant_transfer | klarna_pay_now | online_banking_poland | payconiq_by_bancontact | electronic_payment_standard | kbc_payment_button | pay_by_bank | trustly | stablecoin | kakao_pay | naver_pay | revolut_pay | cash_app_pay | wechat_pay | alipay | twint | go_pay | grab_pay | pay_co | after_pay | swish | payme | pix | klarna | alipay_hk | paypay | gcash | south_korean_cards | paynow | bizum | promptpay | dana | touch_n_go | tamara | qpay | ovo | momo | mercado_pago | nequi | nupay | picpay | thai_qr | blik | fpx | wero | p24 | affirm_pay | rakuten_pay,
>   reference_id?: string,
>   additional_information?: {
>   }
> }
> ```

> [accordion] invoice\_allocations full type
>
> ```ts theme={null}
> {
>   invoice_id: string[],
>   allocation_amount?: number[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `transaction` | `object \| null` | No | This resource represents the [transaction](https://www.chargebee.com/docs/transactions.html) event that has happened in your account. |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] transaction full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   gateway_account_id?: string | null,
>   payment_source_id?: string | null,
>   payment_method?: string | null,
>   reference_number?: string | null,
>   gateway?: string | null,
>   type?: string | null,
>   date?: number | null,
>   settled_at?: number | null,
>   exchange_rate?: number | null,
>   currency_code?: string | null,
>   amount?: number | null,
>   id_at_gateway?: string | null,
>   status?: string | null,
>   fraud_flag?: string | null,
>   initiator_type?: string | null,
>   three_d_secure?: boolean | null,
>   authorization_reason?: string | null,
>   error_code?: string | null,
>   error_text?: string | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   fraud_reason?: string | null,
>   custom_payment_method_id?: string | null,
>   amount_unused?: number | null,
>   masked_card_number?: string | null,
>   reference_transaction_id?: string | null,
>   refunded_txn_id?: string | null,
>   reference_authorization_id?: string | null,
>   amount_capturable?: number | null,
>   reversal_transaction_id?: string | null,
>   deleted?: boolean | null,
>   iin?: string | null,
>   last4?: string | null,
>   merchant_reference_id?: string | null,
>   business_entity_id?: string | null,
>   payment_method_details?: string | null,
>   custom_payment_method_name?: string | null,
>   linked_invoices?: {
>     invoice_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     invoice_date?: number | null,
>     invoice_total?: number | null,
>     invoice_status?: string | null
>   }[] | null,
>   linked_credit_notes?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null,
>     cn_reference_invoice_id?: string | null
>   }[] | null,
>   linked_refunds?: {
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   linked_payments?: {
>     id?: string | null,
>     status?: string | null,
>     amount?: number | null,
>     date?: number | null
>   }[] | null,
>   gateway_metadata?: {
>     acquirer_reference_id?: string | null
>   } | null,
>   error_detail?: {
>     request_id?: string | null,
>     error_category?: string | null,
>     error_code?: string | null,
>     error_message?: string | null,
>     decline_code?: string | null,
>     decline_message?: string | null,
>     network_error_code?: string | null,
>     network_error_message?: string | null,
>     error_field?: string | null,
>     recommendation_code?: string | null,
>     recommendation_message?: string | null,
>     processor_error_code?: string | null,
>     processor_error_message?: string | null,
>     error_cause_id?: string | null,
>     processor_advice_code?: string | null
>   } | null,
>   network_transaction_details?: {
>     network_transaction_id?: string | null,
>     original_network_transaction_id?: string | null
>   } | null
> } | null
> ```

***

### copyCard

`customers.copyCard`

Copy card. #### deprecated The Payment Sources API , with its additional options and improvements, obsoletes the Cards APIs. This request is obsoleted by the Export payment source API . Copies the customer's card information to another payment gateway.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.customers.copyCard({ customerId: 'cust_8gsnbYfsMLds', gateway_account_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customerId` | `string` | Yes | — |
| `gateway_account_id` | `string` | Yes | The gateway account you want to copy the card. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `third_party_payment_method` | `object \| null` | No | Used when you want to copy card information between two gateways (such as copying cards between Authorize.Net and Stripe). Will contain details of the payment method type (card, Amazon Payments, etc.), name of the gateway, and the reference ID that the gateway uses to identify the specific card. |

> [accordion] third\_party\_payment\_method full type
>
> ```ts theme={null}
> {
>   type?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   reference_id?: string | null,
>   network_transaction_reference?: {
>   } | null
> } | null
> ```

***

### create

`customers.create`

Create a customer. Creates a customer resource. Optionally, creates a payment source for the customer.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.customers.create({ first_name: 'Ada', last_name: 'Lovelace', email: 'ada@example.com' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `id` | `string` | No | Id for the new customer. If not given, this will be auto-generated. |
| `first_name` | `string` | No | First name of the customer. |
| `last_name` | `string` | No | Last name of the customer. |
| `email` | `string` | No | Email address of the customer. Configured email notifications are sent to this email address. Invalid email address will result in an error. |
| `preferred_currency_code` | `string` | No | The currency code (in [ISO 4217 format](https://www.iso.org/iso-4217-currency-codes.html)) of the customer. |
| `phone` | `string` | No | Phone number of the customer. |
| `company` | `string` | No | Company name of the customer. |
| `auto_collection` | `on \| off` | No | Whether payments needs to be collected automatically for this customer. \* on - Whenever an invoice is created, an automatic attempt to charge the customer's payment method is made. \* off - Automatic collection of charges will not be made. All payments must be recorded offline. |
| `net_term_days` | `number` | No | The number of days from [`invoice.date`](https://docs.corsair.dev/docs/api/invoices/invoice-object#date) until payment for the invoice is due. |
| `allow_direct_debit` | `boolean` | No | Whether the customer can pay via Direct Debit. |
| `vat_number` | `string` | No | The VAT/tax registration number for the customer. For customers with [billing\_address](https://docs.corsair.dev/docs/api/customers/customer-object#billing_address) `country` as `XI` (which is **United Kingdom - Northern Ireland** ), the first two characters of the [full VAT number](https://en.wikipedia.org/wiki/VAT_identification_number) can be overridden by setting [vat\_number\_prefix](https://docs.corsair.dev/docs/api/customers/customer-object#vat_number_prefix) . |
| `vat_number_prefix` | `string` | No | 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](https://docs.corsair.dev/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](https://docs.corsair.dev/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. |
| `entity_identifier_scheme` | `string` | No | The Peppol BIS scheme associated with the [vat\_number](https://docs.corsair.dev/docs/api/customers/customer-object#vat_number) of the customer. This helps identify the specific type of customer entity. For example, `DE:VAT` is used for a German business entity while `DE:LWID45` is used for a German government entity. The value must be from the list of possible values and must correspond to the country provided under `billing_address.country`. See [list of possible values](https://www.chargebee.com/docs/e-invoicing.html#supported-countries) . **Tip:** If there are additional entity identifiers for the customer not associated with the `vat_number`, they can be provided as the `entity_identifiers[]` array. |
| `entity_identifier_standard` | `string` | No | The standard used for specifying the `entity_identifier_scheme`. Currently only `iso6523-actorid-upis` is supported and is used by default when not provided. **Tip:** If there are additional entity identifiers for the customer not associated with the `vat_number`, they can be provided as the `entity_identifiers[]` array. |
| `registered_for_gst` | `boolean` | No | 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. |
| `is_einvoice_enabled` | `boolean` | No | Determines whether the customer is e-invoiced. When set to `true` or not set to any value, the customer is e-invoiced so long as e-invoicing is enabled for their country (`billing_address.country` ). When set to `false` , the customer is not e-invoiced even if e-invoicing is enabled for their country. **Tip:** It is possible to set a value for this flag even when E-Invoicing is disabled. However, it comes into effect only when E-Invoicing is enabled. |
| `einvoicing_method` | `automatic \| manual \| site_default` | No | Determines whether to send an e-invoice manually or automatic. \* automatic - Use this value to send e-invoice every time an invoice or credit note is created. \* manual - When manual is selected the automatic e-invoice sending is disabled. Use this value to send e-invoice manually through UI or API. \* site\_default - The default value of the site which can be overridden at the customer level. |
| `taxability` | `taxable \| exempt \| zero_rated` | No | Specifies if the customer is liable for tax. \* zero\_rated - This option is available only when zero-rated customer taxability is enabled for the site and the site uses [Chargebee Taxes](https://www.chargebee.com/docs/tax.html). Third-party tax providers and integrations are not supported. Line items that would otherwise be taxable are taxed at 0%. For these line items, `is_taxed` is `true`, the tax rate and tax amount are `0`, and `tax_exempt_reason` is `zero_rated`. Unlike `exempt`, `zero_rated` follows the taxable tax path at a zero rate. \* 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. |
| `exemption_details` | `any[]` | No | 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` | `residential \| business \| senior_citizen \| industrial` | No | 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. \* industrial - When the purchase is made by an industrial business \* residential - When the purchase is made by a customer for home use \* 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 \* business - When the purchase is made at a place of business |
| `client_profile_id` | `string` | No | 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. |
| `taxjar_exemption_category` | `wholesale \| government \| other` | No | Indicates the exemption type of the customer. This is applicable only if you use Chargebee's TaxJar integration. \* other - Other \* government - Government \* wholesale - Whole-sale |
| `business_customer_without_vat_number` | `boolean` | No | Confirms that a customer is a valid business without an EU/UK VAT number. |
| `locale` | `string` | No | Determines which region-specific language Chargebee uses to communicate with the customer. Use the [language pack](https://www.chargebee.com/docs/billing/2.0/customers/configure-multiple-languages#step-2-download-the-language-pack-and-provide-the-translations) to customize the translations for each locale. **Default behavior** \* If you don't pass `locale`, or if you pass it but it is not added and activated in Chargebee, then the [primary language](https://www.chargebee.com/docs/billing/2.0/customers/configure-multiple-languages#primary-language-of-your-chargebee-site) for customers would be used. |
| `entity_code` | `a \| b \| c \| d \| e \| f \| g \| h \| i \| j \| k \| l \| m \| n \| p \| q \| r \| med1 \| med2` | No | 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) . \* l - Other or custom \* m - Educational organization \* n - Local government \* h - Commercial agricultural production \* i - Industrial production/manufacturer \* j - Direct pay permit \* k - Direct mail \* p - Commercial aquaculture \* q - Commercial Fishery \* r - Non-resident \* d - Foreign diplomat \* e - Charitable or benevolent organization \* f - Religious organization \* g - Resale \* a - Federal government \* b - State government \* c - Tribe/Status Indian/Indian Band \* med2 - US Medical Device Excise Tax with taxable sales tax \* med1 - US Medical Device Excise Tax with exempt sales tax |
| `exempt_number` | `string` | No | 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) . |
| `meta_data` | `object` | No | A collection of key-value pairs that provides extra information about the customer. **Note:** There's a character limit of 65,535. [Learn more](https://docs.corsair.dev/docs/api/advanced-features) . |
| `offline_payment_method` | `no_preference \| cash \| check \| bank_transfer \| ach_credit \| sepa_credit \| boleto \| us_automated_bank_transfer \| eu_automated_bank_transfer \| uk_automated_bank_transfer \| jp_automated_bank_transfer \| mx_automated_bank_transfer \| custom` | No | The preferred offline payment method for the customer. \* sepa\_credit - SEPA Credit \* cash - Cash \* no\_preference - No Preference \* bank\_transfer - Bank Transfer \* check - Check \* eu\_automated\_bank\_transfer - EU Automated Bank Transfer \* jp\_automated\_bank\_transfer - JP Automated Bank Transfer \* uk\_automated\_bank\_transfer - UK Automated Bank Transfer \* custom - Custom \* boleto - Boleto \* mx\_automated\_bank\_transfer - MX Automated Bank Transfer \* us\_automated\_bank\_transfer - US Automated Bank Transfer \* ach\_credit - ACH Credit |
| `auto_close_invoices` | `boolean` | No | Override for this customer, the [site-level setting](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) for auto-closing invoices. Only applicable when auto-closing invoices has been enabled for the site. This attribute is also available at the [subscription level](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#auto_close_invoices) which takes precedence. |
| `consolidated_invoicing` | `boolean` | No | Indicates whether invoices raised on the same day for the `customer` are consolidated. When provided, this overrides the default configuration at the [site-level](https://www.chargebee.com/docs/consolidated-invoicing.html#configuring-consolidated-invoicing). This parameter can be provided only when [Consolidated Invoicing](https://www.chargebee.com/docs/consolidated-invoicing.html) is enabled. **Note:** Any invoices raised when a subscription activates from `in_trial` or `future` `status`, are not consolidated by default. [Contact 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 consolidation for such invoices. . |
| `token_id` | `string` | No | The Chargebee payment token generated by [Chargebee.js](https://www.chargebee.com/docs/payments/2.0/card-components-and-helpers/3ds-helper#using-the-gateways-hosted-fields). **Note** : The payment token created via Chargebee.js uses the gateway selected through [Smart Routing](https://www.chargebee.com/docs/payments/2.0/payment-gateways-and-configuration/gateway_settings#smart-routing). Explicitly passing a `gateway_id` in this API call will not override the gateway associated with the token. |
| `business_entity_id` | `string` | No | The unique ID of the [business entity](https://docs.corsair.dev/docs/api/advanced-features) this customer should be [linked](https://docs.corsair.dev/docs/api/advanced-features) to. An alternative way of passing this parameter is by means of a [custom HTTP header](https://docs.corsair.dev/docs/api/advanced-features). **Default behavior** \* When not provided, the customer is linked to the [default business entity](https://docs.corsair.dev/docs/api/advanced-features) defined for the site. |
| `brand_id` | `string` | No | The unique ID of the [brand](https://docs.corsair.dev/docs/api/brands) this customer should be linked to. Applicable only when multiple brands have been created for the site. An alternative way of passing this parameter is by means of the `chargebee-brand-id` custom HTTP header; when both are provided, they must specify the same brand. **Default behavior** \* When not provided, the customer is linked to the default brand defined for the site. |
| `invoice_notes` | `string` | No | A customer-facing note added to all invoices associated with this API resource. This note becomes one among [all the notes](https://docs.corsair.dev/docs/api/invoices/invoice-object#notes) displayed on the invoice PDF. |
| `card` | `object` | No | Parameters for card. Use this parameter to pass raw card details. Passing raw card data via API involves PCI liability at your end due to the sensitivity of the data. |
| `bank_account` | `object` | No | Parameters for bank\_account |
| `payment_method` | `object` | No | Parameters for payment\_method |
| `payment_intent` | `object` | No | Parameters for payment\_intent |
| `billing_address` | `object` | No | Parameters for billing\_address |
| `entity_identifiers` | `object` | No | Parameters for entity\_identifiers |
| `tax_providers_fields` | `object` | No | Parameters for tax\_providers\_fields |

> [accordion] meta\_data full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] card full type
>
> ```ts theme={null}
> {
>   gateway_account_id?: string,
>   first_name?: string,
>   last_name?: string,
>   number?: string,
>   expiry_month?: number,
>   expiry_year?: number,
>   cvv?: string,
>   preferred_scheme?: cartes_bancaires | mastercard | visa | dankort,
>   billing_addr1?: string,
>   billing_addr2?: string,
>   billing_city?: string,
>   billing_state_code?: string,
>   billing_state?: string,
>   billing_zip?: string,
>   billing_country?: string,
>   additional_information?: {
>   }
> }
> ```

> [accordion] bank\_account full type
>
> ```ts theme={null}
> {
>   gateway_account_id?: string,
>   iban?: string,
>   first_name?: string,
>   last_name?: string,
>   company?: string,
>   email?: string,
>   phone?: string,
>   bank_name?: string,
>   account_number?: string,
>   routing_number?: string,
>   bank_code?: string,
>   account_type?: checking | savings | business_checking | current,
>   account_holder_type?: individual | company,
>   echeck_type?: web | ppd | ccd,
>   issuing_country?: string,
>   swedish_identity_number?: string,
>   billing_address?: {
>   }
> }
> ```

> [accordion] payment\_method full type
>
> ```ts theme={null}
> {
>   type?: card | paypal_express_checkout | amazon_payments | direct_debit | generic | alipay | unionpay | apple_pay | wechat_pay | ideal | google_pay | sofort | bancontact | giropay | dotpay | upi | netbanking_emandates | venmo | pay_to | faster_payments | sepa_instant_transfer | automated_bank_transfer | klarna_pay_now | online_banking_poland | payconiq_by_bancontact | electronic_payment_standard | kbc_payment_button | pay_by_bank | trustly | stablecoin | kakao_pay | naver_pay | revolut_pay | cash_app_pay | twint | go_pay | grab_pay | pay_co | after_pay | swish | payme | pix | klarna | alipay_hk | paypay | gcash | south_korean_cards | paynow | bizum | promptpay | dana | touch_n_go | tamara | qpay | ovo | momo | mercado_pago | nequi | nupay | picpay | thai_qr | blik | fpx | wero | p24 | affirm_pay | rakuten_pay,
>   gateway_account_id?: string,
>   reference_id?: string,
>   tmp_token?: string,
>   issuing_country?: string,
>   additional_information?: {
>   }
> }
> ```

> [accordion] payment\_intent full type
>
> ```ts theme={null}
> {
>   id?: string,
>   gateway_account_id?: string,
>   gw_token?: string,
>   payment_method_type?: card | ideal | sofort | bancontact | google_pay | dotpay | giropay | apple_pay | upi | netbanking_emandates | paypal_express_checkout | direct_debit | boleto | venmo | amazon_payments | pay_to | faster_payments | sepa_instant_transfer | klarna_pay_now | online_banking_poland | payconiq_by_bancontact | electronic_payment_standard | kbc_payment_button | pay_by_bank | trustly | stablecoin | kakao_pay | naver_pay | revolut_pay | cash_app_pay | wechat_pay | alipay | twint | go_pay | grab_pay | pay_co | after_pay | swish | payme | pix | klarna | alipay_hk | paypay | gcash | south_korean_cards | paynow | bizum | promptpay | dana | touch_n_go | tamara | qpay | ovo | momo | mercado_pago | nequi | nupay | picpay | thai_qr | blik | fpx | wero | p24 | affirm_pay | rakuten_pay,
>   reference_id?: string,
>   additional_information?: {
>   }
> }
> ```

> [accordion] billing\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] entity\_identifiers full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   scheme?: string[],
>   value?: string[],
>   standard?: string[]
> }
> ```

> [accordion] tax\_providers\_fields full type
>
> ```ts theme={null}
> {
>   provider_name?: string[],
>   field_id?: string[],
>   field_value?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] card full type
>
> ```ts theme={null}
> {
>   payment_source_id?: string | null,
>   status?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   ref_tx_id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   iin?: string | null,
>   last4?: string | null,
>   card_type?: string | null,
>   funding_type?: string | null,
>   expiry_month?: number | null,
>   expiry_year?: number | null,
>   issuing_country?: string | null,
>   billing_addr1?: string | null,
>   billing_addr2?: string | null,
>   billing_city?: string | null,
>   billing_state_code?: string | null,
>   billing_state?: string | null,
>   billing_country?: string | null,
>   billing_zip?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   ip_address?: string | null,
>   powered_by?: string | null,
>   customer_id?: string | null,
>   masked_number?: string | null
> } | null
> ```

***

### createSubscription

`customers.createSubscription`

Create subscription for customer. Note: This operation optionally supports 3DS verification flow. To achieve the same, create the Payment Intent and pass it as input parameter to this API. Creates a new subscription for an existing customer. Product Catalog 1.0 sites only.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.customers.createSubscription({ customerId: 'cust_8gsnbYfsMLds', plan_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `customerId` | `string` | Yes | — |
| `id` | `string` | No | A unique and immutable identifier for the subscription. If not provided, it is autogenerated. |
| `brand_id` | `string` | No | — |
| `plan_id` | `string` | Yes | Identifier of the plan for this subscription. |
| `plan_quantity` | `number` | No | Plan quantity for this subscription. |
| `plan_quantity_in_decimal` | `string` | No | The decimal representation of the quantity of the plan purchased. Can be provided for quantity-based plans and only when [multi-decimal pricing](https://docs.corsair.dev/docs/api/v2/pcv-1/currencies) is enabled. |
| `plan_unit_price` | `number` | No | Amount that will override the Plan's default price. The unit depends on the [type of currency](https://docs.corsair.dev/docs/api/getting-started) . |
| `plan_unit_price_in_decimal` | `string` | No | When [price overriding](http://chargebee.com/docs/price-override.html) is enabled for the site, the price or per-unit price of the plan can be set here. The value [set for the plan](https://docs.corsair.dev/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](https://docs.corsair.dev/docs/api/v2/pcv-1/currencies) is enabled. |
| `setup_fee` | `number` | No | Amount that will override the default setup fee. The unit depends on the [type of currency](https://docs.corsair.dev/docs/api/getting-started) . |
| `trial_end` | `number` | No | The time at which the trial ends for this subscription. Can be specified to override the default trial period.If **'0'** is passed, the subscription will be activated immediately. |
| `billing_cycles` | `number` | No | Specifies the number of billing cycles for the subscription. The behavior of the subscription after the billing cycles have completed depends on whether the subscription is on a [contract term](https://docs.corsair.dev/docs/api/v2/pcv-1/contract_terms) or not. \* When the subscription is not on a contract term: if `billing_cycles` is not provided, then the billing cycles [set for the plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object#billing_cycles) is used. Moreover, once the `billing_cycles` have completed, the subscription cancels. \* When the subscription is on a contract term: Providing `billing_cycles` is mandatory. Moreover, once the `billing_cycles` have completed, the behavior of the subscription is determined by the `contract_term[action_at_term_end]` parameter. |
| `mandatory_addons_to_remove` | `string[]` | No | List of addons IDs that are mandatory to the plan and has to be removed from the subscription. |
| `start_date` | `number` | No | 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. . |
| `auto_collection` | `on \| off` | No | Defines whether payments need to be collected automatically for this subscription. Overrides customer's auto-collection property. \* 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. |
| `terms_to_charge` | `number` | No | 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` | `immediate \| delayed` | No | 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. \* 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. |
| `offline_payment_method` | `no_preference \| cash \| check \| bank_transfer \| ach_credit \| sepa_credit \| boleto \| us_automated_bank_transfer \| eu_automated_bank_transfer \| uk_automated_bank_transfer \| jp_automated_bank_transfer \| mx_automated_bank_transfer \| custom` | No | The preferred offline payment method for the subscription. \* jp\_automated\_bank\_transfer - JP Automated Bank Transfer \* sepa\_credit - SEPA Credit \* cash - Cash \* no\_preference - No Preference \* uk\_automated\_bank\_transfer - UK Automated Bank Transfer \* custom - Custom \* bank\_transfer - Bank Transfer \* boleto - Boleto \* check - Check \* mx\_automated\_bank\_transfer - MX Automated Bank Transfer \* us\_automated\_bank\_transfer - US Automated Bank Transfer \* eu\_automated\_bank\_transfer - EU Automated Bank Transfer \* ach\_credit - ACH Credit |
| `po_number` | `string` | No | Purchase order number for this subscription. |
| `coupon_ids` | `string[]` | No | List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes. |
| `payment_source_id` | `string` | No | Id of the payment source to be attached to this subscription. |
| `override_relationship` | `boolean` | No | If `true` , ignores the [hierarchy relationship](https://docs.corsair.dev/docs/api/customers/customer-object#relationship) and uses customer as payment and invoice owner. |
| `invoice_notes` | `string` | No | A customer-facing note added to all invoices associated with this subscription. This note is one among [all the notes](https://docs.corsair.dev/docs/api/invoices/invoice-object#notes) displayed on the invoice PDF. |
| `invoice_date` | `number` | No | 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 the 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. \* It is not earlier than `start_date`. \* It is not more than one calendar month into the past. Eg. If today is 13th January, then you cannot pass a value that is earlier than 13th December. \* `invoice_immediately` is true. . |
| `meta_data` | `object` | No | A collection of key-value pairs that provides extra information about the subscription. **Note:** There's a character limit of 65,535. [Learn more](https://docs.corsair.dev/docs/api/v2/pcv-1/advanced-features) . |
| `invoice_immediately` | `boolean` | No | 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. . |
| `replace_primary_payment_source` | `boolean` | No | Indicates whether the primary payment source should be replaced with this payment source. In case of Create Subscription for Customer endpoint, the default value is True. Otherwise, the default value is False. |
| `free_period` | `number` | No | 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` | `day \| week \| month \| year` | No | 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](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/create-a-plan#period_unit) attribute of the [plan](https://docs.corsair.dev/docs/api/v2/pcv-1/subscriptions/create-a-subscription#plan_id) chosen. \* week - Charge based on week(s) \* month - Charge based on month(s) \* day - Charge based on day(s) \* year - Charge based on year(s) |
| `contract_term_billing_cycle_on_renewal` | `number` | No | 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` | `site_default \| plan_default \| activate_subscription \| cancel_subscription` | No | 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. \* cancel\_subscription - The subscription cancels. \* activate\_subscription - The subscription activates and charges are raised for non-metered items. \* 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. \* site\_default - This is the default value. 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. |
| `payment_initiator` | `customer \| merchant` | No | The type of initiator to be used for the payment request triggered by this operation. \* customer - Pass this value to indicate that the request is initiated by the customer \* merchant - Pass this value to indicate that the request is initiated by the merchant |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `statement_descriptor` | `object` | No | Parameters for statement\_descriptor |
| `payment_intent` | `object` | No | Parameters for payment\_intent |
| `contract_term` | `object` | No | Parameters for contract\_term |
| `addons` | `object` | No | Parameters for addons |
| `event_based_addons` | `object` | No | Parameters for event\_based\_addons |

> [accordion] meta\_data full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] statement\_descriptor full type
>
> ```ts theme={null}
> {
>   descriptor?: string
> }
> ```

> [accordion] payment\_intent full type
>
> ```ts theme={null}
> {
>   id?: string,
>   gateway_account_id?: string,
>   gw_token?: string,
>   payment_method_type?: card | ideal | sofort | bancontact | google_pay | dotpay | giropay | apple_pay | upi | netbanking_emandates | paypal_express_checkout | direct_debit | boleto | venmo | amazon_payments | pay_to | faster_payments | sepa_instant_transfer | klarna_pay_now | online_banking_poland | payconiq_by_bancontact | electronic_payment_standard | kbc_payment_button | pay_by_bank | trustly | stablecoin | kakao_pay | naver_pay | revolut_pay | cash_app_pay | wechat_pay | alipay | twint | go_pay | grab_pay | pay_co | after_pay | swish | payme | pix | klarna | alipay_hk | paypay | gcash | south_korean_cards | paynow | bizum | promptpay | dana | touch_n_go | tamara | qpay | ovo | momo | mercado_pago | nequi | nupay | picpay | thai_qr | blik | fpx | wero | p24 | affirm_pay | rakuten_pay,
>   reference_id?: string,
>   additional_information?: {
>   }
> }
> ```

> [accordion] contract\_term full type
>
> ```ts theme={null}
> {
>   action_at_term_end?: renew | evergreen | cancel,
>   cancellation_cutoff_period?: number
> }
> ```

> [accordion] addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   unit_price?: number[],
>   unit_price_in_decimal?: string[],
>   billing_cycles?: number[],
>   trial_end?: number[]
> }
> ```

> [accordion] event\_based\_addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   unit_price?: number[],
>   quantity_in_decimal?: string[],
>   unit_price_in_decimal?: string[],
>   service_period_in_days?: number[],
>   on_event?: (subscription_creation | subscription_trial_start | plan_activation | subscription_activation | contract_termination)[],
>   charge_once?: boolean[],
>   charge_on?: (immediately | on_event)[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `subscription` | `object \| null` | No | Subscription represents the recurring items a customer has subscribed to. The recurring items can be - plan, addons. It may also contain the discount items like coupons. Subscriptions are invoiced at the start of every term based on the recurring items and charged immediately against the customer's credit card if 'auto\_collection' is turned 'on', otherwise the resulting invoice will be created as 'Payment Due'. **Note:** The maximum number of subscriptions for any given [customer](https://docs.corsair.dev/docs/api/customers) ([active](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#status) or not) is 900. Tax provider fields **Avalara** : Merchants using **Avalara Sales Tax** can optionally associate each item price with a locationCode (from their Avalara company locations), so tax can be resolved correctly at the line item level. \| Field ID \| Field Value \| APIs \| \|--------------------------------------------------------------------------------\|----------------------------------------------------------------------\|--------------------------------------------------------------------------------\| \| `locationCode` \| Merchant to configure it on Avalara Platform under company locations \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| **Anrok**: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation \| Field ID \| Field Value \| APIs \| \|---------------------------------------------------------------------------------------------------------------------------------------\|---------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------\| \| `additionalTaxRegistrationNumber` \| Canadian tax registration numbers in comma separated fashion. \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| **Vertex**: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration **Note:** Field Id like `customerCode` , `customerClass` , and`taxExempted` belong to the customer object. Field Id like `productCode` , `productClass` , `productTaxCode` , and `productClass` belong to the product object. \| Field ID \| Field Value \| APIs \| \|-----------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productCode` \| Merchant to configure it on Vertex Platform \| APIs having [Plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object)(PC1), [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object)(PC1) and [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object)(PC2) attributes. \| \| `productClass` \| Merchant to configure it on Vertex Platform \| APIs having [Plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object)(PC1), [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object)(PC1) and [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object)(PC2) attributes. \| \| `customerCode` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `customerClass` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **Taxamo:** Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration \| Field Id \| Field Value \| APIs \| \|------------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productTaxCode` \| Merchant to configure it on Taxamo Platform \| APIs having [Plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object)(PC1), [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object)(PC1) and Item Prices (PC2) attributes. \| \| `productClass` \| Merchant to configure it on Taxamo Platform \| APIs having [Plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object)(PC1), [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object)(PC1) and Item Prices (PC2) attributes. \| \| `taxExempted` \| Merchant to configure it on Taxamo Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **cbtaxes**: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India. \| Field ID \| Field Value \| APIs \| \|---------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `indiaSez` \| `SEZ_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaSez` \| `SEZ_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **All**: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level \| Field ID \| Field Value \| APIs \| \|-------------\|-----------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `priceType` \| `TAX_INCLUSIVE` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| \| `TAX_EXCLUSIVE` \| \| \| \| `SITE_DEFAULT` \| Removes price type override, and allows site level configuration to be used for tax calculation. \| **Note:** Make sure you choose the correct **Field ID** and **Available APIs** combination from the table above. All Product Catalog APIs include [Plans](https://docs.corsair.dev/docs/api/v2/pcv-1/plans) , [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons) , [Coupons](https://docs.corsair.dev/docs/api/v2/pcv-1/coupons) , [Coupon Sets](https://docs.corsair.dev/docs/api/v2/pcv-1/coupon_sets) , [Coupon Codes](https://docs.corsair.dev/docs/api/v2/pcv-1/coupon_codes) . |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/v2/pcv-1/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/v2/pcv-1/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any custom attributes you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/1.0/sites-intro.html)\\*\\* created before March 1, 2014\\*\\*: [updating the card](https://docs.corsair.dev/docs/api/v2/pcv-1/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/v2/pcv-1/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |
| `invoice` | `object \| null` | No | Invoices are statements containing charges, adjustments and any discounts for a subscription specific to a term. For every subscription a draft invoice (upcoming invoice) is used to track all the charges, credits and adjustments for the current term. Generally, an invoice is closed at start of the next term. However, cancellation and other such operations on subscription may trigger premature closing. While closing the invoice, in addition to recurring charges, credits and coupons are applied to calculate the final amount that is due. When invoice is closed, an attempt to charge the credit card is made. If the payment succeeds, it is marked as **paid** . If the payment fails, the invoice is marked as **payment\_due** and retry settings are taken into account. If no retry attempts are configured, the invoice is marked as **not\_paid** . If the amount due is zero or negative, the invoice is immediately marked as **paid** and the balance if any is carried forward to the next term of the invoice. **Note:** If *consolidated invoicing* is enabled, the attribute *invoice.subscription\_id* should **not** be used (as it will not be present if the invoice has lines from multiple subscriptions). Instead to know the related subscriptions, their [line\_items](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) *subscription\_id* attribute should be referred. |
| `unbilled_charges` | `object[] \| null` | No | Resource object representing unbilled\_charge |

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   currency_code?: string | null,
>   plan_id?: string | null,
>   plan_quantity?: number | null,
>   plan_unit_price?: number | null,
>   setup_fee?: number | null,
>   billing_period?: number | null,
>   billing_period_unit?: string | null,
>   start_date?: number | null,
>   trial_end?: number | null,
>   remaining_billing_cycles?: number | null,
>   po_number?: string | null,
>   auto_collection?: string | null,
>   plan_quantity_in_decimal?: string | null,
>   plan_unit_price_in_decimal?: string | null,
>   customer_id?: string | null,
>   plan_amount?: number | null,
>   plan_free_quantity?: number | null,
>   status?: string | null,
>   trial_start?: number | null,
>   trial_end_action?: string | null,
>   current_term_start?: number | null,
>   current_term_end?: number | null,
>   next_billing_at?: number | null,
>   created_at?: number | null,
>   started_at?: number | null,
>   activated_at?: number | null,
>   gift_id?: string | null,
>   contract_term_billing_cycle_on_renewal?: number | null,
>   override_relationship?: boolean | null,
>   pause_date?: number | null,
>   resume_date?: number | null,
>   cancelled_at?: number | null,
>   cancel_reason?: string | null,
>   affiliate_token?: string | null,
>   created_from_ip?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   has_scheduled_advance_invoices?: boolean | null,
>   has_scheduled_changes?: boolean | null,
>   payment_source_id?: string | null,
>   plan_free_quantity_in_decimal?: string | null,
>   plan_amount_in_decimal?: string | null,
>   cancel_schedule_created_at?: number | null,
>   offline_payment_method?: string | null,
>   channel?: string | null,
>   active_id?: string | null,
>   due_invoices_count?: number | null,
>   due_since?: number | null,
>   total_dues?: number | null,
>   mrr?: number | null,
>   exchange_rate?: number | null,
>   base_currency_code?: string | null,
>   invoice_notes?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   changes_scheduled_at?: number | null,
>   cancel_reason_code?: string | null,
>   free_period?: number | null,
>   free_period_unit?: string | null,
>   create_pending_invoices?: boolean | null,
>   auto_close_invoices?: boolean | null,
>   business_entity_id?: string | null,
>   decommissioned?: boolean | null,
>   brand_id?: string | null,
>   addons?: {
>     id?: string | null,
>     quantity?: number | null,
>     unit_price?: number | null,
>     amount?: number | null,
>     trial_end?: number | null,
>     remaining_billing_cycles?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     proration_type?: string | null
>   }[] | null,
>   event_based_addons?: {
>     id?: string | null,
>     quantity?: number | null,
>     unit_price?: number | null,
>     on_event?: string | null,
>     charge_once?: boolean | null,
>     quantity_in_decimal?: string | null,
>     unit_price_in_decimal?: string | null
>   }[] | null,
>   charged_event_based_addons?: {
>     id?: string | null,
>     last_charged_at?: number | null
>   }[] | null,
>   coupons?: {
>     coupon_id?: string | null,
>     apply_till?: number | null,
>     applied_count?: number | null,
>     coupon_code?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_info?: {
>     referral_code?: string | null,
>     coupon_code?: string | null,
>     referrer_id?: string | null,
>     external_reference_id?: string | null,
>     reward_status?: string | null,
>     referral_system?: string | null,
>     account_id?: string | null,
>     campaign_id?: string | null,
>     external_campaign_id?: string | null,
>     friend_offer_type?: string | null,
>     referrer_reward_type?: string | null,
>     notify_referral_system?: string | null,
>     destination_url?: string | null,
>     post_purchase_widget_enabled?: boolean | null
>   } | null,
>   contract_term?: {
>     id?: string | null,
>     status?: string | null,
>     contract_start?: number | null,
>     contract_end?: number | null,
>     billing_cycle?: number | null,
>     action_at_term_end?: string | null,
>     total_contract_value?: number | null,
>     total_contract_value_before_tax?: number | null,
>     cancellation_cutoff_period?: number | null,
>     created_at?: number | null,
>     subscription_id?: string | null,
>     remaining_billing_cycles?: number | null
>   } | null
> } | null
> ```

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] card full type
>
> ```ts theme={null}
> {
>   payment_source_id?: string | null,
>   status?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   ref_tx_id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   iin?: string | null,
>   last4?: string | null,
>   card_type?: string | null,
>   funding_type?: string | null,
>   expiry_month?: number | null,
>   expiry_year?: number | null,
>   issuing_country?: string | null,
>   billing_addr1?: string | null,
>   billing_addr2?: string | null,
>   billing_city?: string | null,
>   billing_state_code?: string | null,
>   billing_state?: string | null,
>   billing_country?: string | null,
>   billing_zip?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   ip_address?: string | null,
>   powered_by?: string | null,
>   customer_id?: string | null,
>   masked_number?: string | null
> } | null
> ```

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

> [accordion] unbilled\_charges full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   date_from?: number | null,
>   date_to?: number | null,
>   unit_amount?: number | null,
>   pricing_model?: string | null,
>   quantity?: number | null,
>   amount?: number | null,
>   currency_code?: string | null,
>   discount_amount?: number | null,
>   description?: string | null,
>   entity_type?: string | null,
>   entity_id?: string | null,
>   is_voided?: boolean | null,
>   voided_at?: number | null,
>   unit_amount_in_decimal?: string | null,
>   quantity_in_decimal?: string | null,
>   amount_in_decimal?: string | null,
>   created_at?: number | null,
>   updated_at?: number | null,
>   is_advance_charge?: boolean | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null,
>   tiers?: {
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null
> }[] | null
> ```

***

### createSubscriptionEstimate

`customers.createSubscriptionEstimate`

Create subscription for a customer estimate. Create a subscription for the existing estimate of a customer. Product Catalog 1.0 sites only.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.customers.createSubscriptionEstimate({ customerId: 'cust_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `use_existing_balances` | `boolean` | No | 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` | `boolean` | No | 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. . |
| `billing_cycles` | `number` | No | Number of cycles(plan interval) this subscription should be charged. After the billing cycles exhausted, the subscription will be cancelled. |
| `mandatory_addons_to_remove` | `string[]` | No | List of addons IDs that are mandatory to the plan and has to be removed from the subscription. |
| `terms_to_charge` | `number` | No | 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` | `immediate \| delayed` | No | 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. \* delayed - Subscription period will be aligned with the configured billing date at the next renewal. \* immediate - Subscription period will be aligned with the configured billing date immediately, with credits or charges raised accordingly.. |
| `invoice_date` | `number` | No | 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. |
| `coupon_ids` | `string[]` | No | List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes. |
| `subscription` | `object` | No | Parameters for subscription |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `contract_term` | `object` | No | Parameters for contract\_term |
| `addons` | `object` | No | Parameters for addons |
| `event_based_addons` | `object` | No | Parameters for event\_based\_addons |
| `customerId` | `string` | Yes | — |

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id?: string,
>   plan_id: string,
>   plan_quantity?: number,
>   plan_quantity_in_decimal?: string,
>   plan_unit_price?: number,
>   plan_unit_price_in_decimal?: string,
>   setup_fee?: number,
>   trial_end?: number,
>   start_date?: number,
>   offline_payment_method?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
>   free_period?: number,
>   free_period_unit?: day | week | month | year,
>   contract_term_billing_cycle_on_renewal?: number,
>   trial_end_action?: site_default | plan_default | activate_subscription | cancel_subscription
> }
> ```

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] contract\_term full type
>
> ```ts theme={null}
> {
>   action_at_term_end?: renew | evergreen | cancel,
>   cancellation_cutoff_period?: number
> }
> ```

> [accordion] addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   unit_price?: number[],
>   unit_price_in_decimal?: string[],
>   billing_cycles?: number[],
>   trial_end?: number[]
> }
> ```

> [accordion] event\_based\_addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   unit_price?: number[],
>   quantity_in_decimal?: string[],
>   unit_price_in_decimal?: string[],
>   service_period_in_days?: number[],
>   on_event?: (subscription_creation | subscription_trial_start | plan_activation | subscription_activation | contract_termination)[],
>   charge_once?: boolean[],
>   charge_on?: (immediately | on_event)[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `estimate` | `object \| null` | No | During the process of signing up customers to subscriptions, use the Estimates API to evaluate the details of the purchase before actually signing them up. The details returned by the API include the invoice amounts, next billing date and unbilled charges. For example, consider that you are creating a new subscription or update an existing one. Use the Estimates API before that to deduce the details such as the amount the customer would be charged, the state the subscription would be in after creation or updation, and so on. If you have configured the [Avalara integration](https://www.chargebee.com/docs/1.0/avalara.html), Chargebee retrieves the tax amount from Avalara for the invoice. This counts against your Avalara API limits. |

> [accordion] estimate full type
>
> ```ts theme={null}
> {
>   created_at?: number | null,
>   subscription_estimate?: {
>     id?: string | null,
>     currency_code?: string | null,
>     status?: string | null,
>     trial_end_action?: string | null,
>     next_billing_at?: number | null,
>     pause_date?: number | null,
>     resume_date?: number | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     contract_term?: {
>       id?: string | null,
>       status?: string | null,
>       contract_start?: number | null,
>       contract_end?: number | null,
>       billing_cycle?: number | null,
>       action_at_term_end?: string | null,
>       total_contract_value?: number | null,
>       total_contract_value_before_tax?: number | null,
>       cancellation_cutoff_period?: number | null,
>       created_at?: number | null,
>       subscription_id?: string | null,
>       remaining_billing_cycles?: number | null
>     } | null
>   } | null,
>   subscription_estimates?: {
>     id?: string | null,
>     currency_code?: string | null,
>     status?: string | null,
>     trial_end_action?: string | null,
>     next_billing_at?: number | null,
>     pause_date?: number | null,
>     resume_date?: number | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     contract_term?: {
>       id?: string | null,
>       status?: string | null,
>       contract_start?: number | null,
>       contract_end?: number | null,
>       billing_cycle?: number | null,
>       action_at_term_end?: string | null,
>       total_contract_value?: number | null,
>       total_contract_value_before_tax?: number | null,
>       cancellation_cutoff_period?: number | null,
>       created_at?: number | null,
>       subscription_id?: string | null,
>       remaining_billing_cycles?: number | null
>     } | null
>   }[] | null,
>   invoice_estimate?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   } | null,
>   invoice_estimates?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   }[] | null,
>   payment_schedule_estimates?: {
>     id?: string | null,
>     scheme_id?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     amount?: number | null,
>     currency_code?: string | null,
>     schedule_entries?: {
>       id?: string | null,
>       date?: number | null,
>       amount?: number | null,
>       scheduled_amount?: number | null,
>       status?: string | null
>     }[] | null
>   }[] | null,
>   next_invoice_estimate?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   } | null,
>   credit_note_estimates?: {
>     reference_invoice_id?: string | null,
>     type?: string | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     amount_allocated?: number | null,
>     amount_available?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   }[] | null,
>   unbilled_charge_estimates?: {
>     id?: string | null,
>     customer_id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     pricing_model?: string | null,
>     quantity?: number | null,
>     amount?: number | null,
>     currency_code?: string | null,
>     discount_amount?: number | null,
>     description?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     is_voided?: boolean | null,
>     voided_at?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     is_advance_charge?: boolean | null,
>     business_entity_id?: string | null,
>     deleted?: boolean | null
>   }[] | null
> } | null
> ```

***

### createSubscriptionForItems

`customers.createSubscriptionForItems`

Create a subscription. Note: This endpoint optionally supports 3DS. To use it create a payment\_intent and provide it via this endpoint. Creates a new subscription for an existing customer in Chargebee. Any available credits and excess payments for the customer are automatically applied on the invoice. Creates the subscription and, unless it starts in trial or later, invoices and charges the customer at once.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.customers.createSubscriptionForItems({ customerId: 'cust_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customerId` | `string` | Yes | — |
| `id` | `string` | No | A unique and immutable identifier for the subscription. If not provided, it is autogenerated. |
| `business_entity_id` | `string` | No | The unique ID of the [business entity](https://docs.corsair.dev/docs/api/advanced-features) this subscription should be [linked](https://docs.corsair.dev/docs/api/advanced-features) to. Applicable only when multiple business entities have been created for the site. This must be the same as the business entity of the `{customer_id}` for the operation to be successful. **Note** An alternative way of passing this parameter is by means of a [custom HTTP header](https://docs.corsair.dev/docs/api/advanced-features). |
| `brand_id` | `string` | No | The unique ID of the [brand](https://docs.corsair.dev/docs/api/brands) this subscription should be linked to. Applicable only when multiple brands have been created for the site. Unlike `business_entity_id`, this need not match the brand of the `{customer_id}`; when the two differ, the value provided here is used for the subscription. An alternative way of passing this parameter is by means of the `chargebee-brand-id` custom HTTP header; when both are provided, they must specify the same brand. **Default behavior** \* When not provided, the subscription is linked to the brand of the customer it is created for. |
| `trial_end` | `number` | No | 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. |
| `billing_cycles` | `number` | No | Specifies the number of billing cycles for the subscription. The behavior of the subscription after the billing cycles have completed depends on whether the subscription is on a [contract term](https://docs.corsair.dev/docs/api/contract_terms) or not. \* When the subscription is not on a contract term: if `billing_cycles` is not provided, then the billing cycles [set for the plan-item price](https://docs.corsair.dev/docs/api/item_prices/item_price-object#billing_cycles) is used. Moreover, once the `billing_cycles` have completed, the subscription cancels. \* When the subscription is on a contract term: Providing `billing_cycles` is mandatory. Moreover, once the `billing_cycles` have completed, the behavior of the subscription is determined by the `contract_term[action_at_term_end]` parameter. |
| `mandatory_items_to_remove` | `string[]` | No | Item ids of [mandatorily attached addons](https://docs.corsair.dev/docs/api/attached_items) that are to be removed from the subscription. |
| `net_term_days` | `number` | No | Defines [Net D](https://www.chargebee.com/docs/net_d.html) for the subscription. Net D is the number of days from [`invoice.date`](https://docs.corsair.dev/docs/api/invoices/invoice-object#date) until payment for the invoice is due. \* If a value is provided: Net D is set explicitly for the subscription to the value provided. The value must be one among those defined in the [site configuration](https://www.chargebee.com/docs/net_d.html#enable-net-d-for-chargebee-invoices). \* If not provided: The attribute is not set and therefore not returned by the API. In this case, when an invoice is raised - whether now or later - the `net_term_days` defined at the [customer level](https://docs.corsair.dev/docs/api/customers/customer-object#net_term_days) is considered. . |
| `start_date` | `number` | No | 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. . |
| `auto_collection` | `on \| off` | No | Defines whether payments need to be collected automatically for this subscription. Overrides customer's auto-collection property. \* 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. |
| `terms_to_charge` | `number` | No | 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` | `immediate \| delayed` | No | 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. \* 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. |
| `offline_payment_method` | `no_preference \| cash \| check \| bank_transfer \| ach_credit \| sepa_credit \| boleto \| us_automated_bank_transfer \| eu_automated_bank_transfer \| uk_automated_bank_transfer \| jp_automated_bank_transfer \| mx_automated_bank_transfer \| custom` | No | The preferred offline payment method for the subscription. \* sepa\_credit - SEPA Credit \* cash - Cash \* no\_preference - No Preference \* bank\_transfer - Bank Transfer \* check - Check \* eu\_automated\_bank\_transfer - EU Automated Bank Transfer \* jp\_automated\_bank\_transfer - JP Automated Bank Transfer \* uk\_automated\_bank\_transfer - UK Automated Bank Transfer \* custom - Custom \* boleto - Boleto \* mx\_automated\_bank\_transfer - MX Automated Bank Transfer \* us\_automated\_bank\_transfer - US Automated Bank Transfer \* ach\_credit - ACH Credit |
| `po_number` | `string` | No | Purchase order number for this subscription. |
| `coupon_ids` | `string[]` | No | List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes. |
| `payment_source_id` | `string` | No | Id of the payment source to be attached to this subscription. |
| `override_relationship` | `boolean` | No | If `true` , ignores the [hierarchy relationship](https://docs.corsair.dev/docs/api/customers/customer-object#relationship) and uses customer as payment and invoice owner. |
| `invoice_notes` | `string` | No | A customer-facing note added to all invoices associated with this subscription. This note is one among [all the notes](https://docs.corsair.dev/docs/api/invoices/invoice-object#notes) displayed on the invoice PDF. |
| `invoice_date` | `number` | No | 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 the 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. \* It is not earlier than `start_date`. \* It is not more than one calendar month into the past. Eg. If today is 13th January, then you cannot pass a value that is earlier than 13th December. \* `invoice_immediately` is true. . |
| `meta_data` | `object` | No | A collection of key-value pairs that provides extra information about the subscription. **Note:** There's a character limit of 65,535. [Learn more](https://docs.corsair.dev/docs/api/advanced-features) . |
| `invoice_immediately` | `boolean` | No | 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. . |
| `replace_primary_payment_source` | `boolean` | No | Indicates whether the primary payment source should be replaced with this payment source. In case of Create Subscription for Customer endpoint, the default value is True. Otherwise, the default value is False. |
| `free_period` | `number` | No | The period of time by which the first term of the subscription is extended free of charge. The value is expressed in the time unit specified by `free_period_unit`. For example, `3` with `free_period_unit` = `month` adds 3 free months to the first term of the subscription. |
| `free_period_unit` | `day \| week \| month \| year` | No | The time unit for `free_period`. **Constraints** Must be equal to or lower than the [`period_unit`](https://docs.corsair.dev/docs/api/item_prices#period_unit) of the plan [item price](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items#subscription_items_item_price_id) of the subscription. \* week - Charge based on week(s) \* month - Charge based on month(s) \* day - Charge based on day(s) \* year - Charge based on year(s) |
| `contract_term_billing_cycle_on_renewal` | `number` | No | 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) . |
| `create_pending_invoices` | `boolean` | No | Indicates whether the invoices for this subscription are generated with a `pending` `status`. This attribute is set to `true` automatically when the subscription has item prices that belong to `metered` items. You can also set this to `true` explicitly using the [create](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items#create_pending_invoices)/[update](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#create_pending_invoices) subscription operations. This is useful in the following scenarios: \* When tracking usages and calculating usage-based charges on your end. You can then add them to the subscription as a [one-time charge](https://www.chargebee.com/docs/charges.html) at the end of the billing term. \* When you need to inspect all charges before closing invoices for this subscription. Applicable only when [Metered Billing](https://www.chargebee.com/docs/metered_billing.html) is enabled for the site . |
| `auto_close_invoices` | `boolean` | No | Set to `false` to override for this subscription, the [site-level setting](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) for auto-closing invoices. Only applicable when auto-closing invoices has been enabled for the site. This attribute has a higher precedence than the same attribute at the [customer level](https://docs.corsair.dev/docs/api/customers/customer-object#auto_close_invoices) . |
| `first_invoice_pending` | `boolean` | No | If you want to bill the usages from the previous billing cycle, set this parameter to `true`. This is useful if the subscription has moved from another system into Chargebee and you haven't closed the previous cycle's invoice yet. This creates a `pending` invoice immediately on subscription creation, to which you can [add usages](https://docs.corsair.dev/docs/api/usages/create-a-usage) for the previous cycle. If any non-`metered` items are present for the current term, they're also added to this `pending` invoice. As with all `pending` invoices, this invoice is also [closed automatically](https://www.chargebee.com/docs/metered_billing.html#configuring-metered-billing) or via an [API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). This parameter can be passed only when the `create_pending_invoices` is `true` . |
| `trial_end_action` | `site_default \| plan_default \| activate_subscription \| cancel_subscription` | No | Applicable only when [End-of-trial Action](https://www.chargebee.com/docs/2.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. \* activate\_subscription - The subscription activates and charges are raised for non-metered items. \* cancel\_subscription - The subscription cancels. \* plan\_default - The action [configured for the site](https://www.chargebee.com/docs/2.0/trial_periods_hidden.html#how-to-define-the-end-of-trial-actions-for-subscriptions) at the time when the trial ends, takes effect. \* site\_default - This is the default value. The action [configured for the site](https://www.chargebee.com/docs/2.0/trial_periods_hidden.html#how-to-define-the-end-of-trial-actions-for-subscriptions) at the time when the trial ends, takes effect. |
| `payment_initiator` | `customer \| merchant` | No | The type of initiator to be used for the payment request triggered by this operation. \* customer - Pass this value to indicate that the request is initiated by the customer \* merchant - Pass this value to indicate that the request is initiated by the merchant |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `statement_descriptor` | `object` | No | Parameters for statement\_descriptor |
| `payment_intent` | `object` | No | Parameters for payment\_intent |
| `contract_term` | `object` | No | Parameters for contract\_term |
| `billing_override` | `object` | No | Specify limits on how credits and payments are applied to individual invoices for the subscription. Contact [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. Note: These limits do not apply to [consolidated invoices](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) . |
| `subscription_items` | `object` | No | Parameters for subscription\_items |
| `discounts` | `object` | No | Parameters for discounts |
| `item_tiers` | `object` | No | Parameters for item\_tiers |

> [accordion] meta\_data full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] statement\_descriptor full type
>
> ```ts theme={null}
> {
>   descriptor?: string
> }
> ```

> [accordion] payment\_intent full type
>
> ```ts theme={null}
> {
>   id?: string,
>   gateway_account_id?: string,
>   gw_token?: string,
>   payment_method_type?: card | ideal | sofort | bancontact | google_pay | dotpay | giropay | apple_pay | upi | netbanking_emandates | paypal_express_checkout | direct_debit | boleto | venmo | amazon_payments | pay_to | faster_payments | sepa_instant_transfer | klarna_pay_now | online_banking_poland | payconiq_by_bancontact | electronic_payment_standard | kbc_payment_button | pay_by_bank | trustly | stablecoin | kakao_pay | naver_pay | revolut_pay | cash_app_pay | wechat_pay | alipay | twint | go_pay | grab_pay | pay_co | after_pay | swish | payme | pix | klarna | alipay_hk | paypay | gcash | south_korean_cards | paynow | bizum | promptpay | dana | touch_n_go | tamara | qpay | ovo | momo | mercado_pago | nequi | nupay | picpay | thai_qr | blik | fpx | wero | p24 | affirm_pay | rakuten_pay,
>   reference_id?: string,
>   additional_information?: {
>   }
> }
> ```

> [accordion] contract\_term full type
>
> ```ts theme={null}
> {
>   action_at_term_end?: renew | evergreen | cancel,
>   cancellation_cutoff_period?: number
> }
> ```

> [accordion] billing\_override full type
>
> ```ts theme={null}
> {
>   max_excess_payment_usage?: number,
>   max_refundable_credits_usage?: number
> }
> ```

> [accordion] subscription\_items full type
>
> ```ts theme={null}
> {
>   item_price_id: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   unit_price?: number[],
>   unit_price_in_decimal?: string[],
>   billing_cycles?: number[],
>   trial_end?: number[],
>   service_period_days?: number[],
>   charge_on_event?: (subscription_creation | subscription_trial_start | plan_activation | subscription_activation | contract_termination)[],
>   charge_once?: boolean[],
>   description?: string[],
>   charge_on_option?: (immediately | on_event)[],
>   usage_accumulation_reset_frequency?: (never | subscription_billing_frequency)[]
> }
> ```

> [accordion] discounts full type
>
> ```ts theme={null}
> {
>   apply_on?: (invoice_amount | specific_item_price)[],
>   duration_type: (one_time | forever | limited_period)[],
>   percentage?: number[],
>   amount?: number[],
>   period?: number[],
>   period_unit?: (day | week | month | year)[],
>   included_in_mrr?: boolean[],
>   item_price_id?: string[],
>   quantity?: number[],
>   description?: string[]
> }
> ```

> [accordion] item\_tiers full type
>
> ```ts theme={null}
> {
>   item_price_id?: string[],
>   starting_unit?: number[],
>   ending_unit?: number[],
>   price?: number[],
>   starting_unit_in_decimal?: string[],
>   ending_unit_in_decimal?: string[],
>   price_in_decimal?: string[],
>   pricing_type?: (per_unit | flat_fee | package)[],
>   package_size?: number[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `subscription` | `object \| null` | No | A Chargebee subscription connects a customer record to products/services. It describes what the customer has signed up for and how often they're charged for it. The essential components of a subscription are: \* A [plan-item price](https://docs.corsair.dev/docs/api/item_prices). \* Any addon- and charge-item prices applied to the subscription. \* Any [coupons](https://docs.corsair.dev/docs/api/coupons) applied. \* Any [discounts](https://docs.corsair.dev/docs/api/discounts) applied. The charges in a subscription are billed via invoices. **Note:** The maximum number of subscriptions for any given [customer](https://docs.corsair.dev/docs/api/customers) ([active](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#status) or not) is 900. #### Subscription billing frequencies Chargebee offers two billing frequency options for subscriptions: \* **Plan-based billing** (`default`): Subscriptions are billed based on the billing period defined for the item price of the `item_type` `plan`. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/subscriptions#plan-based-billing). \* **Multi-frequency billing** : Subscriptions are billed according to the billing period of each recurring item price within the subscription. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing). **Important** [Limitations](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing#limitations) of Multi-frequency billing. The selection of the billing frequency preference is configured at the site level. #### Item price compatibility in a subscription When creating or updating a subscription, one of the item prices specified under subscription\_items must be a plan-item price. The remaining must be compatible addon- or charge-item prices. An item price is compatible with a plan-item price if their currencies are the same. Additionally, an addon-item price is compatible with a plan-item price only if their billing frequencies meet the following conditions: \| `period_unit` for plan-item price \| Compatible `period_unit` for addon-item price \| Compatible period for addon-item price \| \|-----------------------------------\|-----------------------------------------------\|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `day` \| `day` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `10`, then the period of the addon-item price can be `10`, `5`, `2`, or `1`. \| \| `week` \| `week` or `day` \| The `period` (in days) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the period of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `week`, `period` can be `2` or `1`. \* for `period_unit` as `day`, `period` can be `14`, `7`, `2`, or `1`. \| \| `month` \| `month` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `6`, then the `period` of the addon-item price can be `6`, `3`, `2`, or `1`. \| \| `year` \| `year` or `month` \| The `period` (in months) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the `period` of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `year`, `period` can be `2` or `1`. \* for `period_unit` as `month`, `period` can be `24`, `12`, `8`, `6`, `4`, `3`, `2`, or `1`. \| #### Tax provider fields **Avalara** : Merchants using **Avalara Sales Tax** can optionally associate each item price with a locationCode (from their Avalara company locations), so tax can be resolved correctly at the line item level. \| Field ID \| Field Value \| APIs \| \|--------------------------------------------------------------------------------\|----------------------------------------------------------------------\|--------------------------------------------------------------------------------\| \| `locationCode` \| Merchant to configure it on Avalara Platform under company locations \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| **Anrok**: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation \| Field ID \| Field Value \| APIs \| \|---------------------------------------------------------------------------------------------------------------------------------------\|---------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------\| \| `additionalTaxRegistrationNumber` \| Canadian tax registration numbers in comma separated fashion. \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| **Vertex**: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration **Note:** Field Id like `customerCode` , `customerClass` , and`taxExempted` belong to the customer object. Field Id like `productCode` , `productClass` , `productTaxCode` , and `productClass` belong to the product object. \| Field ID \| Field Value \| APIs \| \|-----------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productCode` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `customerCode` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `customerClass` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **Taxamo:** Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration \| Field Id \| Field Value \| APIs \| \|------------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productTaxCode` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `taxExempted` \| Merchant to configure it on Taxamo Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **cbtaxes**: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India. \| Field ID \| Field Value \| APIs \| \|---------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `indiaSez` \| `SEZ_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaSez` \| `SEZ_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **All**: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level \| Field ID \| Field Value \| APIs \| \|-------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `priceType` \| `TAX_INCLUSIVE` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| \| `TAX_EXCLUSIVE` \| \| \| \| `SITE_DEFAULT` or blank \| Removes price type override, and allows site level configuration to be used for tax calculation. \| #### Ramps API compatibility mode If you want to schedule changes on a subscription, use the [Ramps API](https://docs.corsair.dev/docs/api/ramps). If you are currently scheduling changes through the [Update subscription API](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items), migrate to the Ramps API. To get started, [request access for Subscription Ramps](https://app.chargebee.com/login?forward=https://app.chargebee.com/request_access/subscription-ramps\&ref=feature). Chargebee will enable Ramps compatibility mode for your site. Once enabled, you can test the Ramps API without impacting your existing integrations. The following parts of the Billing API have subtle differences in behavior when the Ramps feature is disabled versus when it is enabled with compatibility mode. (Follow the links to learn more.) \* The value of the [`subscription.has_scheduled_changes`](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#has_scheduled_changes) attribute. \* [Update subscription](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#impact-scheduled-changes) \* [Create Checkout for updating a subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription#impact-scheduled-changes) \* [Remove scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/remove-scheduled-changes) \* [Retrieve with scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/retrieve-with-scheduled-changes) \* [Create a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/create-a-quote-for-update-subscription-items) \* [Edit a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/edit-update-subscription-quote-for-items) \* [Portal sessions](https://docs.corsair.dev/docs/api/portal_sessions#scheduled-subscription-changes) |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |
| `unbilled_charges` | `object[] \| null` | No | Resource object representing unbilled\_charge |

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   currency_code?: string | null,
>   billing_period?: number | null,
>   billing_period_unit?: string | null,
>   start_date?: number | null,
>   trial_end?: number | null,
>   remaining_billing_cycles?: number | null,
>   po_number?: string | null,
>   auto_collection?: string | null,
>   plan_quantity_in_decimal?: string | null,
>   plan_unit_price_in_decimal?: string | null,
>   customer_id?: string | null,
>   status?: string | null,
>   trial_start?: number | null,
>   trial_end_action?: string | null,
>   current_term_start?: number | null,
>   current_term_end?: number | null,
>   next_billing_at?: number | null,
>   created_at?: number | null,
>   started_at?: number | null,
>   activated_at?: number | null,
>   contract_term_billing_cycle_on_renewal?: number | null,
>   override_relationship?: boolean | null,
>   pause_date?: number | null,
>   resume_date?: number | null,
>   cancelled_at?: number | null,
>   cancel_reason?: string | null,
>   created_from_ip?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   has_scheduled_advance_invoices?: boolean | null,
>   has_scheduled_changes?: boolean | null,
>   payment_source_id?: string | null,
>   plan_free_quantity_in_decimal?: string | null,
>   plan_amount_in_decimal?: string | null,
>   cancel_schedule_created_at?: number | null,
>   offline_payment_method?: string | null,
>   channel?: string | null,
>   net_term_days?: number | null,
>   active_id?: string | null,
>   due_invoices_count?: number | null,
>   due_since?: number | null,
>   total_dues?: number | null,
>   mrr?: number | null,
>   exchange_rate?: number | null,
>   base_currency_code?: string | null,
>   invoice_notes?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   changes_scheduled_at?: number | null,
>   cancel_reason_code?: string | null,
>   free_period?: number | null,
>   free_period_unit?: string | null,
>   create_pending_invoices?: boolean | null,
>   auto_close_invoices?: boolean | null,
>   business_entity_id?: string | null,
>   decommissioned?: boolean | null,
>   brand_id?: string | null,
>   subscription_items?: {
>     item_price_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     amount?: number | null,
>     current_term_start?: number | null,
>     current_term_end?: number | null,
>     next_billing_at?: number | null,
>     amount_in_decimal?: string | null,
>     billing_period?: number | null,
>     billing_period_unit?: string | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     trial_end?: number | null,
>     billing_cycles?: number | null,
>     service_period_days?: number | null,
>     charge_on_event?: string | null,
>     charge_once?: boolean | null,
>     charge_on_option?: string | null,
>     proration_type?: string | null,
>     usage_accumulation_reset_frequency?: string | null,
>     description?: string | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null,
>     index?: number | null
>   }[] | null,
>   charged_items?: {
>     item_price_id?: string | null,
>     last_charged_at?: number | null
>   }[] | null,
>   coupons?: {
>     coupon_id?: string | null,
>     apply_till?: number | null,
>     applied_count?: number | null,
>     coupon_code?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_info?: {
>     referral_code?: string | null,
>     coupon_code?: string | null,
>     referrer_id?: string | null,
>     external_reference_id?: string | null,
>     reward_status?: string | null,
>     referral_system?: string | null,
>     account_id?: string | null,
>     campaign_id?: string | null,
>     external_campaign_id?: string | null,
>     friend_offer_type?: string | null,
>     referrer_reward_type?: string | null,
>     notify_referral_system?: string | null,
>     destination_url?: string | null,
>     post_purchase_widget_enabled?: boolean | null
>   } | null,
>   billing_override?: {
>     max_excess_payment_usage?: number | null,
>     max_refundable_credits_usage?: number | null
>   } | null,
>   contract_term?: {
>     id?: string | null,
>     status?: string | null,
>     contract_start?: number | null,
>     contract_end?: number | null,
>     billing_cycle?: number | null,
>     action_at_term_end?: string | null,
>     total_contract_value?: number | null,
>     total_contract_value_before_tax?: number | null,
>     cancellation_cutoff_period?: number | null,
>     created_at?: number | null,
>     subscription_id?: string | null,
>     remaining_billing_cycles?: number | null
>   } | null,
>   discounts?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     description?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     quantity?: number | null,
>     currency_code?: string | null,
>     duration_type?: string | null,
>     period?: number | null,
>     period_unit?: string | null,
>     included_in_mrr?: boolean | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null,
>     apply_till?: number | null,
>     applied_count?: number | null,
>     coupon_id?: string | null,
>     index?: number | null
>   }[] | null
> } | null
> ```

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] card full type
>
> ```ts theme={null}
> {
>   payment_source_id?: string | null,
>   status?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   ref_tx_id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   iin?: string | null,
>   last4?: string | null,
>   card_type?: string | null,
>   funding_type?: string | null,
>   expiry_month?: number | null,
>   expiry_year?: number | null,
>   issuing_country?: string | null,
>   billing_addr1?: string | null,
>   billing_addr2?: string | null,
>   billing_city?: string | null,
>   billing_state_code?: string | null,
>   billing_state?: string | null,
>   billing_country?: string | null,
>   billing_zip?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   ip_address?: string | null,
>   powered_by?: string | null,
>   customer_id?: string | null,
>   masked_number?: string | null
> } | null
> ```

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

> [accordion] unbilled\_charges full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   date_from?: number | null,
>   date_to?: number | null,
>   unit_amount?: number | null,
>   pricing_model?: string | null,
>   quantity?: number | null,
>   amount?: number | null,
>   currency_code?: string | null,
>   discount_amount?: number | null,
>   description?: string | null,
>   entity_type?: string | null,
>   entity_id?: string | null,
>   is_voided?: boolean | null,
>   voided_at?: number | null,
>   unit_amount_in_decimal?: string | null,
>   quantity_in_decimal?: string | null,
>   amount_in_decimal?: string | null,
>   created_at?: number | null,
>   updated_at?: number | null,
>   is_advance_charge?: boolean | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null,
>   tiers?: {
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null
> }[] | null
> ```

***

### createSubscriptionForItemsEstimate

`customers.createSubscriptionForItemsEstimate`

Estimate for creating a subscription. Generates an estimate without creating a subscription. This endpoint can be called when you want to preview details of a new subscription before actually creating one. The following conditions must be met or tax calculation is ignored: \* The taxability attribute for the customer is true.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.customers.createSubscriptionForItemsEstimate({ customerId: 'cust_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customerId` | `string` | Yes | — |
| `use_existing_balances` | `boolean` | No | 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` | `boolean` | No | 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. . |
| `billing_cycles` | `number` | No | The number of billing cycles the subscription runs before canceling. If not provided, then the billing cycles [set for the plan-item price](https://docs.corsair.dev/docs/api/item_prices/item_price-object#billing_cycles) is used. |
| `mandatory_items_to_remove` | `string[]` | No | Item ids of [mandatorily attached addons](https://docs.corsair.dev/docs/api/attached_items) that are to be removed from the subscription. |
| `terms_to_charge` | `number` | No | 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` | `immediate \| delayed` | No | 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. \* 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. |
| `invoice_date` | `number` | No | 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. |
| `coupon_ids` | `string[]` | No | List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes. |
| `subscription` | `object` | No | Parameters for subscription |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `billing_address` | `object` | No | Parameters for billing\_address |
| `contract_term` | `object` | No | Parameters for contract\_term |
| `billing_override` | `object` | No | Parameters for billing\_override |
| `subscription_items` | `object` | No | Parameters for subscription\_items |
| `discounts` | `object` | No | Parameters for discounts |
| `item_tiers` | `object` | No | Parameters for item\_tiers |

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id?: string,
>   trial_end?: number,
>   start_date?: number,
>   offline_payment_method?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
>   free_period?: number,
>   free_period_unit?: day | week | month | year,
>   contract_term_billing_cycle_on_renewal?: number,
>   trial_end_action?: site_default | plan_default | activate_subscription | cancel_subscription
> }
> ```

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] billing\_address full type
>
> ```ts theme={null}
> {
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] contract\_term full type
>
> ```ts theme={null}
> {
>   action_at_term_end?: renew | evergreen | cancel,
>   cancellation_cutoff_period?: number
> }
> ```

> [accordion] billing\_override full type
>
> ```ts theme={null}
> {
>   max_excess_payment_usage?: number,
>   max_refundable_credits_usage?: number
> }
> ```

> [accordion] subscription\_items full type
>
> ```ts theme={null}
> {
>   item_price_id: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   unit_price?: number[],
>   unit_price_in_decimal?: string[],
>   billing_cycles?: number[],
>   trial_end?: number[],
>   service_period_days?: number[],
>   charge_on_event?: (subscription_creation | subscription_trial_start | plan_activation | subscription_activation | contract_termination)[],
>   charge_once?: boolean[],
>   description?: string[],
>   charge_on_option?: (immediately | on_event)[]
> }
> ```

> [accordion] discounts full type
>
> ```ts theme={null}
> {
>   apply_on?: (invoice_amount | specific_item_price)[],
>   duration_type: (one_time | forever | limited_period)[],
>   percentage?: number[],
>   amount?: number[],
>   period?: number[],
>   period_unit?: (day | week | month | year)[],
>   included_in_mrr?: boolean[],
>   item_price_id?: string[],
>   quantity?: number[],
>   description?: string[]
> }
> ```

> [accordion] item\_tiers full type
>
> ```ts theme={null}
> {
>   item_price_id?: string[],
>   starting_unit?: number[],
>   ending_unit?: number[],
>   price?: number[],
>   starting_unit_in_decimal?: string[],
>   ending_unit_in_decimal?: string[],
>   price_in_decimal?: string[],
>   pricing_type?: (per_unit | flat_fee | package)[],
>   package_size?: number[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `estimate` | `object \| null` | No | During the process of signing up customers to subscriptions, use the Estimates API to evaluate the details of the purchase before actually signing them up. The details returned by the API include the invoice amounts, next billing date and unbilled charges. For example, consider that you are creating a new subscription or update an existing one. Use the Estimates API before that to deduce the details such as the amount the customer would be charged, the state the subscription would be in after creation or updation, and so on. If you have configured the [Avalara integration](https://www.chargebee.com/docs/2.0/avalara.html), Chargebee retrieves the tax amount from Avalara for the invoice. This counts against your Avalara API limits. |

> [accordion] estimate full type
>
> ```ts theme={null}
> {
>   created_at?: number | null,
>   subscription_estimate?: {
>     id?: string | null,
>     currency_code?: string | null,
>     status?: string | null,
>     trial_end_action?: string | null,
>     next_billing_at?: number | null,
>     pause_date?: number | null,
>     resume_date?: number | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     contract_term?: {
>       id?: string | null,
>       status?: string | null,
>       contract_start?: number | null,
>       contract_end?: number | null,
>       billing_cycle?: number | null,
>       action_at_term_end?: string | null,
>       total_contract_value?: number | null,
>       total_contract_value_before_tax?: number | null,
>       cancellation_cutoff_period?: number | null,
>       created_at?: number | null,
>       subscription_id?: string | null,
>       remaining_billing_cycles?: number | null
>     } | null
>   } | null,
>   subscription_estimates?: {
>     id?: string | null,
>     currency_code?: string | null,
>     status?: string | null,
>     trial_end_action?: string | null,
>     next_billing_at?: number | null,
>     pause_date?: number | null,
>     resume_date?: number | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     contract_term?: {
>       id?: string | null,
>       status?: string | null,
>       contract_start?: number | null,
>       contract_end?: number | null,
>       billing_cycle?: number | null,
>       action_at_term_end?: string | null,
>       total_contract_value?: number | null,
>       total_contract_value_before_tax?: number | null,
>       cancellation_cutoff_period?: number | null,
>       created_at?: number | null,
>       subscription_id?: string | null,
>       remaining_billing_cycles?: number | null
>     } | null
>   }[] | null,
>   invoice_estimate?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   } | null,
>   invoice_estimates?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   }[] | null,
>   payment_schedule_estimates?: {
>     id?: string | null,
>     scheme_id?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     amount?: number | null,
>     currency_code?: string | null,
>     schedule_entries?: {
>       id?: string | null,
>       date?: number | null,
>       amount?: number | null,
>       scheduled_amount?: number | null,
>       status?: string | null
>     }[] | null
>   }[] | null,
>   next_invoice_estimate?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   } | null,
>   credit_note_estimates?: {
>     reference_invoice_id?: string | null,
>     type?: string | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     amount_allocated?: number | null,
>     amount_available?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   }[] | null,
>   unbilled_charge_estimates?: {
>     id?: string | null,
>     customer_id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     pricing_model?: string | null,
>     quantity?: number | null,
>     amount?: number | null,
>     currency_code?: string | null,
>     discount_amount?: number | null,
>     description?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     is_voided?: boolean | null,
>     voided_at?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     is_advance_charge?: boolean | null,
>     business_entity_id?: string | null,
>     deleted?: boolean | null
>   }[] | null
> } | null
> ```

***

### createSubscriptionQuote

`customers.createSubscriptionQuote`

Create quote for a new subscription. Creates a quote for a new subscription under the customer specified. To send this quote, use "Send Email" quote action in the Chargebee application. Product Catalog 1.0 sites only.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.customers.createSubscriptionQuote({ customerId: 'cust_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `customerId` | `string` | Yes | — |
| `name` | `string` | No | The quote name will be used as the pdf name of the quote. |
| `notes` | `string` | No | Notes specific to this quote that you want customers to see on the quote PDF. |
| `expires_at` | `number` | No | Quotes will be valid till this date. After this quote will be marked as closed. |
| `billing_cycles` | `number` | No | Number of cycles(plan interval) this subscription should be charged. After the billing cycles exhausted, the subscription will be cancelled. |
| `mandatory_addons_to_remove` | `string[]` | No | List of addons IDs that are mandatory to the plan and has to be removed from the subscription. |
| `terms_to_charge` | `number` | No | 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` | `immediate \| delayed` | No | 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. \* delayed - Subscription period will be aligned with the configured billing date at the next renewal. \* immediate - Subscription period will be aligned with the configured billing date immediately, with credits or charges raised accordingly.. |
| `coupon_ids` | `string[]` | No | Identifier of the coupon as a List. Coupon Codes can also be passed. |
| `subscription` | `object` | No | Parameters for subscription |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `contract_term` | `object` | No | Parameters for contract\_term |
| `addons` | `object` | No | Parameters for addons |
| `event_based_addons` | `object` | No | Parameters for event\_based\_addons |

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id?: string,
>   po_number?: string,
>   plan_id: string,
>   plan_quantity?: number,
>   plan_quantity_in_decimal?: string,
>   plan_unit_price?: number,
>   plan_unit_price_in_decimal?: string,
>   setup_fee?: number,
>   trial_end?: number,
>   start_date?: number,
>   offline_payment_method?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
>   contract_term_billing_cycle_on_renewal?: number
> }
> ```

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] contract\_term full type
>
> ```ts theme={null}
> {
>   action_at_term_end?: renew | evergreen | cancel,
>   cancellation_cutoff_period?: number
> }
> ```

> [accordion] addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   unit_price?: number[],
>   unit_price_in_decimal?: string[],
>   billing_cycles?: number[],
>   trial_end?: number[]
> }
> ```

> [accordion] event\_based\_addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   unit_price?: number[],
>   quantity_in_decimal?: string[],
>   unit_price_in_decimal?: string[],
>   service_period_in_days?: number[],
>   on_event?: (subscription_creation | subscription_trial_start | plan_activation | subscription_activation | contract_termination)[],
>   charge_once?: boolean[],
>   charge_on?: (immediately | on_event)[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `quote` | `object \| null` | No | A quote is an estimate of the invoice with the charges likely to occur when customers buy an item. A quote can be converted to a regular invoice once the customer accepts it. The line items of a quote are grouped by charge events and are available as a separate [resource](https://docs.corsair.dev/docs/api/quote_line_groups). This resource can be retrieved using the [List quote line groups](https://docs.corsair.dev/docs/api/quotes/list-quote-line-groups) endpoint. Note that the first quote line group is available within the quote resource itself and parsing the quote line groups object is not required. |
| `quoted_subscription` | `object \| null` | No | When a [quote](https://docs.corsair.dev/docs/api/quotes) is created, it generates the `quoted_subscription` resource. This captures most of the details of the subscription that would eventually be created once the quote is invoiced. This resource is returned along with the quote for most of the associated operations. |

> [accordion] quote full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   po_number?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   invoice_id?: string | null,
>   status?: string | null,
>   operation_type?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   valid_till?: number | null,
>   date?: number | null,
>   total_payable?: number | null,
>   charge_on_acceptance?: number | null,
>   sub_total?: number | null,
>   total?: number | null,
>   credits_applied?: number | null,
>   amount_paid?: number | null,
>   amount_due?: number | null,
>   version?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   vat_number_prefix?: string | null,
>   tax_category?: string | null,
>   currency_code?: string | null,
>   notes?: any[] | null,
>   contract_term_start?: number | null,
>   contract_term_end?: number | null,
>   contract_term_termination_fee?: number | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null,
>   total_contract_value?: number | null,
>   total_discount?: number | null,
>   has_entitlements?: boolean | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null
> } | null
> ```

> [accordion] quoted\_subscription full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   plan_id?: string | null,
>   plan_quantity?: number | null,
>   plan_unit_price?: number | null,
>   setup_fee?: number | null,
>   billing_period?: number | null,
>   billing_period_unit?: string | null,
>   start_date?: number | null,
>   trial_end?: number | null,
>   remaining_billing_cycles?: number | null,
>   po_number?: string | null,
>   auto_collection?: string | null,
>   plan_quantity_in_decimal?: string | null,
>   plan_unit_price_in_decimal?: string | null,
>   changes_scheduled_at?: number | null,
>   change_option?: string | null,
>   free_period?: number | null,
>   free_period_unit?: string | null,
>   contract_term_billing_cycle_on_renewal?: number | null,
>   addons?: {
>     id?: string | null,
>     quantity?: number | null,
>     unit_price?: number | null,
>     amount?: number | null,
>     trial_end?: number | null,
>     remaining_billing_cycles?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     proration_type?: string | null
>   }[] | null,
>   event_based_addons?: {
>     id?: string | null,
>     quantity?: number | null,
>     unit_price?: number | null,
>     on_event?: string | null,
>     charge_once?: boolean | null,
>     quantity_in_decimal?: string | null,
>     unit_price_in_decimal?: string | null
>   }[] | null,
>   coupons?: {
>     coupon_id?: string | null
>   }[] | null,
>   quoted_contract_term?: {
>     contract_start?: number | null,
>     contract_end?: number | null,
>     billing_cycle?: number | null,
>     action_at_term_end?: string | null,
>     total_contract_value?: number | null,
>     cancellation_cutoff_period?: number | null
>   } | null
> } | null
> ```

***

### createSubscriptionQuoteForItems

`customers.createSubscriptionQuoteForItems`

Create a quote for subscription creation. Create a quote for new subscription line items of a customer.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.customers.createSubscriptionQuoteForItems({ customerId: 'cust_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customerId` | `string` | Yes | — |
| `name` | `string` | No | The quote name will be used as the pdf name of the quote. |
| `notes` | `string` | No | Notes specific to this quote that you want customers to see on the quote PDF. |
| `expires_at` | `number` | No | Quotes will be valid till this date. After this quote will be marked as closed. |
| `billing_cycles` | `number` | No | The number of billing cycles the subscription runs before canceling. If not provided, then the billing cycles [set for the plan-item price](https://docs.corsair.dev/docs/api/item_prices/item_price-object#billing_cycles) is used. |
| `mandatory_items_to_remove` | `string[]` | No | Item ids of [mandatorily attached addons](https://docs.corsair.dev/docs/api/attached_items) that are to be removed from the subscription. |
| `terms_to_charge` | `number` | No | 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` | `immediate \| delayed` | No | 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. \* 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` | `string[]` | No | The list of [IDs](https://docs.corsair.dev/docs/api/coupons/coupon-object#id) of the coupons to be applied. [Coupon codes](https://docs.corsair.dev/docs/api/coupon_codes) are also supported. **Note** Not applicable when Chargebee CPQ is enabled. Use `coupons[]` array instead. |
| `billing_start_option` | `immediately \| on_specific_date` | No | When the quote is converted, this attribute determines the date/time as of when the subscription start is to be carried out. **Note** The parameter applies only when Chargebee CPQ is enabled. To request access, contact [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). \* on\_specific\_date - Upon quote conversion, the subscription is scheduled to start on the specified date. \* immediately - The subscription starts immediately upon conversion of the quote to a subscription. |
| `net_term_days` | `number` | No | The number of days from [`invoice.date`](https://docs.corsair.dev/docs/api/invoices/invoice-object#date) until payment for the invoice is due. **Note** The parameter applies only when Chargebee CPQ is enabled. To request access, contact [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). |
| `subscription` | `object` | No | Parameters for subscription |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `contract_term` | `object` | No | Parameters for contract\_term |
| `billing_address` | `object` | No | Parameters for billing\_address. |
| `subscription_items` | `object` | No | Parameters for subscription\_items |
| `discounts` | `object` | No | Parameters for discounts |
| `item_tiers` | `object` | No | Parameters for item\_tiers |
| `coupons` | `object` | No | — |
| `entitlement_overrides` | `object` | No | The set of entitlement overrides to apply on this quote. Each entry targets a feature for an entity on the quote. Overrides are always upserted. |

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id?: string,
>   po_number?: string,
>   trial_end?: number,
>   start_date?: number,
>   offline_payment_method?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
>   contract_term_billing_cycle_on_renewal?: number,
>   free_period?: number,
>   free_period_unit?: day | week | month | year
> }
> ```

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] contract\_term full type
>
> ```ts theme={null}
> {
>   action_at_term_end?: renew | evergreen | cancel,
>   cancellation_cutoff_period?: number
> }
> ```

> [accordion] billing\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] subscription\_items full type
>
> ```ts theme={null}
> {
>   item_price_id: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   unit_price?: number[],
>   unit_price_in_decimal?: string[],
>   billing_cycles?: number[],
>   trial_end?: number[],
>   service_period_days?: number[],
>   charge_on_event?: (subscription_creation | subscription_trial_start | plan_activation | subscription_activation | contract_termination)[],
>   charge_once?: boolean[],
>   charge_on_option?: (immediately | on_event)[],
>   start_date?: number[],
>   end_date?: number[],
>   description?: string[],
>   ramp_tier_id?: string[]
> }
> ```

> [accordion] discounts full type
>
> ```ts theme={null}
> {
>   apply_on?: (invoice_amount | specific_item_price)[],
>   duration_type: (one_time | forever | limited_period)[],
>   percentage?: number[],
>   amount?: number[],
>   period?: number[],
>   period_unit?: (day | week | month | year)[],
>   included_in_mrr?: boolean[],
>   item_price_id?: string[],
>   quantity?: number[],
>   start_date?: number[],
>   end_date?: number[]
> }
> ```

> [accordion] item\_tiers full type
>
> ```ts theme={null}
> {
>   item_price_id?: string[],
>   starting_unit?: number[],
>   ending_unit?: number[],
>   price?: number[],
>   starting_unit_in_decimal?: string[],
>   ending_unit_in_decimal?: string[],
>   price_in_decimal?: string[],
>   pricing_type?: (per_unit | flat_fee | package)[],
>   package_size?: number[],
>   ramp_tier_id?: string[]
> }
> ```

> [accordion] coupons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   start_date?: number[],
>   end_date?: number[]
> }
> ```

> [accordion] entitlement\_overrides full type
>
> ```ts theme={null}
> {
>   feature_id?: string[],
>   entity_id?: string[],
>   entity_type?: (plan_price | addon_price | charge_price)[],
>   value?: string[],
>   is_enabled?: boolean[],
>   start_date?: number[],
>   end_date?: number[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `quote` | `object \| null` | No | A quote is an estimate of the invoice with the charges likely to occur when customers buy an item. A quote can be converted to a regular invoice once the customer accepts it. The line items of a quote are grouped by charge events and are available as a separate [resource](https://docs.corsair.dev/docs/api/quote_line_groups). This resource can be retrieved using the [List quote line groups](https://docs.corsair.dev/docs/api/quotes/list-quote-line-groups) endpoint. Note that the first quote line group is available within the quote resource itself and parsing the quote line groups object is not required. |
| `quoted_subscription` | `object \| null` | No | When a [quote](https://docs.corsair.dev/docs/api/quotes) is created, it generates the `quoted_subscription` resource. This captures most of the details of the subscription that would eventually be created once the quote is invoiced. This resource is returned along with the quote for most of the associated operations. |
| `quoted_ramp` | `object \| null` | No | When a [quote](https://docs.corsair.dev/docs/api/quotes) is created, it generates the `quoted_ramps` resource. This captures most of the details of the [ramps](https://docs.corsair.dev/docs/api/ramps) that would eventually be created once the quote is invoiced. This resource is returned along with the quote for most of the associated operations. **Note** Applicable only when Chargebee CPQ and [Subscription Ramps](https://docs.corsair.dev/docs/api/ramps) are enabled. To request access, contact [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). |

> [accordion] quote full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   po_number?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   invoice_id?: string | null,
>   status?: string | null,
>   operation_type?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   valid_till?: number | null,
>   date?: number | null,
>   total_payable?: number | null,
>   charge_on_acceptance?: number | null,
>   sub_total?: number | null,
>   total?: number | null,
>   credits_applied?: number | null,
>   amount_paid?: number | null,
>   amount_due?: number | null,
>   version?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   vat_number_prefix?: string | null,
>   tax_category?: string | null,
>   currency_code?: string | null,
>   notes?: any[] | null,
>   contract_term_start?: number | null,
>   contract_term_end?: number | null,
>   contract_term_termination_fee?: number | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null,
>   total_contract_value?: number | null,
>   total_discount?: number | null,
>   has_entitlements?: boolean | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null
> } | null
> ```

> [accordion] quoted\_subscription full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   billing_period?: number | null,
>   billing_period_unit?: string | null,
>   start_date?: number | null,
>   trial_end?: number | null,
>   remaining_billing_cycles?: number | null,
>   po_number?: string | null,
>   auto_collection?: string | null,
>   plan_quantity_in_decimal?: string | null,
>   plan_unit_price_in_decimal?: string | null,
>   changes_scheduled_at?: number | null,
>   change_option?: string | null,
>   free_period?: number | null,
>   free_period_unit?: string | null,
>   contract_term_billing_cycle_on_renewal?: number | null,
>   coupons?: {
>     coupon_id?: string | null
>   }[] | null,
>   discounts?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     description?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     quantity?: number | null,
>     currency_code?: string | null,
>     duration_type?: string | null,
>     period?: number | null,
>     period_unit?: string | null,
>     included_in_mrr?: boolean | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null,
>     apply_till?: number | null,
>     applied_count?: number | null,
>     coupon_id?: string | null,
>     index?: number | null
>   }[] | null,
>   subscription_items?: {
>     item_price_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     amount?: number | null,
>     current_term_start?: number | null,
>     current_term_end?: number | null,
>     next_billing_at?: number | null,
>     amount_in_decimal?: string | null,
>     billing_period?: number | null,
>     billing_period_unit?: string | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     trial_end?: number | null,
>     billing_cycles?: number | null,
>     service_period_days?: number | null,
>     charge_on_event?: string | null,
>     charge_once?: boolean | null,
>     charge_on_option?: string | null,
>     proration_type?: string | null,
>     usage_accumulation_reset_frequency?: string | null,
>     description?: string | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null,
>     index?: number | null
>   }[] | null,
>   quoted_contract_term?: {
>     contract_start?: number | null,
>     contract_end?: number | null,
>     billing_cycle?: number | null,
>     action_at_term_end?: string | null,
>     total_contract_value?: number | null,
>     cancellation_cutoff_period?: number | null
>   } | null
> } | null
> ```

> [accordion] quoted\_ramp full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   line_items?: {
>     item_price_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     amount?: number | null,
>     amount_in_decimal?: string | null,
>     billing_period?: number | null,
>     billing_period_unit?: string | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     billing_cycles?: number | null,
>     service_period_days?: number | null,
>     charge_on_event?: string | null,
>     charge_once?: boolean | null,
>     charge_on_option?: string | null,
>     start_date?: number | null,
>     end_date?: number | null,
>     ramp_tier_id?: string | null,
>     discount_per_billing_cycle?: number | null,
>     discount_per_billing_cycle_in_decimal?: string | null,
>     item_level_discount_per_billing_cycle?: number | null,
>     item_level_discount_per_billing_cycle_in_decimal?: string | null,
>     amount_per_billing_cycle?: number | null,
>     amount_per_billing_cycle_in_decimal?: string | null,
>     net_amount_per_billing_cycle?: number | null,
>     net_amount_per_billing_cycle_in_decimal?: string | null,
>     description?: string | null
>   }[] | null,
>   discounts?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     duration_type?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     period?: number | null,
>     period_unit?: string | null,
>     included_in_mrr?: boolean | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     start_date?: number | null,
>     end_date?: number | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     ramp_tier_id?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   coupon_applicability_mappings?: {
>     coupon_id?: string | null,
>     applicable_item_price_ids?: string[] | null
>   }[] | null
> } | null
> ```

***

### delete

`customers.delete`

Delete a customer. Deletes a specified customer. This operation schedules the customer resource for deletion, and it is permanently deleted after a few minutes. If you wish to retain the customer data but stop further subscription renewals, consider canceling or pausing the subscriptions instead.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.customers.delete({ customerId: 'cust_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customerId` | `string` | Yes | — |
| `delete_payment_method` | `boolean` | No | Deletes the Payment Method from the gateway/vault. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] card full type
>
> ```ts theme={null}
> {
>   payment_source_id?: string | null,
>   status?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   ref_tx_id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   iin?: string | null,
>   last4?: string | null,
>   card_type?: string | null,
>   funding_type?: string | null,
>   expiry_month?: number | null,
>   expiry_year?: number | null,
>   issuing_country?: string | null,
>   billing_addr1?: string | null,
>   billing_addr2?: string | null,
>   billing_city?: string | null,
>   billing_state_code?: string | null,
>   billing_state?: string | null,
>   billing_country?: string | null,
>   billing_zip?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   ip_address?: string | null,
>   powered_by?: string | null,
>   customer_id?: string | null,
>   masked_number?: string | null
> } | null
> ```

***

### deleteCard

`customers.deleteCard`

Delete card for a customer. #### deprecated The Payment Sources API , with its additional options and improvements, obsoletes the Cards APIs. This request is obsoleted by the Delete a payment source API . Deletes the card for a customer.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.customers.deleteCard({ customerId: 'cust_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customerId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

***

### deleteContact

`customers.deleteContact`

Delete contacts for a customer. Deletes a particular contact for a customer. You can delete a contact by giving the Contact ID as the input parameter.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.customers.deleteContact({ customerId: 'cust_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customerId` | `string` | Yes | — |
| `contact` | `object` | No | Parameters for contact |

> [accordion] contact full type
>
> ```ts theme={null}
> {
>   id: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] card full type
>
> ```ts theme={null}
> {
>   payment_source_id?: string | null,
>   status?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   ref_tx_id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   iin?: string | null,
>   last4?: string | null,
>   card_type?: string | null,
>   funding_type?: string | null,
>   expiry_month?: number | null,
>   expiry_year?: number | null,
>   issuing_country?: string | null,
>   billing_addr1?: string | null,
>   billing_addr2?: string | null,
>   billing_city?: string | null,
>   billing_state_code?: string | null,
>   billing_state?: string | null,
>   billing_country?: string | null,
>   billing_zip?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   ip_address?: string | null,
>   powered_by?: string | null,
>   customer_id?: string | null,
>   masked_number?: string | null
> } | null
> ```

***

### delink

`customers.delink`

Unlink a customer from its parent account. When a customer belongs to an account hierarchy , this operation detaches the customer from its parent. The hierarchy, if any, beneath the customer remains unchanged.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.customers.delink({ customerId: 'cust_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customerId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

***

### get

`customers.get`

Retrieve a customer. Retrieves the details of the desired customer. You can use the unique identifier for a particular customer to retrieve the desired details.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.customers.get({ customerId: 'cust_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customerId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] card full type
>
> ```ts theme={null}
> {
>   payment_source_id?: string | null,
>   status?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   ref_tx_id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   iin?: string | null,
>   last4?: string | null,
>   card_type?: string | null,
>   funding_type?: string | null,
>   expiry_month?: number | null,
>   expiry_year?: number | null,
>   issuing_country?: string | null,
>   billing_addr1?: string | null,
>   billing_addr2?: string | null,
>   billing_city?: string | null,
>   billing_state_code?: string | null,
>   billing_state?: string | null,
>   billing_country?: string | null,
>   billing_zip?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   ip_address?: string | null,
>   powered_by?: string | null,
>   customer_id?: string | null,
>   masked_number?: string | null
> } | null
> ```

***

### getHierarchy

`customers.getHierarchy`

Get account hierarchy for a customer. Retrieves the full or partial account hierarchy for a customer.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.customers.getHierarchy({ hierarchy_operation_type: 'complete_hierarchy', customerId: 'cust_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `hierarchy_operation_type` | `complete_hierarchy \| subordinates \| path_to_root` | Yes | Specifies which part of the account hierarchy to retrieve for the customer identified by `{customer_id}` . \* complete\_hierarchy - Retrieve all nodes in the account hierarchy. \* subordinates - Retrieve all nodes in the account hierarchy that start from the specified customer (identified by `{customer_id}` ) and include its subordinates. In other words, get nodes in the account hierarchy tree where the root node is the specified customer. \* path\_to\_root - Retrieve nodes from the specified customer (identified by `{customer_id}` ) to the root of its account hierarchy. |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customerId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `hierarchies` | `object[] \| null` | No | Resource object representing hierarchy |

> [accordion] hierarchies full type
>
> ```ts theme={null}
> {
>   customer_id?: string | null,
>   parent_id?: string | null,
>   payment_owner_id?: string | null,
>   invoice_owner_id?: string | null,
>   has_children?: boolean | null,
>   children_ids?: string[] | null
> }[] | null
> ```

***

### getUpcomingInvoicesEstimate

`customers.getUpcomingInvoicesEstimate`

Upcoming invoices estimate. Estimate of the upcoming scheduled invoices (subscription activations, renewals etc) of a customer. For now preview of the invoices generated on the immediate upcoming date is supported.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.customers.getUpcomingInvoicesEstimate({ customerId: 'cust_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `include_usage_charges` | `boolean` | No | When set to `true`, the `invoice_estimates[]` returned in the response includes usage-based line items, if any. These are `invoice_estimates[].line_items[]` where [`line_items[].metered`](https://docs.corsair.dev/docs/api/estimates/estimate-object#invoice_estimate_line_items_metered) is `true`. **See also:** [Pricing for usage-based line items](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/link-pricing). |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customerId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `estimate` | `object \| null` | No | During the process of signing up customers to subscriptions, use the Estimates API to evaluate the details of the purchase before actually signing them up. The details returned by the API include the invoice amounts, next billing date and unbilled charges. For example, consider that you are creating a new subscription or update an existing one. Use the Estimates API before that to deduce the details such as the amount the customer would be charged, the state the subscription would be in after creation or updation, and so on. If you have configured the [Avalara integration](https://www.chargebee.com/docs/2.0/avalara.html), Chargebee retrieves the tax amount from Avalara for the invoice. This counts against your Avalara API limits. |

> [accordion] estimate full type
>
> ```ts theme={null}
> {
>   created_at?: number | null,
>   subscription_estimate?: {
>     id?: string | null,
>     currency_code?: string | null,
>     status?: string | null,
>     trial_end_action?: string | null,
>     next_billing_at?: number | null,
>     pause_date?: number | null,
>     resume_date?: number | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     contract_term?: {
>       id?: string | null,
>       status?: string | null,
>       contract_start?: number | null,
>       contract_end?: number | null,
>       billing_cycle?: number | null,
>       action_at_term_end?: string | null,
>       total_contract_value?: number | null,
>       total_contract_value_before_tax?: number | null,
>       cancellation_cutoff_period?: number | null,
>       created_at?: number | null,
>       subscription_id?: string | null,
>       remaining_billing_cycles?: number | null
>     } | null
>   } | null,
>   subscription_estimates?: {
>     id?: string | null,
>     currency_code?: string | null,
>     status?: string | null,
>     trial_end_action?: string | null,
>     next_billing_at?: number | null,
>     pause_date?: number | null,
>     resume_date?: number | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     contract_term?: {
>       id?: string | null,
>       status?: string | null,
>       contract_start?: number | null,
>       contract_end?: number | null,
>       billing_cycle?: number | null,
>       action_at_term_end?: string | null,
>       total_contract_value?: number | null,
>       total_contract_value_before_tax?: number | null,
>       cancellation_cutoff_period?: number | null,
>       created_at?: number | null,
>       subscription_id?: string | null,
>       remaining_billing_cycles?: number | null
>     } | null
>   }[] | null,
>   invoice_estimate?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   } | null,
>   invoice_estimates?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   }[] | null,
>   payment_schedule_estimates?: {
>     id?: string | null,
>     scheme_id?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     amount?: number | null,
>     currency_code?: string | null,
>     schedule_entries?: {
>       id?: string | null,
>       date?: number | null,
>       amount?: number | null,
>       scheduled_amount?: number | null,
>       status?: string | null
>     }[] | null
>   }[] | null,
>   next_invoice_estimate?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   } | null,
>   credit_note_estimates?: {
>     reference_invoice_id?: string | null,
>     type?: string | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     amount_allocated?: number | null,
>     amount_available?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   }[] | null,
>   unbilled_charge_estimates?: {
>     id?: string | null,
>     customer_id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     pricing_model?: string | null,
>     quantity?: number | null,
>     amount?: number | null,
>     currency_code?: string | null,
>     discount_amount?: number | null,
>     description?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     is_voided?: boolean | null,
>     voided_at?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     is_advance_charge?: boolean | null,
>     business_entity_id?: string | null,
>     deleted?: boolean | null
>   }[] | null
> } | null
> ```

***

### importSubscription

`customers.importSubscription`

Import subscription for customer. Import the subscription details of a customer. Product Catalog 1.0 sites only.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.customers.importSubscription({ customerId: 'cust_8gsnbYfsMLds', plan_id: 'example', status: 'future' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `customerId` | `string` | Yes | — |
| `id` | `string` | No | A unique and immutable identifier for the subscription. If not provided, it is autogenerated. |
| `plan_id` | `string` | Yes | Identifier of the plan for this subscription. |
| `plan_quantity` | `number` | No | Plan quantity for this subscription. |
| `plan_quantity_in_decimal` | `string` | No | The decimal representation of the quantity of the plan purchased. Can be provided for quantity-based plans and only when [multi-decimal pricing](https://docs.corsair.dev/docs/api/v2/pcv-1/currencies) is enabled. |
| `plan_unit_price` | `number` | No | Amount that will override the Plan's default price. The unit depends on the [type of currency](https://docs.corsair.dev/docs/api/getting-started) . |
| `plan_unit_price_in_decimal` | `string` | No | When [price overriding](http://chargebee.com/docs/price-override.html) is enabled for the site, the price or per-unit price of the plan can be set here. The value [set for the plan](https://docs.corsair.dev/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](https://docs.corsair.dev/docs/api/v2/pcv-1/currencies) is enabled. |
| `setup_fee` | `number` | No | Amount that will override the default setup fee. The unit depends on the [type of currency](https://docs.corsair.dev/docs/api/getting-started) . |
| `trial_end` | `number` | No | The time at which the trial ends for this subscription. Can be specified to override the default trial period.If **'0'** is passed, the subscription will be activated immediately. |
| `billing_cycles` | `number` | No | Number of cycles(plan interval) this subscription should be charged. After the billing cycles exhausted, the subscription will be cancelled. |
| `start_date` | `number` | No | The date/time at which the subscription is to start or has started. If not provided, the subscription starts immediately. |
| `auto_collection` | `on \| off` | No | Defines whether payments need to be collected automatically for this subscription. Overrides customer's auto-collection property. \* 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. |
| `po_number` | `string` | No | Purchase order number for this subscription. |
| `coupon_ids` | `string[]` | No | List of coupons to be applied to this subscription. You can provide coupon ids or [coupon codes](https://docs.corsair.dev/docs/api/coupon_codes) . |
| `payment_source_id` | `string` | No | Id of the payment source to be attached to this subscription. |
| `status` | `future \| in_trial \| active \| non_renewing \| paused \| cancelled \| transferred` | Yes | Current state of the subscription. \* future - The subscription is scheduled to start at a future date. \* active - The subscription is active and will be charged for automatically based on the items in it. \* cancelled - The subscription has been canceled and is no longer in service. \* transferred - The subscription has been transferred to another business entity within the organization. \* in\_trial - The subscription is in trial. \* non\_renewing - The subscription will be canceled at the end of the current term. \* paused - The subscription is [paused](https://www.chargebee.com/docs/2.0/pause-subscription.html). The subscription will not renew while in this state. |
| `current_term_end` | `number` | No | End of the current billing term. Subscription is renewed immediately after this. If not given, this will be calculated based on plan billing cycle. **Note:** For subscription status: `non_renewing`, `active`, and `paused`, `current_term_end` is required. . |
| `current_term_start` | `number` | No | Start of the current billing period of the subscription. This is required when the subscription `status` is `paused`. When the `status` is `active` or `non_renewing` , it defaults to the current time. |
| `trial_start` | `number` | No | Start of the trial period for the subscription. When not passed, it is assumed to be current time. When passed for a `future` subscription, it implies that the subscription goes into `in_trial` when it starts. |
| `cancelled_at` | `number` | No | Time at which subscription was cancelled or is set to be cancelled. |
| `started_at` | `number` | No | Time at which the subscription was started. Is `null` for `future` subscriptions as it is yet to be started. |
| `activated_at` | `number` | No | The time at which the subscription was activated. A subscription is "activated" when its `status` changes from any other, to either `active` or `non_renewing`. The following conditions must be satisfied when passing this parameter: \* When `status` is `active`, `non_renewing`, or `paused`, `activated_at` must be on or after `trial_end` or `started_at`. Additionally, `activated_at` must be on or before `current_term_start`. \* When `status` is `in_trial`, `activated_at` must precede `trial_start` #### Note: This parameter should not be provided when passing `status` as `future` or `cancelled`. |
| `pause_date` | `number` | No | When a pause has been scheduled, it is the date/time of scheduled pause. When the subscription is in the `paused` state, it is the date/time when the subscription was paused. |
| `resume_date` | `number` | No | For a paused subscription, it is the date/time when the subscription is scheduled to resume. If the pause is for an indefinite period, this value is not returned. |
| `contract_term_billing_cycle_on_renewal` | `number` | No | 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) . |
| `create_current_term_invoice` | `boolean` | No | Set as `true` if you want an invoice to be created for the subscription. \* The invoice will be created for the subscription only if it has an `active` or `non_renewing` status. \* The period of the invoice is from `current_term_start` to `current_term_end`. \* The invoice will not be generated if the subscription amount is zero dollars (for that period) and 'Hide Zero Value Line Items' option is enabled in site settings. |
| `invoice_notes` | `string` | No | A customer-facing note added to all invoices associated with this subscription. This note is one among [all the notes](https://docs.corsair.dev/docs/api/invoices/invoice-object#notes) displayed on the invoice PDF. |
| `meta_data` | `object` | No | A collection of key-value pairs that provides extra information about the subscription. **Note:** There's a character limit of 65,535. [Learn more](https://docs.corsair.dev/docs/api/v2/pcv-1/advanced-features) . |
| `contract_term` | `object` | No | Parameters for contract\_term |
| `transaction` | `object` | No | Parameters for transaction |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `addons` | `object` | No | Parameters for addons |
| `event_based_addons` | `object` | No | Parameters for event\_based\_addons |
| `charged_event_based_addons` | `object` | No | Parameters for charged\_event\_based\_addons |

> [accordion] meta\_data full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] contract\_term full type
>
> ```ts theme={null}
> {
>   id?: string,
>   created_at?: number,
>   contract_start?: number,
>   billing_cycle?: number,
>   total_amount_raised?: number,
>   total_amount_raised_before_tax?: number,
>   action_at_term_end?: renew | evergreen | cancel | renew_once,
>   cancellation_cutoff_period?: number
> }
> ```

> [accordion] transaction full type
>
> ```ts theme={null}
> {
>   amount?: number,
>   payment_method?: cash | check | bank_transfer | other | custom,
>   reference_number?: string,
>   date?: number
> }
> ```

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   unit_price?: number[],
>   unit_price_in_decimal?: string[],
>   billing_cycles?: number[]
> }
> ```

> [accordion] event\_based\_addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   unit_price?: number[],
>   quantity_in_decimal?: string[],
>   unit_price_in_decimal?: string[],
>   service_period_in_days?: number[],
>   on_event?: (subscription_creation | subscription_trial_start | plan_activation | subscription_activation | contract_termination)[],
>   charge_once?: boolean[]
> }
> ```

> [accordion] charged\_event\_based\_addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   last_charged_at?: number[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `subscription` | `object \| null` | No | Subscription represents the recurring items a customer has subscribed to. The recurring items can be - plan, addons. It may also contain the discount items like coupons. Subscriptions are invoiced at the start of every term based on the recurring items and charged immediately against the customer's credit card if 'auto\_collection' is turned 'on', otherwise the resulting invoice will be created as 'Payment Due'. **Note:** The maximum number of subscriptions for any given [customer](https://docs.corsair.dev/docs/api/customers) ([active](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#status) or not) is 900. Tax provider fields **Avalara** : Merchants using **Avalara Sales Tax** can optionally associate each item price with a locationCode (from their Avalara company locations), so tax can be resolved correctly at the line item level. \| Field ID \| Field Value \| APIs \| \|--------------------------------------------------------------------------------\|----------------------------------------------------------------------\|--------------------------------------------------------------------------------\| \| `locationCode` \| Merchant to configure it on Avalara Platform under company locations \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| **Anrok**: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation \| Field ID \| Field Value \| APIs \| \|---------------------------------------------------------------------------------------------------------------------------------------\|---------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------\| \| `additionalTaxRegistrationNumber` \| Canadian tax registration numbers in comma separated fashion. \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| **Vertex**: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration **Note:** Field Id like `customerCode` , `customerClass` , and`taxExempted` belong to the customer object. Field Id like `productCode` , `productClass` , `productTaxCode` , and `productClass` belong to the product object. \| Field ID \| Field Value \| APIs \| \|-----------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productCode` \| Merchant to configure it on Vertex Platform \| APIs having [Plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object)(PC1), [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object)(PC1) and [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object)(PC2) attributes. \| \| `productClass` \| Merchant to configure it on Vertex Platform \| APIs having [Plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object)(PC1), [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object)(PC1) and [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object)(PC2) attributes. \| \| `customerCode` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `customerClass` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **Taxamo:** Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration \| Field Id \| Field Value \| APIs \| \|------------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productTaxCode` \| Merchant to configure it on Taxamo Platform \| APIs having [Plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object)(PC1), [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object)(PC1) and Item Prices (PC2) attributes. \| \| `productClass` \| Merchant to configure it on Taxamo Platform \| APIs having [Plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object)(PC1), [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object)(PC1) and Item Prices (PC2) attributes. \| \| `taxExempted` \| Merchant to configure it on Taxamo Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **cbtaxes**: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India. \| Field ID \| Field Value \| APIs \| \|---------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `indiaSez` \| `SEZ_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaSez` \| `SEZ_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **All**: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level \| Field ID \| Field Value \| APIs \| \|-------------\|-----------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `priceType` \| `TAX_INCLUSIVE` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| \| `TAX_EXCLUSIVE` \| \| \| \| `SITE_DEFAULT` \| Removes price type override, and allows site level configuration to be used for tax calculation. \| **Note:** Make sure you choose the correct **Field ID** and **Available APIs** combination from the table above. All Product Catalog APIs include [Plans](https://docs.corsair.dev/docs/api/v2/pcv-1/plans) , [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons) , [Coupons](https://docs.corsair.dev/docs/api/v2/pcv-1/coupons) , [Coupon Sets](https://docs.corsair.dev/docs/api/v2/pcv-1/coupon_sets) , [Coupon Codes](https://docs.corsair.dev/docs/api/v2/pcv-1/coupon_codes) . |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/v2/pcv-1/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/v2/pcv-1/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any custom attributes you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/1.0/sites-intro.html)\\*\\* created before March 1, 2014\\*\\*: [updating the card](https://docs.corsair.dev/docs/api/v2/pcv-1/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/v2/pcv-1/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |
| `invoice` | `object \| null` | No | Invoices are statements containing charges, adjustments and any discounts for a subscription specific to a term. For every subscription a draft invoice (upcoming invoice) is used to track all the charges, credits and adjustments for the current term. Generally, an invoice is closed at start of the next term. However, cancellation and other such operations on subscription may trigger premature closing. While closing the invoice, in addition to recurring charges, credits and coupons are applied to calculate the final amount that is due. When invoice is closed, an attempt to charge the credit card is made. If the payment succeeds, it is marked as **paid** . If the payment fails, the invoice is marked as **payment\_due** and retry settings are taken into account. If no retry attempts are configured, the invoice is marked as **not\_paid** . If the amount due is zero or negative, the invoice is immediately marked as **paid** and the balance if any is carried forward to the next term of the invoice. **Note:** If *consolidated invoicing* is enabled, the attribute *invoice.subscription\_id* should **not** be used (as it will not be present if the invoice has lines from multiple subscriptions). Instead to know the related subscriptions, their [line\_items](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) *subscription\_id* attribute should be referred. |

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   currency_code?: string | null,
>   plan_id?: string | null,
>   plan_quantity?: number | null,
>   plan_unit_price?: number | null,
>   setup_fee?: number | null,
>   billing_period?: number | null,
>   billing_period_unit?: string | null,
>   start_date?: number | null,
>   trial_end?: number | null,
>   remaining_billing_cycles?: number | null,
>   po_number?: string | null,
>   auto_collection?: string | null,
>   plan_quantity_in_decimal?: string | null,
>   plan_unit_price_in_decimal?: string | null,
>   customer_id?: string | null,
>   plan_amount?: number | null,
>   plan_free_quantity?: number | null,
>   status?: string | null,
>   trial_start?: number | null,
>   trial_end_action?: string | null,
>   current_term_start?: number | null,
>   current_term_end?: number | null,
>   next_billing_at?: number | null,
>   created_at?: number | null,
>   started_at?: number | null,
>   activated_at?: number | null,
>   gift_id?: string | null,
>   contract_term_billing_cycle_on_renewal?: number | null,
>   override_relationship?: boolean | null,
>   pause_date?: number | null,
>   resume_date?: number | null,
>   cancelled_at?: number | null,
>   cancel_reason?: string | null,
>   affiliate_token?: string | null,
>   created_from_ip?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   has_scheduled_advance_invoices?: boolean | null,
>   has_scheduled_changes?: boolean | null,
>   payment_source_id?: string | null,
>   plan_free_quantity_in_decimal?: string | null,
>   plan_amount_in_decimal?: string | null,
>   cancel_schedule_created_at?: number | null,
>   offline_payment_method?: string | null,
>   channel?: string | null,
>   active_id?: string | null,
>   due_invoices_count?: number | null,
>   due_since?: number | null,
>   total_dues?: number | null,
>   mrr?: number | null,
>   exchange_rate?: number | null,
>   base_currency_code?: string | null,
>   invoice_notes?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   changes_scheduled_at?: number | null,
>   cancel_reason_code?: string | null,
>   free_period?: number | null,
>   free_period_unit?: string | null,
>   create_pending_invoices?: boolean | null,
>   auto_close_invoices?: boolean | null,
>   business_entity_id?: string | null,
>   decommissioned?: boolean | null,
>   brand_id?: string | null,
>   addons?: {
>     id?: string | null,
>     quantity?: number | null,
>     unit_price?: number | null,
>     amount?: number | null,
>     trial_end?: number | null,
>     remaining_billing_cycles?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     proration_type?: string | null
>   }[] | null,
>   event_based_addons?: {
>     id?: string | null,
>     quantity?: number | null,
>     unit_price?: number | null,
>     on_event?: string | null,
>     charge_once?: boolean | null,
>     quantity_in_decimal?: string | null,
>     unit_price_in_decimal?: string | null
>   }[] | null,
>   charged_event_based_addons?: {
>     id?: string | null,
>     last_charged_at?: number | null
>   }[] | null,
>   coupons?: {
>     coupon_id?: string | null,
>     apply_till?: number | null,
>     applied_count?: number | null,
>     coupon_code?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_info?: {
>     referral_code?: string | null,
>     coupon_code?: string | null,
>     referrer_id?: string | null,
>     external_reference_id?: string | null,
>     reward_status?: string | null,
>     referral_system?: string | null,
>     account_id?: string | null,
>     campaign_id?: string | null,
>     external_campaign_id?: string | null,
>     friend_offer_type?: string | null,
>     referrer_reward_type?: string | null,
>     notify_referral_system?: string | null,
>     destination_url?: string | null,
>     post_purchase_widget_enabled?: boolean | null
>   } | null,
>   contract_term?: {
>     id?: string | null,
>     status?: string | null,
>     contract_start?: number | null,
>     contract_end?: number | null,
>     billing_cycle?: number | null,
>     action_at_term_end?: string | null,
>     total_contract_value?: number | null,
>     total_contract_value_before_tax?: number | null,
>     cancellation_cutoff_period?: number | null,
>     created_at?: number | null,
>     subscription_id?: string | null,
>     remaining_billing_cycles?: number | null
>   } | null
> } | null
> ```

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] card full type
>
> ```ts theme={null}
> {
>   payment_source_id?: string | null,
>   status?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   ref_tx_id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   iin?: string | null,
>   last4?: string | null,
>   card_type?: string | null,
>   funding_type?: string | null,
>   expiry_month?: number | null,
>   expiry_year?: number | null,
>   issuing_country?: string | null,
>   billing_addr1?: string | null,
>   billing_addr2?: string | null,
>   billing_city?: string | null,
>   billing_state_code?: string | null,
>   billing_state?: string | null,
>   billing_country?: string | null,
>   billing_zip?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   ip_address?: string | null,
>   powered_by?: string | null,
>   customer_id?: string | null,
>   masked_number?: string | null
> } | null
> ```

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### importSubscriptionForItems

`customers.importSubscriptionForItems`

Import a subscription. Imports a subscription for an existing customer. Use this operation when migrating subscriptions from another billing system.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.customers.importSubscriptionForItems({ customerId: 'cust_8gsnbYfsMLds', status: 'future' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customerId` | `string` | Yes | — |
| `exhausted_coupon_ids` | `string[]` | No | Specifies the IDs of [coupons](https://docs.corsair.dev/docs/api/coupons) to be marked as exhausted. This parameter accepts a list of IDs, which must correspond to coupons with a [duration\_type](https://docs.corsair.dev/docs/api/coupons/coupon-object#duration_type) of `one_time`. Ensure that the IDs included in this parameter do not match any IDs provided in the [coupon\_ids](https://docs.corsair.dev/docs/api/subscriptions/import-subscription-for-items#coupon_ids) parameter. |
| `id` | `string` | No | A unique and immutable identifier for the subscription. If not provided, it is autogenerated. |
| `trial_end` | `number` | No | 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. |
| `billing_cycles` | `number` | No | The number of billing cycles the subscription runs before canceling. If not provided, then the billing cycles [set for the plan-item price](https://docs.corsair.dev/docs/api/item_prices/item_price-object#billing_cycles) is used. |
| `net_term_days` | `number` | No | Defines [Net D](https://www.chargebee.com/docs/net_d.html) for the subscription. Net D is the number of days within which any invoice raised for the subscription must be paid. \* If a value is provided: Net D is set explicitly for the subscription to the value provided. The value must be one among those defined in the [site configuration](https://www.chargebee.com/docs/net_d.html#enable-net-d-for-chargebee-invoices). \* If not provided: The attribute is not set and therefore not returned by the API. In this case, when an invoice is raised - whether now or later - the `net_term_days` defined at the [customer level](https://docs.corsair.dev/docs/api/customers/customer-object#net_term_days) is considered. . |
| `start_date` | `number` | No | The date/time at which the subscription is to start or has started. If not provided, the subscription starts immediately. |
| `auto_collection` | `on \| off` | No | Defines whether payments need to be collected automatically for this subscription. Overrides customer's auto-collection property. \* 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. |
| `po_number` | `string` | No | Purchase order number for this subscription. |
| `coupon_ids` | `string[]` | No | List of coupons to be applied to this subscription. You can provide coupon ids or [coupon codes](https://docs.corsair.dev/docs/api/coupon_codes) . |
| `payment_source_id` | `string` | No | Id of the payment source to be attached to this subscription. |
| `status` | `future \| in_trial \| active \| non_renewing \| paused \| cancelled \| transferred` | Yes | Current state of the subscription. \* future - The subscription is scheduled to start at a future date. \* active - The subscription is active and will be charged for automatically based on the items in it. \* cancelled - The subscription has been canceled and is no longer in service. \* transferred - The subscription has been transferred to another business entity within the organization. \* in\_trial - The subscription is in trial. \* non\_renewing - The subscription will be canceled at the end of the current term. \* paused - The subscription is [paused](https://www.chargebee.com/docs/2.0/pause-subscription.html). The subscription will not renew while in this state. |
| `current_term_end` | `number` | No | End of the current billing term. Subscription is renewed immediately after this. If not given, this will be calculated based on plan billing cycle. |
| `current_term_start` | `number` | No | Start of the current billing period of the subscription. This is required when the subscription `status` is `paused`. When the `status` is `active` or `non_renewing` , it defaults to the current time. |
| `trial_start` | `number` | No | Start of the trial period for the subscription. When not passed, it is assumed to be current time. When passed for a `future` subscription, it implies that the subscription goes into `in_trial` when it starts. |
| `cancelled_at` | `number` | No | Time at which subscription was cancelled or is set to be cancelled. |
| `started_at` | `number` | No | Time at which the subscription was started. Is `null` for `future` subscriptions as it is yet to be started. |
| `activated_at` | `number` | No | The time at which the subscription was activated. A subscription is "activated" when its `status` changes from any other, to either `active` or `non_renewing`. |
| `pause_date` | `number` | No | When a pause has been scheduled, it is the date/time of scheduled pause. When the subscription is in the `paused` state, it is the date/time when the subscription was paused. |
| `resume_date` | `number` | No | For a paused subscription, it is the date/time when the subscription is scheduled to resume. If the pause is for an indefinite period, this value is not returned. |
| `contract_term_billing_cycle_on_renewal` | `number` | No | 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) . |
| `create_current_term_invoice` | `boolean` | No | Set as `true` if you want an invoice to be created for the subscription. \* The invoice will be created for the subscription only if it has an `active` or `non_renewing` status. \* The period of the invoice is from `current_term_start` to `current_term_end`. \* The invoice will not be generated if the subscription amount is zero dollars (for that period) and 'Hide Zero Value Line Items' option is enabled in site settings. \* You may pass `transaction` details to record an offline payment against that invoice. |
| `invoice_notes` | `string` | No | A customer-facing note added to all invoices associated with this subscription. This note is one among [all the notes](https://docs.corsair.dev/docs/api/invoices/invoice-object#notes) displayed on the invoice PDF. |
| `meta_data` | `object` | No | A set of key-value pairs stored as additional information for the subscription. [Learn more](https://docs.corsair.dev/docs/api/subscriptions) . |
| `cancel_reason_code` | `string` | No | Reason code for canceling the subscription. Must be one from a list of reason codes set in the Chargebee app in **Settings \\> Configure Chargebee \\> Reason Codes \\> Subscriptions \\> Subscription Cancellation**. Must be passed if set as mandatory in the app. The codes are case-sensitive. |
| `create_pending_invoices` | `boolean` | No | Indicates whether the invoices for this subscription are generated with a `pending` `status`. This attribute is set to `true` automatically when the subscription has item prices that belong to `metered` items. You can also set this to `true` explicitly using the [create](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items#create_pending_invoices)/[update](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#create_pending_invoices) subscription operations. This is useful in the following scenarios: \* When tracking usages and calculating usage-based charges on your end. You can then add them to the subscription as a [one-time charge](https://www.chargebee.com/docs/charges.html) at the end of the billing term. \* When you need to inspect all charges before closing invoices for this subscription. Applicable only when [Metered Billing](https://www.chargebee.com/docs/metered_billing.html) is enabled for the site . |
| `auto_close_invoices` | `boolean` | No | Set to `false` to override for this subscription, the [site-level setting](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) for auto-closing invoices. Only applicable when auto-closing invoices has been enabled for the site. This attribute has a higher precedence than the same attribute at the [customer level](https://docs.corsair.dev/docs/api/customers/customer-object#auto_close_invoices) . |
| `contract_term` | `object` | No | Parameters for contract\_term |
| `transaction` | `object` | No | Parameters for transaction |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `subscription_items` | `object` | No | Parameters for subscription\_items |
| `discounts` | `object` | No | Parameters for discounts |
| `charged_items` | `object` | No | Parameters for charged\_items |
| `item_tiers` | `object` | No | Parameters for item\_tiers |

> [accordion] meta\_data full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] contract\_term full type
>
> ```ts theme={null}
> {
>   id?: string,
>   created_at?: number,
>   contract_start?: number,
>   billing_cycle?: number,
>   total_amount_raised?: number,
>   total_amount_raised_before_tax?: number,
>   action_at_term_end?: renew | evergreen | cancel | renew_once,
>   cancellation_cutoff_period?: number
> }
> ```

> [accordion] transaction full type
>
> ```ts theme={null}
> {
>   amount?: number,
>   payment_method?: cash | check | bank_transfer | other | custom,
>   reference_number?: string,
>   date?: number
> }
> ```

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] subscription\_items full type
>
> ```ts theme={null}
> {
>   item_price_id: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   unit_price?: number[],
>   unit_price_in_decimal?: string[],
>   billing_cycles?: number[],
>   trial_end?: number[],
>   service_period_days?: number[],
>   charge_on_event?: (subscription_creation | subscription_trial_start | plan_activation | subscription_activation | contract_termination)[],
>   charge_once?: boolean[],
>   description?: string[]
> }
> ```

> [accordion] discounts full type
>
> ```ts theme={null}
> {
>   apply_on?: (invoice_amount | specific_item_price)[],
>   duration_type: (one_time | forever | limited_period)[],
>   percentage?: number[],
>   amount?: number[],
>   period?: number[],
>   period_unit?: (day | week | month | year)[],
>   included_in_mrr?: boolean[],
>   item_price_id?: string[],
>   quantity?: number[]
> }
> ```

> [accordion] charged\_items full type
>
> ```ts theme={null}
> {
>   item_price_id?: string[],
>   last_charged_at?: number[]
> }
> ```

> [accordion] item\_tiers full type
>
> ```ts theme={null}
> {
>   item_price_id?: string[],
>   starting_unit?: number[],
>   ending_unit?: number[],
>   price?: number[],
>   starting_unit_in_decimal?: string[],
>   ending_unit_in_decimal?: string[],
>   price_in_decimal?: string[],
>   pricing_type?: (per_unit | flat_fee | package)[],
>   package_size?: number[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `subscription` | `object \| null` | No | A Chargebee subscription connects a customer record to products/services. It describes what the customer has signed up for and how often they're charged for it. The essential components of a subscription are: \* A [plan-item price](https://docs.corsair.dev/docs/api/item_prices). \* Any addon- and charge-item prices applied to the subscription. \* Any [coupons](https://docs.corsair.dev/docs/api/coupons) applied. \* Any [discounts](https://docs.corsair.dev/docs/api/discounts) applied. The charges in a subscription are billed via invoices. **Note:** The maximum number of subscriptions for any given [customer](https://docs.corsair.dev/docs/api/customers) ([active](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#status) or not) is 900. #### Subscription billing frequencies Chargebee offers two billing frequency options for subscriptions: \* **Plan-based billing** (`default`): Subscriptions are billed based on the billing period defined for the item price of the `item_type` `plan`. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/subscriptions#plan-based-billing). \* **Multi-frequency billing** : Subscriptions are billed according to the billing period of each recurring item price within the subscription. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing). **Important** [Limitations](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing#limitations) of Multi-frequency billing. The selection of the billing frequency preference is configured at the site level. #### Item price compatibility in a subscription When creating or updating a subscription, one of the item prices specified under subscription\_items must be a plan-item price. The remaining must be compatible addon- or charge-item prices. An item price is compatible with a plan-item price if their currencies are the same. Additionally, an addon-item price is compatible with a plan-item price only if their billing frequencies meet the following conditions: \| `period_unit` for plan-item price \| Compatible `period_unit` for addon-item price \| Compatible period for addon-item price \| \|-----------------------------------\|-----------------------------------------------\|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `day` \| `day` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `10`, then the period of the addon-item price can be `10`, `5`, `2`, or `1`. \| \| `week` \| `week` or `day` \| The `period` (in days) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the period of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `week`, `period` can be `2` or `1`. \* for `period_unit` as `day`, `period` can be `14`, `7`, `2`, or `1`. \| \| `month` \| `month` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `6`, then the `period` of the addon-item price can be `6`, `3`, `2`, or `1`. \| \| `year` \| `year` or `month` \| The `period` (in months) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the `period` of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `year`, `period` can be `2` or `1`. \* for `period_unit` as `month`, `period` can be `24`, `12`, `8`, `6`, `4`, `3`, `2`, or `1`. \| #### Tax provider fields **Avalara** : Merchants using **Avalara Sales Tax** can optionally associate each item price with a locationCode (from their Avalara company locations), so tax can be resolved correctly at the line item level. \| Field ID \| Field Value \| APIs \| \|--------------------------------------------------------------------------------\|----------------------------------------------------------------------\|--------------------------------------------------------------------------------\| \| `locationCode` \| Merchant to configure it on Avalara Platform under company locations \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| **Anrok**: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation \| Field ID \| Field Value \| APIs \| \|---------------------------------------------------------------------------------------------------------------------------------------\|---------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------\| \| `additionalTaxRegistrationNumber` \| Canadian tax registration numbers in comma separated fashion. \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| **Vertex**: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration **Note:** Field Id like `customerCode` , `customerClass` , and`taxExempted` belong to the customer object. Field Id like `productCode` , `productClass` , `productTaxCode` , and `productClass` belong to the product object. \| Field ID \| Field Value \| APIs \| \|-----------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productCode` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `customerCode` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `customerClass` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **Taxamo:** Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration \| Field Id \| Field Value \| APIs \| \|------------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productTaxCode` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `taxExempted` \| Merchant to configure it on Taxamo Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **cbtaxes**: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India. \| Field ID \| Field Value \| APIs \| \|---------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `indiaSez` \| `SEZ_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaSez` \| `SEZ_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **All**: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level \| Field ID \| Field Value \| APIs \| \|-------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `priceType` \| `TAX_INCLUSIVE` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| \| `TAX_EXCLUSIVE` \| \| \| \| `SITE_DEFAULT` or blank \| Removes price type override, and allows site level configuration to be used for tax calculation. \| #### Ramps API compatibility mode If you want to schedule changes on a subscription, use the [Ramps API](https://docs.corsair.dev/docs/api/ramps). If you are currently scheduling changes through the [Update subscription API](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items), migrate to the Ramps API. To get started, [request access for Subscription Ramps](https://app.chargebee.com/login?forward=https://app.chargebee.com/request_access/subscription-ramps\&ref=feature). Chargebee will enable Ramps compatibility mode for your site. Once enabled, you can test the Ramps API without impacting your existing integrations. The following parts of the Billing API have subtle differences in behavior when the Ramps feature is disabled versus when it is enabled with compatibility mode. (Follow the links to learn more.) \* The value of the [`subscription.has_scheduled_changes`](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#has_scheduled_changes) attribute. \* [Update subscription](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#impact-scheduled-changes) \* [Create Checkout for updating a subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription#impact-scheduled-changes) \* [Remove scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/remove-scheduled-changes) \* [Retrieve with scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/retrieve-with-scheduled-changes) \* [Create a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/create-a-quote-for-update-subscription-items) \* [Edit a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/edit-update-subscription-quote-for-items) \* [Portal sessions](https://docs.corsair.dev/docs/api/portal_sessions#scheduled-subscription-changes) |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   currency_code?: string | null,
>   billing_period?: number | null,
>   billing_period_unit?: string | null,
>   start_date?: number | null,
>   trial_end?: number | null,
>   remaining_billing_cycles?: number | null,
>   po_number?: string | null,
>   auto_collection?: string | null,
>   plan_quantity_in_decimal?: string | null,
>   plan_unit_price_in_decimal?: string | null,
>   customer_id?: string | null,
>   status?: string | null,
>   trial_start?: number | null,
>   trial_end_action?: string | null,
>   current_term_start?: number | null,
>   current_term_end?: number | null,
>   next_billing_at?: number | null,
>   created_at?: number | null,
>   started_at?: number | null,
>   activated_at?: number | null,
>   contract_term_billing_cycle_on_renewal?: number | null,
>   override_relationship?: boolean | null,
>   pause_date?: number | null,
>   resume_date?: number | null,
>   cancelled_at?: number | null,
>   cancel_reason?: string | null,
>   created_from_ip?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   has_scheduled_advance_invoices?: boolean | null,
>   has_scheduled_changes?: boolean | null,
>   payment_source_id?: string | null,
>   plan_free_quantity_in_decimal?: string | null,
>   plan_amount_in_decimal?: string | null,
>   cancel_schedule_created_at?: number | null,
>   offline_payment_method?: string | null,
>   channel?: string | null,
>   net_term_days?: number | null,
>   active_id?: string | null,
>   due_invoices_count?: number | null,
>   due_since?: number | null,
>   total_dues?: number | null,
>   mrr?: number | null,
>   exchange_rate?: number | null,
>   base_currency_code?: string | null,
>   invoice_notes?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   changes_scheduled_at?: number | null,
>   cancel_reason_code?: string | null,
>   free_period?: number | null,
>   free_period_unit?: string | null,
>   create_pending_invoices?: boolean | null,
>   auto_close_invoices?: boolean | null,
>   business_entity_id?: string | null,
>   decommissioned?: boolean | null,
>   brand_id?: string | null,
>   subscription_items?: {
>     item_price_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     amount?: number | null,
>     current_term_start?: number | null,
>     current_term_end?: number | null,
>     next_billing_at?: number | null,
>     amount_in_decimal?: string | null,
>     billing_period?: number | null,
>     billing_period_unit?: string | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     trial_end?: number | null,
>     billing_cycles?: number | null,
>     service_period_days?: number | null,
>     charge_on_event?: string | null,
>     charge_once?: boolean | null,
>     charge_on_option?: string | null,
>     proration_type?: string | null,
>     usage_accumulation_reset_frequency?: string | null,
>     description?: string | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null,
>     index?: number | null
>   }[] | null,
>   charged_items?: {
>     item_price_id?: string | null,
>     last_charged_at?: number | null
>   }[] | null,
>   coupons?: {
>     coupon_id?: string | null,
>     apply_till?: number | null,
>     applied_count?: number | null,
>     coupon_code?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_info?: {
>     referral_code?: string | null,
>     coupon_code?: string | null,
>     referrer_id?: string | null,
>     external_reference_id?: string | null,
>     reward_status?: string | null,
>     referral_system?: string | null,
>     account_id?: string | null,
>     campaign_id?: string | null,
>     external_campaign_id?: string | null,
>     friend_offer_type?: string | null,
>     referrer_reward_type?: string | null,
>     notify_referral_system?: string | null,
>     destination_url?: string | null,
>     post_purchase_widget_enabled?: boolean | null
>   } | null,
>   billing_override?: {
>     max_excess_payment_usage?: number | null,
>     max_refundable_credits_usage?: number | null
>   } | null,
>   contract_term?: {
>     id?: string | null,
>     status?: string | null,
>     contract_start?: number | null,
>     contract_end?: number | null,
>     billing_cycle?: number | null,
>     action_at_term_end?: string | null,
>     total_contract_value?: number | null,
>     total_contract_value_before_tax?: number | null,
>     cancellation_cutoff_period?: number | null,
>     created_at?: number | null,
>     subscription_id?: string | null,
>     remaining_billing_cycles?: number | null
>   } | null,
>   discounts?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     description?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     quantity?: number | null,
>     currency_code?: string | null,
>     duration_type?: string | null,
>     period?: number | null,
>     period_unit?: string | null,
>     included_in_mrr?: boolean | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null,
>     apply_till?: number | null,
>     applied_count?: number | null,
>     coupon_id?: string | null,
>     index?: number | null
>   }[] | null
> } | null
> ```

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] card full type
>
> ```ts theme={null}
> {
>   payment_source_id?: string | null,
>   status?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   ref_tx_id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   iin?: string | null,
>   last4?: string | null,
>   card_type?: string | null,
>   funding_type?: string | null,
>   expiry_month?: number | null,
>   expiry_year?: number | null,
>   issuing_country?: string | null,
>   billing_addr1?: string | null,
>   billing_addr2?: string | null,
>   billing_city?: string | null,
>   billing_state_code?: string | null,
>   billing_state?: string | null,
>   billing_country?: string | null,
>   billing_zip?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   ip_address?: string | null,
>   powered_by?: string | null,
>   customer_id?: string | null,
>   masked_number?: string | null
> } | null
> ```

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### link

`customers.link`

Link a customer to an account hierarchy. Creates a hierarchical relationship between two customers. The path parameter customer\_id identifies the child in this relationship, and parent\_id identifies the parent.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.customers.link({ customerId: 'cust_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customerId` | `string` | Yes | — |
| `parent_id` | `string` | No | ID of the customer intended to be set as the immediate parent of the customer identified by `customer_id` . |
| `payment_owner_id` | `string` | No | The `id` of the customer responsible for paying the invoices for the customer identified by `customer_id`. **Constraints** \* If the `invoice_owner_id` is the same as the `customer_id`, then the `payment_owner_id` can be the `customer_id` or an ancestor of the `customer_id`. \* If the `invoice_owner_id` is not the same as the `customer_id`, then the `payment_owner_id` must be the `invoice_owner_id`. |
| `invoice_owner_id` | `string` | No | The `id` of the customer who receives the invoice for charges incurred by the customer identified by `customer_id`. **Constraint** \* This ID must match either `customer_id` or one of its ancestors. |
| `use_default_hierarchy_settings` | `boolean` | No | Decides if Chargebee should apply settings from the [Chargebee Billing UI](https://www.chargebee.com/docs/2.0/account-hierarchy.html#advanced-mode) or from this API request. \* If set to `true`: Chargebee uses settings configured in the Chargebee Billing UI. \* If set to `false`: Settings provided in the `parent_account_access` and `child_account_access` parameters are applied. |
| `parent_account_access` | `object` | No | Settings for the parent account's access. |
| `child_account_access` | `object` | No | Settings for the child account's access. |

> [accordion] parent\_account\_access full type
>
> ```ts theme={null}
> {
>   portal_edit_child_subscriptions?: yes | view_only | no,
>   portal_download_child_invoices?: yes | view_only | no,
>   send_subscription_emails?: boolean,
>   send_payment_emails?: boolean,
>   send_invoice_emails?: boolean
> }
> ```

> [accordion] child\_account\_access full type
>
> ```ts theme={null}
> {
>   portal_edit_subscriptions?: yes | view_only,
>   portal_download_invoices?: yes | view_only | no,
>   send_subscription_emails?: boolean,
>   send_payment_emails?: boolean,
>   send_invoice_emails?: boolean
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

***

### list

`customers.list`

List customers. Retrieves a list of customers added to your Chargebee site. The list contains the necessary customer details such as First Name, Last Name and the Customer ID.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.customers.list({ limit: 10 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `include_deleted` | `boolean` | No | If set to true, includes the deleted resources in the response. For the deleted resources in the response, the '**deleted** ' attribute will be '**true** '. |
| `id` | `object` | No | optional, string filter Identifier of the customer. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *id\\\[is\\] = "9bsvnHgsvmsI"* |
| `first_name` | `object` | No | optional, string filter First name of the customer. **Supported operators :** is, is\_not, starts\_with, is\_present **Example →** *first\_name\\\[is\\] = "John"* |
| `last_name` | `object` | No | optional, string filter Last name of the customer. **Supported operators :** is, is\_not, starts\_with, is\_present **Example →** *last\_name\\\[is\\] = "Clint"* |
| `email` | `object` | No | optional, string filter Email of the customer. Configured email notifications will be sent to this email. **Supported operators :** is, is\_not, starts\_with, is\_present **Example →** *email\\\[is\\] = "[john@test.com](mailto:john@test.com)"* |
| `company` | `object` | No | optional, string filter Company name of the customer. **Supported operators :** is, is\_not, starts\_with, is\_present **Example →** *company\\\[is\_not\\] = "Globex Corp"* |
| `phone` | `object` | No | optional, string filter Phone number of the customer. **Supported operators :** is, is\_not, starts\_with, is\_present **Example →** *phone\\\[is\_not\\] = "(541) 754-3010"* |
| `auto_collection` | `object` | No | optional, enumerated string filter Whether payments needs to be collected automatically for this customer. Possible values are : on, off. **Supported operators :** is, is\_not, in, not\_in **Example →** *auto\_collection\\\[is\\] = "on"* |
| `taxability` | `object` | No | optional, enumerated string filter Specifies if the customer is liable for tax. Possible values are : taxable, exempt, zero\_rated. **Supported operators :** is, is\_not, in, not\_in **Example →** *taxability\\\[is\\] = "taxable"* |
| `created_at` | `object` | No | optional, timestamp(UTC) in seconds filter Timestamp indicating when this customer resource is created. **Supported operators :** after, before, on, between **Example →** *created\_at\\\[before\\] = "1435054328"* |
| `updated_at` | `object` | No | optional, timestamp(UTC) in seconds filter To filter based on `updated_at`. This attribute will be present only if the resource has been updated after 2016-09-28. It is advisable when using this filter, to pass the `sort_by` input parameter as `updated_at` for a faster response. **Supported operators :** after, before, on, between **Example →** *updated\_at\\\[after\\] = "1243545465"* |
| `offline_payment_method` | `object` | No | optional, enumerated string filter The preferred offline payment method for the customer. Possible values are : no\_preference, cash, check, bank\_transfer, ach\_credit, sepa\_credit. **Supported operators :** is, is\_not, in, not\_in **Example →** *offline\_payment\_method\\\[is\\] = "cash"* |
| `auto_close_invoices` | `object` | No | optional, boolean filter Override for this customer, the [site-level setting](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) for auto-closing invoices. Only applicable when auto-closing invoices has been enabled for the site. This attribute is also available at the [subscription level](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#auto_close_invoices) which takes precedence. Possible values are : *true, false* **Supported operators :** is **Example →** *auto\_close\_invoices\\\[is\\] = "true"* |
| `channel` | `object` | No | optional, enumerated string filter The subscription channel this object originated from and is maintained in. Possible values are : web, app\_store, play\_store. **Supported operators :** is, is\_not, in, not\_in **Example →** *channel\\\[is\\] = "APP STORE"* |
| `business_entity_id` | `object` | No | optional, string filter The unique ID of the [business entity](https://docs.corsair.dev/docs/api/advanced-features) of this subscription. This is always the same as the [business entity](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#customer_id) of the customer. **Supported operators :** is, is\_not, starts\_with **Example →** *business\_entity\_id\\\[is\_not\\] = "business\_entity\_id"* |
| `sort_by` | `object` | No | optional, string filter Sorts based on the specified attribute. **Supported attributes :** created\_at, updated\_at **Supported sort-orders :** asc, desc **Example →** *sort\_by\\\[asc\\] = "created\_at"* This will sort the result based on the 'created\_at' attribute in ascending(earliest first) order. |
| `relationship` | `object` | No | Parameters for relationship |

> [accordion] id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] first\_name full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   is_present?: true | false
> }
> ```

> [accordion] last\_name full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   is_present?: true | false
> }
> ```

> [accordion] email full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   is_present?: true | false
> }
> ```

> [accordion] company full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   is_present?: true | false
> }
> ```

> [accordion] phone full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   is_present?: true | false
> }
> ```

> [accordion] auto\_collection full type
>
> ```ts theme={null}
> {
>   is?: on | off,
>   is_not?: on | off,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] taxability full type
>
> ```ts theme={null}
> {
>   is?: taxable | exempt | zero_rated,
>   is_not?: taxable | exempt | zero_rated,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] created\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] updated\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] offline\_payment\_method full type
>
> ```ts theme={null}
> {
>   is?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
>   is_not?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] auto\_close\_invoices full type
>
> ```ts theme={null}
> {
>   is?: true | false
> }
> ```

> [accordion] channel full type
>
> ```ts theme={null}
> {
>   is?: web | app_store | play_store,
>   is_not?: web | app_store | play_store,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] business\_entity\_id full type
>
> ```ts theme={null}
> {
>   is?: string
> }
> ```

> [accordion] sort\_by full type
>
> ```ts theme={null}
> {
>   asc?: created_at | updated_at,
>   desc?: created_at | updated_at
> }
> ```

> [accordion] relationship full type
>
> ```ts theme={null}
> {
>   parent_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string
>   },
>   payment_owner_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string
>   },
>   invoice_owner_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   customer?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     company?: string | null,
>     vat_number?: string | null,
>     auto_collection?: string | null,
>     offline_payment_method?: string | null,
>     net_term_days?: number | null,
>     vat_number_validated_time?: number | null,
>     vat_number_status?: string | null,
>     allow_direct_debit?: boolean | null,
>     is_location_valid?: boolean | null,
>     created_at?: number | null,
>     created_from_ip?: string | null,
>     exemption_details?: any[] | null,
>     taxability?: string | null,
>     entity_code?: string | null,
>     exempt_number?: string | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     locale?: string | null,
>     billing_date?: number | null,
>     billing_month?: number | null,
>     billing_date_mode?: string | null,
>     billing_day_of_week?: string | null,
>     billing_day_of_week_mode?: string | null,
>     pii_cleared?: string | null,
>     auto_close_invoices?: boolean | null,
>     channel?: string | null,
>     active_id?: string | null,
>     fraud_flag?: string | null,
>     primary_payment_source_id?: string | null,
>     backup_payment_source_id?: string | null,
>     invoice_notes?: string | null,
>     business_entity_id?: string | null,
>     preferred_currency_code?: string | null,
>     promotional_credits?: number | null,
>     unbilled_charges?: number | null,
>     refundable_credits?: number | null,
>     excess_payments?: number | null,
>     is_einvoice_enabled?: boolean | null,
>     einvoicing_method?: string | null,
>     meta_data?: {
>     } | null,
>     deleted?: boolean | null,
>     registered_for_gst?: boolean | null,
>     consolidated_invoicing?: boolean | null,
>     customer_type?: string | null,
>     business_customer_without_vat_number?: boolean | null,
>     client_profile_id?: string | null,
>     use_default_hierarchy_settings?: boolean | null,
>     vat_number_prefix?: string | null,
>     entity_identifier_scheme?: string | null,
>     entity_identifier_standard?: string | null,
>     brand_id?: string | null,
>     billing_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     referral_urls?: {
>       external_customer_id?: string | null,
>       referral_sharing_url?: string | null,
>       created_at?: number | null,
>       updated_at?: number | null,
>       referral_campaign_id?: string | null,
>       referral_account_id?: string | null,
>       referral_external_campaign_id?: string | null,
>       referral_system?: string | null
>     }[] | null,
>     contacts?: {
>       id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       phone?: string | null,
>       label?: string | null,
>       enabled?: boolean | null,
>       send_account_email?: boolean | null,
>       send_billing_email?: boolean | null
>     }[] | null,
>     payment_method?: {
>       type?: string | null,
>       gateway?: string | null,
>       gateway_account_id?: string | null,
>       status?: string | null,
>       reference_id?: string | null
>     } | null,
>     balances?: {
>       promotional_credits?: number | null,
>       excess_payments?: number | null,
>       refundable_credits?: number | null,
>       unbilled_charges?: number | null,
>       currency_code?: string | null,
>       business_entity_id?: string | null
>     }[] | null,
>     entity_identifiers?: {
>       id?: string | null,
>       value?: string | null,
>       scheme?: string | null,
>       standard?: string | null
>     }[] | null,
>     tax_providers_fields?: {
>       provider_name?: string | null,
>       field_id?: string | null,
>       field_value?: string | null
>     }[] | null,
>     relationship?: {
>       parent_id?: string | null,
>       payment_owner_id?: string | null,
>       invoice_owner_id?: string | null
>     } | null,
>     parent_account_access?: {
>       portal_edit_child_subscriptions?: string | null,
>       portal_download_child_invoices?: string | null,
>       send_subscription_emails?: boolean | null,
>       send_invoice_emails?: boolean | null,
>       send_payment_emails?: boolean | null
>     } | null,
>     child_account_access?: {
>       portal_edit_subscriptions?: string | null,
>       portal_download_invoices?: string | null,
>       send_subscription_emails?: boolean | null,
>       send_invoice_emails?: boolean | null,
>       send_payment_emails?: boolean | null
>     } | null
>   } | null,
>   card?: {
>     payment_source_id?: string | null,
>     status?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     ref_tx_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     iin?: string | null,
>     last4?: string | null,
>     card_type?: string | null,
>     funding_type?: string | null,
>     expiry_month?: number | null,
>     expiry_year?: number | null,
>     issuing_country?: string | null,
>     billing_addr1?: string | null,
>     billing_addr2?: string | null,
>     billing_city?: string | null,
>     billing_state_code?: string | null,
>     billing_state?: string | null,
>     billing_country?: string | null,
>     billing_zip?: string | null,
>     created_at?: number | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     ip_address?: string | null,
>     powered_by?: string | null,
>     customer_id?: string | null,
>     masked_number?: string | null
>   } | null
> }[] | null
> ```

***

### listContacts

`customers.listContacts`

List of contacts for a customer. This API retrieves all the contacts for a customer.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.customers.listContacts({ customerId: 'cust_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customerId` | `string` | Yes | — |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   contact?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   } | null
> }[] | null
> ```

***

### listEmailLogs

`customers.listEmailLogs`

List email logs for a customer. Retrieves the emails sent for a customer, newest first. Use this operation to inspect delivery status, recipient, and template for emails Chargebee sent to a customer, including those triggered by send invoice email, send credit note email, and send payment request email.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.customers.listEmailLogs({ customerId: 'cust_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customerId` | `string` | Yes | — |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `sent_on` | `object` | No | optional, timestamp(UTC) in seconds filter Filter by when the email was scheduled to be sent. Pass a Unix timestamp in seconds. **Supported operators :** after, before, between, on **Example →** *sent\_on\\\[after\\] = "1435054328"* **Default behavior** \* If omitted, emails from the last 24 hours are returned. **Constraints** \* Must be within the last 7 days. \* `between` and combined `after` / `before` can span at most 24 hours. \* `after` alone returns the following 24 hours. \* `before` alone returns the preceding 24 hours. |
| `business_entity_id` | `object` | No | optional, string filter Filter by the unique ID of the [business entity](https://docs.corsair.dev/docs/api/advanced-features) associated with the email. **Supported operators :** is **Example →** *business\_entity\_id\\\[is\\] = "business\_entity\_id"* **Prerequisites** \* Multi Business Entity must be enabled for the site. |
| `brand_id` | `object` | No | optional, string filter Filter by the unique ID of the [brand](https://docs.corsair.dev/docs/api/brands) associated with the email. **Supported operators :** is **Example →** *brand\_id\\\[is\\] = "brand\_id"* **Prerequisites** \* Multi Brand must be enabled for the site. |

> [accordion] sent\_on full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] business\_entity\_id full type
>
> ```ts theme={null}
> {
>   is?: string
> }
> ```

> [accordion] brand\_id full type
>
> ```ts theme={null}
> {
>   is?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   email_log?: {
>     id?: string | null,
>     template_name?: string | null,
>     from_address?: string | null,
>     to_address?: string | null,
>     subject?: string | null,
>     status?: string | null,
>     sent_on?: number | null,
>     customer_id?: string | null,
>     email_conversation_id?: string | null,
>     site_id?: string | null,
>     business_entity_id?: string | null,
>     brand_id?: string | null,
>     error_message?: string | null
>   } | null
> }[] | null
> ```

***

### listEntitlements

`customers.listEntitlements`

List customer entitlements. Tip To retrieve subscription entitlements for a specific subscription, use the List subscription entitlements API. Returns a list of customer\_entitlement objects for the specified customer. The entitlements returned are for *active* subscriptions only.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.customers.listEntitlements({ customerId: 'cust_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customerId` | `string` | Yes | — |
| `limit` | `number` | No | The number of features for which to return `customer_entitlement` objects. **See also** [Pagination for List customer entitlements](https://docs.corsair.dev/docs/api/customer_entitlements). |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `consolidate_entitlements` | `boolean` | No | When set to `true` , the response returns a unified view of entitlement values for each feature across the customer. This includes entitlements assigned directly to the customer as well as those inherited from any of the customer's subscriptions. In this mode, the `subscription_id` field is omitted from the response objects. The consolidated entitlement value is derived using the same logic described in the [Subscription Entitlements documentation](https://docs.corsair.dev/docs/api/subscription_entitlements) , based on the feature type. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   customer_entitlement?: {
>     customer_id?: string | null,
>     subscription_id?: string | null,
>     feature_id?: string | null,
>     value?: string | null,
>     name?: string | null,
>     is_enabled?: boolean | null
>   } | null
> }[] | null
> ```

***

### listHierarchyDetails

`customers.listHierarchyDetails`

Get paginated account hierarchy for a customer. Retrieves the account hierarchy tree for the customer.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.customers.listHierarchyDetails({ customerId: 'cust_8gsnbYfsMLds', hierarchy_operation_type: 'complete_hierarchy' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customerId` | `string` | Yes | — |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Used for pagination. Set this to the `next_offset` value from the previous API response to fetch the next page. |
| `hierarchy_operation_type` | `complete_hierarchy \| subordinates \| path_to_root` | Yes | Specifies which part of the hierarchy to fetch. Choose from the available operation types. \* complete\_hierarchy - Fetches all nodes in the full hierarchy that the customer belongs to. \* subordinates - Fetches all nodes in the sub-hierarchy rooted at the customer, including the customer and its subordinates. \* path\_to\_root - Fetches a list of nodes along the path from the customer to the root of the hierarchy. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   hierarchy?: {
>     customer_id?: string | null,
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null,
>     has_children?: boolean | null,
>     children_ids?: string[] | null
>   } | null
> }[] | null
> ```

***

### listPaymentVouchers

`customers.listPaymentVouchers`

List vouchers for a customer. Retrieves vouchers for a customer in reverse chronological order.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.customers.listPaymentVouchers({ customerId: 'cust_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customerId` | `string` | Yes | — |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `status` | `object` | No | optional, enumerated string filter Current status of Payment Voucher. Possible values are : active, consumed, expired, failure. **Supported operators :** is, is\_not, in, not\_in, in, not\_in **Example →** *status\\\[is\\] = "active, consumed, expired"* |
| `sort_by` | `object` | No | optional, string filter Sorts based on the specified attribute. **Supported attributes :** date, updated\_at **Supported sort-orders :** asc, desc **Example →** *sort\_by\\\[asc\\] = "date"* This will sort the result based on the 'date' attribute in ascending(earliest first) order. |

> [accordion] status full type
>
> ```ts theme={null}
> {
>   is?: active | consumed | expired | failure,
>   is_not?: active | consumed | expired | failure,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] sort\_by full type
>
> ```ts theme={null}
> {
>   asc?: date | updated_at,
>   desc?: date | updated_at
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   payment_voucher?: {
>     id?: string | null,
>     id_at_gateway?: string | null,
>     payment_voucher_type?: string | null,
>     expires_at?: number | null,
>     status?: string | null,
>     subscription_id?: string | null,
>     currency_code?: string | null,
>     amount?: number | null,
>     gateway_account_id?: string | null,
>     payment_source_id?: string | null,
>     gateway?: string | null,
>     payload?: string | null,
>     error_code?: string | null,
>     error_text?: string | null,
>     url?: string | null,
>     date?: number | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     customer_id?: string | null,
>     linked_invoices?: {
>       invoice_id?: string | null,
>       txn_id?: string | null,
>       applied_at?: number | null
>     }[] | null
>   } | null
> }[] | null
> ```

***

### merge

`customers.merge`

Merge customers. This API moves a customer's payment methods, subscriptions, invoices, credit notes, transactions, unbilled charges, and orders to another customer. Events and email logs will not be moved. The API execution is asynchronous.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.customers.merge({ from_customer_id: 'example', to_customer_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `from_customer_id` | `string` | Yes | From customer id. |
| `to_customer_id` | `string` | Yes | To customer id. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

***

### move

`customers.move`

Move a customer. This API copies a customer object from one site to another. The destination site (the site to which the customer is copied) is specified by the path parameter \{site}; whereas, the source site (the site from which the customer is copied) is specified by the query parameter from\_site.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.customers.move({ from_site: 'example', id_at_from_site: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `id_at_from_site` | `string` | Yes | Id of the customer to be copied. |
| `from_site` | `string` | Yes | Name of the site from which this customer need to be copied. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `resource_migration` | `object \| null` | No | Resource Migration is used for finding the status of customer migration between Chargebee sites. |

> [accordion] resource\_migration full type
>
> ```ts theme={null}
> {
>   from_site?: string | null,
>   entity_type?: string | null,
>   entity_id?: string | null,
>   status?: string | null,
>   errors?: string | null,
>   created_at?: number | null,
>   updated_at?: number | null
> } | null
> ```

***

### recordExcessPayment

`customers.recordExcessPayment`

Record an excess payment for a customer. Records an offline payment for a customer and adds it to the customer's excess payments balance. ### Impacts Invoices \* Chargebee automatically applies excess payments to future invoices, subject to limits set at the site level or overridden for subscriptions via subscription.billing\_override.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.customers.recordExcessPayment({ customerId: 'cust_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customerId` | `string` | Yes | — |
| `comment` | `string` | No | Remarks, if any, on the payment. |
| `transaction` | `object` | No | Parameters for transaction |

> [accordion] transaction full type
>
> ```ts theme={null}
> {
>   id?: string,
>   amount: number,
>   currency_code?: string,
>   date: number,
>   payment_method: cash | check | bank_transfer | other | custom,
>   reference_number?: string,
>   custom_payment_method_id?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `transaction` | `object \| null` | No | This resource represents the [transaction](https://www.chargebee.com/docs/transactions.html) event that has happened in your account. |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] transaction full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   gateway_account_id?: string | null,
>   payment_source_id?: string | null,
>   payment_method?: string | null,
>   reference_number?: string | null,
>   gateway?: string | null,
>   type?: string | null,
>   date?: number | null,
>   settled_at?: number | null,
>   exchange_rate?: number | null,
>   currency_code?: string | null,
>   amount?: number | null,
>   id_at_gateway?: string | null,
>   status?: string | null,
>   fraud_flag?: string | null,
>   initiator_type?: string | null,
>   three_d_secure?: boolean | null,
>   authorization_reason?: string | null,
>   error_code?: string | null,
>   error_text?: string | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   fraud_reason?: string | null,
>   custom_payment_method_id?: string | null,
>   amount_unused?: number | null,
>   masked_card_number?: string | null,
>   reference_transaction_id?: string | null,
>   refunded_txn_id?: string | null,
>   reference_authorization_id?: string | null,
>   amount_capturable?: number | null,
>   reversal_transaction_id?: string | null,
>   deleted?: boolean | null,
>   iin?: string | null,
>   last4?: string | null,
>   merchant_reference_id?: string | null,
>   business_entity_id?: string | null,
>   payment_method_details?: string | null,
>   custom_payment_method_name?: string | null,
>   linked_invoices?: {
>     invoice_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     invoice_date?: number | null,
>     invoice_total?: number | null,
>     invoice_status?: string | null
>   }[] | null,
>   linked_credit_notes?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null,
>     cn_reference_invoice_id?: string | null
>   }[] | null,
>   linked_refunds?: {
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   linked_payments?: {
>     id?: string | null,
>     status?: string | null,
>     amount?: number | null,
>     date?: number | null
>   }[] | null,
>   gateway_metadata?: {
>     acquirer_reference_id?: string | null
>   } | null,
>   error_detail?: {
>     request_id?: string | null,
>     error_category?: string | null,
>     error_code?: string | null,
>     error_message?: string | null,
>     decline_code?: string | null,
>     decline_message?: string | null,
>     network_error_code?: string | null,
>     network_error_message?: string | null,
>     error_field?: string | null,
>     recommendation_code?: string | null,
>     recommendation_message?: string | null,
>     processor_error_code?: string | null,
>     processor_error_message?: string | null,
>     error_cause_id?: string | null,
>     processor_advice_code?: string | null
>   } | null,
>   network_transaction_details?: {
>     network_transaction_id?: string | null,
>     original_network_transaction_id?: string | null
>   } | null
> } | null
> ```

***

### sendPaymentRequest

`customers.sendPaymentRequest`

Send Payment Request Email. Sends a request payment email to the customer using the site's published Collect Payment Email Engage notification template. Use this operation to manually trigger a payment request email when you want the customer to pay outstanding invoices. Async-only This operation is asynchronous only.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.customers.sendPaymentRequest({ customerId: 'cust_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `prefer` | `string` | No | Must be set to `respond-async`. Instructs Chargebee to process the request asynchronously and return `202 Accepted` immediately. |
| `requestId` | `string` | No | A client-generated unique identifier (UUID recommended) for this request. Echoed back as `request.id` in the async callback payload, allowing you to correlate each callback to its originating request. |
| `asyncCallbackUrl` | `string` | No | The callback URL where Chargebee will `POST` the async result. Must be an `https://` URL and may embed basic-auth credentials, e.g. `https://username:password@example.com`. |
| `customerId` | `string` | Yes | — |

**Output:** `object`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   email_logs?: {
>     id?: string | null,
>     template_name?: string | null,
>     from_address?: string | null,
>     to_address?: string | null,
>     subject?: string | null,
>     status?: string | null,
>     sent_on?: number | null,
>     customer_id?: string | null,
>     email_conversation_id?: string | null,
>     site_id?: string | null,
>     business_entity_id?: string | null,
>     brand_id?: string | null,
>     error_message?: string | null
>   }[] | null
> } | {
>   success: true
> }
> ```

***

### switchGateway

`customers.switchGateway`

Switch gateway. #### Deprecated This request is obsoleted by the Switch gateway account API for Payment Sources. Switches the gateway in which customer's card information is stored. This is applicable only if the payment method is card.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.customers.switchGateway({ customerId: 'cust_8gsnbYfsMLds', gateway_account_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customerId` | `string` | Yes | — |
| `gateway_account_id` | `string` | Yes | The gateway account you want to switch to. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] card full type
>
> ```ts theme={null}
> {
>   payment_source_id?: string | null,
>   status?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   ref_tx_id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   iin?: string | null,
>   last4?: string | null,
>   card_type?: string | null,
>   funding_type?: string | null,
>   expiry_month?: number | null,
>   expiry_year?: number | null,
>   issuing_country?: string | null,
>   billing_addr1?: string | null,
>   billing_addr2?: string | null,
>   billing_city?: string | null,
>   billing_state_code?: string | null,
>   billing_state?: string | null,
>   billing_country?: string | null,
>   billing_zip?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   ip_address?: string | null,
>   powered_by?: string | null,
>   customer_id?: string | null,
>   masked_number?: string | null
> } | null
> ```

***

### update

`customers.update`

Update a customer. Updates the details of the specified customer. Use this API to modify customer information, including standard attributes and any configured custom attributes. \* To update the billing address or VAT number, use the Update billing info for a customer API instead.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.customers.update({ customerId: 'cust_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customerId` | `string` | Yes | — |
| `first_name` | `string` | No | First name of the customer. |
| `last_name` | `string` | No | Last name of the customer. |
| `email` | `string` | No | Email of the customer. Configured email notifications will be sent to this email. |
| `preferred_currency_code` | `string` | No | The currency code (ISO 4217 format) of the customer. Applicable if Multicurrency is enabled. |
| `phone` | `string` | No | Phone number of the customer. |
| `company` | `string` | No | Company name of the customer. |
| `auto_collection` | `on \| off` | No | Determines whether payments should be collected automatically for this customer. **Note** This setting can be overridden at the [subscription level](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#auto_collection). \* on - Payments are automatically collected for new invoices. For existing invoices, Chargebee attempts collections through [dunning](https://www.chargebee.com/docs/payments/2.0/dunning/dunning-v2) as per the configured schedule. \* off - Payments are not automatically collected for this customer. |
| `allow_direct_debit` | `boolean` | No | Whether the customer can pay via Direct Debit. |
| `net_term_days` | `number` | No | The number of days from [`invoice.date`](https://docs.corsair.dev/docs/api/invoices/invoice-object#date) until payment for the invoice is due. |
| `taxability` | `taxable \| exempt \| zero_rated` | No | Specifies whether taxes are applicable to invoices generated for this customer. \* taxable - Taxes are calculated for this customer based on the [site's tax configuration](https://www.chargebee.com/docs/tax.html). In some regions, [shipping\_address](https://docs.corsair.dev/docs/api/customers) is required for tax computation. If a shipping address is not provided, the [billing\_address](https://docs.corsair.dev/docs/api/customers) is used. If neither address is available, no tax is applied. \* zero\_rated - This option is available only when zero-rated customer taxability is enabled for the site and the site uses [Chargebee Taxes](https://www.chargebee.com/docs/tax.html); third-party tax providers and integrations are not supported. Otherwise taxable line items for the customer are taxed at 0%. These line items have `is_taxed` set to `true`, the tax rate and tax amount set to `0`, and `tax_exempt_reason` set to `zero_rated`. Unlike `exempt`, this option follows the taxable tax path at a zero rate. \* exempt - The customer is exempt from tax. \* If you use Chargebee [Taxes](https://www.chargebee.com/docs/tax.html) or the [TaxJar integration](https://www.chargebee.com/docs/taxjar.html), no additional action is required. \* If you use the [Avalara integration](https://www.chargebee.com/docs/avalara.html), optionally specify the `entity_code` or `exempt_number` attributes with [AvaTax for Sales](https://www.chargebee.com/docs/avalara.html#configuring-tax-exemption), or the `exemption_details` attribute with [AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html). Avalara may still apply tax depending on the values of `entity_code`, `exempt_number`, or `exemption_details`, and the jurisdiction (state, region, or province) of the taxable address. |
| `exemption_details` | `any[]` | No | 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` | `residential \| business \| senior_citizen \| industrial` | No | 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. \* 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 \* business - When the purchase is made at a place of business \* residential - When the purchase is made by a customer for home use |
| `client_profile_id` | `string` | No | 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. |
| `taxjar_exemption_category` | `wholesale \| government \| other` | No | Indicates the exemption type of the customer. This is applicable only if you use Chargebee's TaxJar integration. \* government - Government \* other - Other \* wholesale - Whole-sale |
| `locale` | `string` | No | Determines which region-specific language Chargebee uses to communicate with the customer. In the absence of the locale attribute, Chargebee will use your site's default language for customer communication. |
| `entity_code` | `a \| b \| c \| d \| e \| f \| g \| h \| i \| j \| k \| l \| m \| n \| p \| q \| r \| med1 \| med2` | No | 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) . \* med2 - US Medical Device Excise Tax with taxable sales tax \* med1 - US Medical Device Excise Tax with exempt sales tax \* d - Foreign diplomat \* e - Charitable or benevolent organization \* f - Religious organization \* g - Resale \* a - Federal government \* b - State government \* c - Tribe/Status Indian/Indian Band \* l - Other or custom \* m - Educational organization \* n - Local government \* h - Commercial agricultural production \* i - Industrial production/manufacturer \* j - Direct pay permit \* k - Direct mail \* p - Commercial aquaculture \* q - Commercial Fishery \* r - Non-resident |
| `exempt_number` | `string` | No | 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) . |
| `offline_payment_method` | `no_preference \| cash \| check \| bank_transfer \| ach_credit \| sepa_credit \| boleto \| us_automated_bank_transfer \| eu_automated_bank_transfer \| uk_automated_bank_transfer \| jp_automated_bank_transfer \| mx_automated_bank_transfer \| custom` | No | The preferred offline payment method for the customer. \* custom - Custom \* bank\_transfer - Bank Transfer \* boleto - Boleto \* jp\_automated\_bank\_transfer - JP Automated Bank Transfer \* sepa\_credit - SEPA Credit \* cash - Cash \* check - Check \* mx\_automated\_bank\_transfer - MX Automated Bank Transfer \* no\_preference - No Preference \* us\_automated\_bank\_transfer - US Automated Bank Transfer \* eu\_automated\_bank\_transfer - EU Automated Bank Transfer \* ach\_credit - ACH Credit \* uk\_automated\_bank\_transfer - UK Automated Bank Transfer |
| `invoice_notes` | `string` | No | A customer-facing note added to all invoices associated with this API resource. This note becomes one among [all the notes](https://docs.corsair.dev/docs/api/invoices/invoice-object#notes) displayed on the invoice PDF. |
| `auto_close_invoices` | `boolean` | No | Override for this customer, the [site-level setting](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) for auto-closing invoices. Only applicable when auto-closing invoices has been enabled for the site. This attribute is also available at the [subscription level](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#auto_close_invoices) which takes precedence. |
| `meta_data` | `object` | No | A collection of key-value pairs that provides extra information about the customer. **Note:** There's a character limit of 65,535. [Learn more](https://docs.corsair.dev/docs/api/advanced-features) . |
| `fraud_flag` | `safe \| fraudulent` | No | Indicates whether or not the customer has been identified as fraudulent. \* fraudulent - The customer has been marked as fraudulent \* safe - The customer has been marked as safe |
| `consolidated_invoicing` | `boolean` | No | Indicates whether invoices raised on the same day for the `customer` are consolidated. When provided, this overrides the default configuration at the [site-level](https://www.chargebee.com/docs/consolidated-invoicing.html#configuring-consolidated-invoicing). This parameter can be provided only when [Consolidated Invoicing](https://www.chargebee.com/docs/consolidated-invoicing.html) is enabled. **Note:** Any invoices raised when a subscription activates from `in_trial` or `future` `status`, are not consolidated by default. [Contact 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 consolidation for such invoices. . |
| `tax_providers_fields` | `object` | No | Parameters for tax\_providers\_fields |

> [accordion] meta\_data full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] tax\_providers\_fields full type
>
> ```ts theme={null}
> {
>   provider_name?: string[],
>   field_id?: string[],
>   field_value?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] card full type
>
> ```ts theme={null}
> {
>   payment_source_id?: string | null,
>   status?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   ref_tx_id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   iin?: string | null,
>   last4?: string | null,
>   card_type?: string | null,
>   funding_type?: string | null,
>   expiry_month?: number | null,
>   expiry_year?: number | null,
>   issuing_country?: string | null,
>   billing_addr1?: string | null,
>   billing_addr2?: string | null,
>   billing_city?: string | null,
>   billing_state_code?: string | null,
>   billing_state?: string | null,
>   billing_country?: string | null,
>   billing_zip?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   ip_address?: string | null,
>   powered_by?: string | null,
>   customer_id?: string | null,
>   masked_number?: string | null
> } | null
> ```

***

### updateBillingInfo

`customers.updateBillingInfo`

Update billing info for a customer. Updates a customer's billing information, including billing address and tax-related details such as VAT number. Note See Related APIs for other customer attributes that can be updated.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.customers.updateBillingInfo({ customerId: 'cust_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customerId` | `string` | Yes | — |
| `vat_number` | `string` | No | The VAT/tax registration number for the customer. For customers with [`billing_address`](https://docs.corsair.dev/docs/api/customers/customer-object#billing_address) as `XI` (United Kingdom - Northern Ireland), the first two characters of the [full VAT number](https://en.wikipedia.org/wiki/VAT_identification_number) can be overridden by setting [`vat_number_prefix`](https://docs.corsair.dev/docs/api/customers/customer-object#vat_number_prefix). **Warning** \* If you don't pass this parameter, the value will be **deleted** from the customer object. \* If you pass this parameter and also pass `business_customer_without_vat_number` = `true`, the request will fail. |
| `vat_number_prefix` | `string` | No | 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`](https://docs.corsair.dev/docs/api/customers/customer-object#billing_address) as `XI` (United Kingdom - Northern Ireland). **Warning** If you don't pass this parameter, the value will be **deleted** from the customer object. |
| `entity_identifier_scheme` | `string` | No | The Peppol BIS scheme associated with the [vat\_number](https://docs.corsair.dev/docs/api/customers/customer-object#vat_number) of the customer. This helps identify the specific type of customer entity. For example, `DE:VAT` is used for a German business entity while `DE:LWID45` is used for a German government entity. The value must be from the list of possible values and must correspond to the country provided under `billing_address.country`. See [list of possible values](https://www.chargebee.com/docs/e-invoicing.html#supported-countries) . **Tip:** If there are additional entity identifiers for the customer not associated with the `vat_number`, they can be provided as the `entity_identifiers[]` array. |
| `entity_identifier_standard` | `string` | No | The standard used for specifying the `entity_identifier_scheme`. Currently only `iso6523-actorid-upis` is supported and is used by default when not provided. **Tip:** If there are additional entity identifiers for the customer not associated with the `vat_number`, they can be provided as the `entity_identifiers[]` array. |
| `registered_for_gst` | `boolean` | No | 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. **Warning** \* If you don't pass this parameter, the value will be **deleted** from the customer object. \* If you pass this parameter as `true` and Australian GST is not configured for your site, the request will fail. |
| `business_customer_without_vat_number` | `boolean` | No | Confirms that a customer is a valid business without an EU/UK VAT number. **Warning** \* If you don't pass this parameter, the value will be **deleted** from the customer object. \* If you pass this parameter as `true` and also pass `vat_number`, the request will fail. |
| `is_einvoice_enabled` | `boolean` | No | Determines whether the customer is e-invoiced. When set to `true` or not set to any value, the customer is e-invoiced so long as e-invoicing is enabled for their country (`billing_address.country` ). When set to `false` , the customer is not e-invoiced even if e-invoicing is enabled for their country. **Tip:** It is possible to set a value for this flag even when E-Invoicing is disabled. However, it comes into effect only when E-Invoicing is enabled. |
| `einvoicing_method` | `automatic \| manual \| site_default` | No | Determines whether to send einvoice manually or automatic. \* automatic - Use this value to send e-invoice every time an invoice or credit note is created. \* manual - When manual is selected the automatic e-invoice sending is disabled. Use this value to send e-invoice manually through UI or API. \* site\_default - The default value of the site which can be overridden at the customer level. |
| `billing_address` | `object` | No | Parameters for billing\_address. |
| `entity_identifiers` | `object` | No | Parameters for entity\_identifiers. |
| `tax_providers_fields` | `object` | No | Parameters for tax\_providers\_fields. **Note** This parameter is supported only when selling to [India-SEZ](https://www.chargebee.com/docs/billing/2.0/taxes/indian-gst#configuring-taxes-for-special-economic-zones-sezs) customers or when you're an [Indian business that sells to customers outside India](https://www.chargebee.com/docs/billing/2.0/taxes/indian-gst#configuring-taxes-for-exports). |

> [accordion] billing\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] entity\_identifiers full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   scheme?: string[],
>   value?: string[],
>   operation?: (create | update | delete)[],
>   standard?: string[]
> }
> ```

> [accordion] tax\_providers\_fields full type
>
> ```ts theme={null}
> {
>   provider_name?: string[],
>   field_id?: string[],
>   field_value?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] card full type
>
> ```ts theme={null}
> {
>   payment_source_id?: string | null,
>   status?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   ref_tx_id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   iin?: string | null,
>   last4?: string | null,
>   card_type?: string | null,
>   funding_type?: string | null,
>   expiry_month?: number | null,
>   expiry_year?: number | null,
>   issuing_country?: string | null,
>   billing_addr1?: string | null,
>   billing_addr2?: string | null,
>   billing_city?: string | null,
>   billing_state_code?: string | null,
>   billing_state?: string | null,
>   billing_country?: string | null,
>   billing_zip?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   ip_address?: string | null,
>   powered_by?: string | null,
>   customer_id?: string | null,
>   masked_number?: string | null
> } | null
> ```

***

### updateCard

`customers.updateCard`

Update card for a customer. #### Deprecated The Payment Sources API , with its additional options and improvements, obsoletes the Cards APIs . This operation is obsoleted by the following: \* Create using temporary token \* Create using permanent token \* Create a card payment source Adds or replaces card details of a customer.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.customers.updateCard({
	customerId: 'cust_8gsnbYfsMLds',
	expiry_month: 1,
	expiry_year: 1,
	number: 'example',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customerId` | `string` | Yes | — |
| `gateway_account_id` | `string` | No | The gateway account in which this payment source is stored. |
| `tmp_token` | `string` | No | The single-use card token returned by vaults like Stripe/Braintree which act as a substitute for your card details. Before calling this API, you should have submitted your card details to the gateway and gotten this token in return. **Note:** Supported only for Stripe, Braintree and Authorize.Net. If this value is specified, there is no need to specify other card details (like number, cvv, etc). |
| `first_name` | `string` | No | Cardholder's first name. |
| `last_name` | `string` | No | Cardholder's last name. |
| `number` | `string` | Yes | The credit card number without any format. If you are using [Braintree.js](https://developer.paypal.com/braintree/docs/guides/client-sdk/setup/javascript/v2#getting-braintree.js) , you can specify the Braintree encrypted card number here. |
| `expiry_month` | `number` | Yes | Card expiry month. |
| `expiry_year` | `number` | Yes | Card expiry year. |
| `cvv` | `string` | No | The card verification value (CVV). If you are using [Braintree.js](https://developer.paypal.com/braintree/docs/guides/client-sdk/setup/javascript/v2#getting-braintree.js) , you can specify the Braintree encrypted CVV here. |
| `preferred_scheme` | `cartes_bancaires \| mastercard \| visa \| dankort` | No | The customer's preferred card scheme for co-branded cards. **Note**: Currently, this parameter is supported only for Stripe, Adyen, and Chargebee Payments. \* dankort - A Dankort card scheme. Supported only for Adyen and Chargebee Payments. \* mastercard - A MasterCard scheme. \* cartes\_bancaires - A Cartes Bancaires card scheme. \* visa - A Visa card scheme. |
| `billing_addr1` | `string` | No | Address line 1, as available in card billing address. |
| `billing_addr2` | `string` | No | Address line 2, as available in card billing address. |
| `billing_city` | `string` | No | City, as available in card billing address. |
| `billing_state_code` | `string` | No | The [ISO 3166-2 state/province code](https://www.iso.org/obp/ui/#search/code) without the country prefix. Currently supported for USA, Canada, India and UAE. For instance, for Arizona (USA), set `billing_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` ). For Dubai (UAE), set as `DU` (not `AE-DU` ). |
| `billing_state` | `string` | No | The state/province name. Is set by Chargebee automatically for US, Canada, India and UAE, if `billing_state_code` is provided. |
| `billing_zip` | `string` | No | Postal or Zip code, as available in card billing address. |
| `billing_country` | `string` | No | 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. . |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] card full type
>
> ```ts theme={null}
> {
>   payment_source_id?: string | null,
>   status?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   ref_tx_id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   iin?: string | null,
>   last4?: string | null,
>   card_type?: string | null,
>   funding_type?: string | null,
>   expiry_month?: number | null,
>   expiry_year?: number | null,
>   issuing_country?: string | null,
>   billing_addr1?: string | null,
>   billing_addr2?: string | null,
>   billing_city?: string | null,
>   billing_state_code?: string | null,
>   billing_state?: string | null,
>   billing_country?: string | null,
>   billing_zip?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   ip_address?: string | null,
>   powered_by?: string | null,
>   customer_id?: string | null,
>   masked_number?: string | null
> } | null
> ```

***

### updateContact

`customers.updateContact`

Update contacts for a customer. Updates the details of a contact for a customer. You can give the field data to be updated as input parameters along with the Contact ID to update it.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.customers.updateContact({ customerId: 'cust_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customerId` | `string` | Yes | — |
| `contact` | `object` | No | Parameters for contact |

> [accordion] contact full type
>
> ```ts theme={null}
> {
>   id: string,
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   phone?: string,
>   label?: string,
>   enabled?: boolean,
>   send_billing_email?: boolean,
>   send_account_email?: boolean
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] card full type
>
> ```ts theme={null}
> {
>   payment_source_id?: string | null,
>   status?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   ref_tx_id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   iin?: string | null,
>   last4?: string | null,
>   card_type?: string | null,
>   funding_type?: string | null,
>   expiry_month?: number | null,
>   expiry_year?: number | null,
>   issuing_country?: string | null,
>   billing_addr1?: string | null,
>   billing_addr2?: string | null,
>   billing_city?: string | null,
>   billing_state_code?: string | null,
>   billing_state?: string | null,
>   billing_country?: string | null,
>   billing_zip?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   ip_address?: string | null,
>   powered_by?: string | null,
>   customer_id?: string | null,
>   masked_number?: string | null
> } | null
> ```

***

### updateHierarchySettings

`customers.updateHierarchySettings`

Update account hierarchy access settings for a customer. When the customer is part of an account hierarchy, this operation updates the access privileges that both the customer and its parent have to the customer's data. Terminology The term "parent" usually refers to the customer with the ID payment\_owner\_id.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.customers.updateHierarchySettings({ customerId: 'cust_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customerId` | `string` | Yes | — |
| `use_default_hierarchy_settings` | `boolean` | No | Decides if Chargebee should apply settings from the [Chargebee Billing UI](https://www.chargebee.com/docs/2.0/account-hierarchy.html#advanced-mode) or from this API request. \* If set to `true`: Chargebee removes existing settings stored in the `parent_account_access` and `child_account_access` attributes of the customer. The settings configured in the Chargebee Billing UI apply for the customer. \* If set to `false`: Chargebee replaces existing settings stored in the `parent_account_access` and `child_account_access` parameters with those passed in this API call. If any of those parameters are not passed, they remain unchanged for the customer. |
| `parent_account_access` | `object` | No | Parameters for parent\_account\_access |
| `child_account_access` | `object` | No | When the customer is part of an [account hierarchy](https://www.chargebee.com/docs/account-hierarchy.html) , this attribute defines the level of access that the customer has to its own information. |

> [accordion] parent\_account\_access full type
>
> ```ts theme={null}
> {
>   portal_edit_child_subscriptions?: yes | view_only | no,
>   portal_download_child_invoices?: yes | view_only | no,
>   send_subscription_emails?: boolean,
>   send_payment_emails?: boolean,
>   send_invoice_emails?: boolean
> }
> ```

> [accordion] child\_account\_access full type
>
> ```ts theme={null}
> {
>   portal_edit_subscriptions?: yes | view_only,
>   portal_download_invoices?: yes | view_only | no,
>   send_subscription_emails?: boolean,
>   send_payment_emails?: boolean,
>   send_invoice_emails?: boolean
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

***

### updatePaymentMethod

`customers.updatePaymentMethod`

Update payment method for a customer. Payment Sources comes with additional options and improvements to the Card APIs . For this operation, use the Create using temporary token API or Create using permanent token API under Payment Sources to update payment method for the customer. Updates payment method details for a customer.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.customers.updatePaymentMethod({ customerId: 'cust_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customerId` | `string` | Yes | — |
| `payment_method` | `object` | No | Parameters for payment\_method |

> [accordion] payment\_method full type
>
> ```ts theme={null}
> {
>   type: card | paypal_express_checkout | amazon_payments | direct_debit | generic | alipay | unionpay | wechat_pay | ideal | google_pay | sofort | bancontact | giropay | dotpay | upi | netbanking_emandates | venmo | pay_to | faster_payments | sepa_instant_transfer | automated_bank_transfer | klarna_pay_now | online_banking_poland | payconiq_by_bancontact | electronic_payment_standard | kbc_payment_button | pay_by_bank | trustly | stablecoin | kakao_pay | naver_pay | revolut_pay | cash_app_pay | twint | go_pay | grab_pay | pay_co | after_pay | swish | payme | pix | klarna | alipay_hk | paypay | gcash | south_korean_cards | paynow | bizum | promptpay | dana | touch_n_go | tamara | qpay | ovo | momo | mercado_pago | nequi | nupay | picpay | thai_qr | blik | fpx | wero | p24 | affirm_pay | rakuten_pay,
>   gateway_account_id?: string,
>   reference_id?: string,
>   tmp_token?: string,
>   issuing_country?: string,
>   additional_information?: {
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] card full type
>
> ```ts theme={null}
> {
>   payment_source_id?: string | null,
>   status?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   ref_tx_id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   iin?: string | null,
>   last4?: string | null,
>   card_type?: string | null,
>   funding_type?: string | null,
>   expiry_month?: number | null,
>   expiry_year?: number | null,
>   issuing_country?: string | null,
>   billing_addr1?: string | null,
>   billing_addr2?: string | null,
>   billing_city?: string | null,
>   billing_state_code?: string | null,
>   billing_state?: string | null,
>   billing_country?: string | null,
>   billing_zip?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   ip_address?: string | null,
>   powered_by?: string | null,
>   customer_id?: string | null,
>   masked_number?: string | null
> } | null
> ```

***

## Custom Field Configs

### getMetadata

`customFieldConfigs.getMetadata`

Retrieve a custom field configuration. Retrieves the configuration for the custom field that matches the specified entity type and API name.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.customFieldConfigs.getMetadata({ entity_type: 'customer', api_name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `entity_type` | `customer \| subscription \| plan \| addon \| invoice \| credit_note \| item_family \| plan_item \| addon_item \| charge_item \| plan_price \| addon_price \| charge_price \| coupon \| quote` | Yes | Allowed entity types for custom fields. \* customer - Entity that represents a customer. \* invoice - Entity that represents an invoice. \* addon\_item - Entity that represents item of type addon. \* plan - Entity that represents a subscription plan. \* subscription - Entity that represents a subscription of a customer. \* coupon - Entity that represents a discount coupon. \* charge\_price - Entity that represents charge price. \* item\_family - Entity that represents item family. \* addon - Entity that represents an addon. \* addon\_price - Entity that represents addon price. \* credit\_note - Entity that represents a credit note. \* charge\_item - Entity that represents item of type charge. \* plan\_item - Entity that represents item of type plan. \* quote - Entity that represents a quote. \* plan\_price - Entity that represents plan price. |
| `api_name` | `string` | Yes | Custom field identifier. |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `custom_field_config` | `object \| null` | No | This resource represents the configuration for a specific [custom field](https://docs.corsair.dev/docs/api/advanced-features#custom-fields). |

> [accordion] custom\_field\_config full type
>
> ```ts theme={null}
> {
>   entity_type?: string | null,
>   api_name?: string | null,
>   display_name?: string | null,
>   field_datatype?: string | null,
>   edit_ui?: string | null,
>   description?: string | null,
>   required?: boolean | null,
>   props?: string | null,
>   field_order?: number | null,
>   status?: string | null,
>   published_status?: string | null,
>   created_at?: number | null,
>   modified_at?: number | null
> } | null
> ```

***

### list

`customFieldConfigs.list`

List custom field configurations. Lists the configurations for all custom fields defined for the specified entity type.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.customFieldConfigs.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `entity_type` | `customer \| subscription \| plan \| addon \| invoice \| credit_note \| item_family \| plan_item \| addon_item \| charge_item \| plan_price \| addon_price \| charge_price \| coupon \| quote` | No | Allowed entity types for custom fields. \* customer - Entity that represents a customer. \* invoice - Entity that represents an invoice. \* addon\_item - Entity that represents item of type addon. \* plan - Entity that represents a subscription plan. \* subscription - Entity that represents a subscription of a customer. \* coupon - Entity that represents a discount coupon. \* charge\_price - Entity that represents charge price. \* item\_family - Entity that represents item family. \* addon - Entity that represents an addon. \* addon\_price - Entity that represents addon price. \* credit\_note - Entity that represents a credit note. \* charge\_item - Entity that represents item of type charge. \* plan\_item - Entity that represents item of type plan. \* quote - Entity that represents a quote. \* plan\_price - Entity that represents plan price. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   custom_field_config?: {
>     entity_type?: string | null,
>     api_name?: string | null,
>     display_name?: string | null,
>     field_datatype?: string | null,
>     edit_ui?: string | null,
>     description?: string | null,
>     required?: boolean | null,
>     props?: string | null,
>     field_order?: number | null,
>     status?: string | null,
>     published_status?: string | null,
>     created_at?: number | null,
>     modified_at?: number | null
>   } | null
> }[] | null
> ```

***

## Differential Prices

### delete

`differentialPrices.delete`

Delete a differential price. using a differential\_price\_id and item\_price\_id .

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.differentialPrices.delete({ differentialPriceId: 'example', item_price_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `differentialPriceId` | `string` | Yes | — |
| `item_price_id` | `string` | Yes | The id of the item price (`addon` or `charge` ) whose price should change according to the plan-item it is applied to. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `differential_price` | `object \| null` | No | Differential pricing helps implement a pricing strategy for addons and charges based on the plans they're purchased with. A differential price a specific price for an addon- or charge-[item price](https://docs.corsair.dev/docs/api/item_prices) when purchased along with a particular plan. Differential pricing for addons ------------------------------- Consider an addon called 24x7 Customer Support provided with a cloud storage service. You can configure differential prices for each of the addon-item prices based on the plan they are purchased with, as follows: \|---\|-----------------------------------------------------\|-----------------------------------------------\|-----------------------------------------------------\| \| \| **Addon item price** \| **Price when applied to *Standard*** **Plan** \| **Price when applied to** ***Enterprise*** **Plan** \| \| 1 \| 24x7 Customer Support, USD, Monthly, Flat fee, $100 \| $90 \| $150 \| \| 2 \| 24x7 Customer Support, USD, Yearly, Flat fee, $1000 \| $900 \| $1500 \| Differential pricing for charges -------------------------------- Consider a charge, called Setup fee, for installing and configuring a cloud-based project management platform. There are two modes in which you can set up differential pricing for a charge: #### Mode A: One charge differential price per plan-item This mode is used to specify one differential price for the charge-item price per [plan-item](https://docs.corsair.dev/docs/api/items) it is applied to. \|-------------------------------\|---------------------------------------------------\|-----------------------------------------------------\| \| **Charge-item price** \| **Price when applied to** ***Standard*** **plan** \| **Price when applied to** ***Enterprise*** **plan** \| \| Setup fee, USD, Flat fee $500 \| $400 \| $700 \| #### Mode B: Multiple charge differential prices per plan item This mode is used to specify multiple differential prices for the charge per plan-item, based on the plan period. \|-------------------------------\|-------------------------------------------------------------\|-----------------------------------------------------------\| \| **Charge-item price** \| **Price when applied to** ***Standard*** **plan, 6 months** \| **Price when applied to** ***Standard*** **plan, yearly** \| \| Setup fee, USD, Flat fee $500 \| $400 \| $300 \| In the above example, even if the "6 month" or "yearly" plan-item prices do not exist, the differential prices for the charge can still be created. They take effect whenever the plan-item prices are eventually created and used in subscriptions. |

> [accordion] differential\_price full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   item_price_id?: string | null,
>   parent_item_id?: string | null,
>   price?: number | null,
>   price_in_decimal?: string | null,
>   status?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   modified_at?: number | null,
>   currency_code?: string | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null,
>   tiers?: {
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   parent_periods?: {
>     period_unit?: string | null,
>     period?: any[] | null
>   }[] | null
> } | null
> ```

***

### get

`differentialPrices.get`

Retrieve a differential price. using a differential\_price\_id and item\_price\_id .

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.differentialPrices.get({ item_price_id: 'example', differentialPriceId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `item_price_id` | `string` | Yes | The id of the item price (`addon` or `charge` ) whose price should change according to the plan-item it is applied to. |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `differentialPriceId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `differential_price` | `object \| null` | No | Differential pricing helps implement a pricing strategy for addons and charges based on the plans they're purchased with. A differential price a specific price for an addon- or charge-[item price](https://docs.corsair.dev/docs/api/item_prices) when purchased along with a particular plan. Differential pricing for addons ------------------------------- Consider an addon called 24x7 Customer Support provided with a cloud storage service. You can configure differential prices for each of the addon-item prices based on the plan they are purchased with, as follows: \|---\|-----------------------------------------------------\|-----------------------------------------------\|-----------------------------------------------------\| \| \| **Addon item price** \| **Price when applied to *Standard*** **Plan** \| **Price when applied to** ***Enterprise*** **Plan** \| \| 1 \| 24x7 Customer Support, USD, Monthly, Flat fee, $100 \| $90 \| $150 \| \| 2 \| 24x7 Customer Support, USD, Yearly, Flat fee, $1000 \| $900 \| $1500 \| Differential pricing for charges -------------------------------- Consider a charge, called Setup fee, for installing and configuring a cloud-based project management platform. There are two modes in which you can set up differential pricing for a charge: #### Mode A: One charge differential price per plan-item This mode is used to specify one differential price for the charge-item price per [plan-item](https://docs.corsair.dev/docs/api/items) it is applied to. \|-------------------------------\|---------------------------------------------------\|-----------------------------------------------------\| \| **Charge-item price** \| **Price when applied to** ***Standard*** **plan** \| **Price when applied to** ***Enterprise*** **plan** \| \| Setup fee, USD, Flat fee $500 \| $400 \| $700 \| #### Mode B: Multiple charge differential prices per plan item This mode is used to specify multiple differential prices for the charge per plan-item, based on the plan period. \|-------------------------------\|-------------------------------------------------------------\|-----------------------------------------------------------\| \| **Charge-item price** \| **Price when applied to** ***Standard*** **plan, 6 months** \| **Price when applied to** ***Standard*** **plan, yearly** \| \| Setup fee, USD, Flat fee $500 \| $400 \| $300 \| In the above example, even if the "6 month" or "yearly" plan-item prices do not exist, the differential prices for the charge can still be created. They take effect whenever the plan-item prices are eventually created and used in subscriptions. |

> [accordion] differential\_price full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   item_price_id?: string | null,
>   parent_item_id?: string | null,
>   price?: number | null,
>   price_in_decimal?: string | null,
>   status?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   modified_at?: number | null,
>   currency_code?: string | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null,
>   tiers?: {
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   parent_periods?: {
>     period_unit?: string | null,
>     period?: any[] | null
>   }[] | null
> } | null
> ```

***

### list

`differentialPrices.list`

List differential prices. Returns a list of differential prices satisfying all the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order (latest first).

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.differentialPrices.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `item_price_id` | `object` | No | optional, string filter The id of the item price (`addon` or `charge` ) whose price should change according to the plan-item it is applied to. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *item\_price\_id\\\[is\\] = "day-pass-USD"* |
| `item_id` | `object` | No | optional, string filter Item Id of Addon / Charge item price for which differential pricing is applied to. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *item\_id\\\[is\\] = "day-pass"* |
| `id` | `object` | No | optional, string filter A unique and immutable id for the differential price. It is auto-generated when the differential price is created. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *id\\\[is\\] = "defcc4f1-f21f-47f4-8019-beddb9beab5f"* |
| `parent_item_id` | `object` | No | optional, string filter The id of the plan-item, in relation to which, the differential pricing for the addon or charge is defined. For example, this would be the id of the *Standard* or *Enterprise* plans-items mentioned in the [examples above](https://docs.corsair.dev/docs/api/differential_prices) . **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *parent\_item\_id\\\[is\_not\\] = "basic"* |

> [accordion] item\_price\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] item\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] parent\_item\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   differential_price?: {
>     id?: string | null,
>     item_price_id?: string | null,
>     parent_item_id?: string | null,
>     price?: number | null,
>     price_in_decimal?: string | null,
>     status?: string | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     created_at?: number | null,
>     modified_at?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null,
>     deleted?: boolean | null,
>     tiers?: {
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       price?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       price_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     parent_periods?: {
>       period_unit?: string | null,
>       period?: any[] | null
>     }[] | null
>   } | null
> }[] | null
> ```

***

### update

`differentialPrices.update`

Update a differential price. using a differential\_price\_id and item\_price\_id .

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.differentialPrices.update({ differentialPriceId: 'example', item_price_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `differentialPriceId` | `string` | Yes | — |
| `item_price_id` | `string` | Yes | The id of the item price (`addon` or `charge` ) whose price should change according to the plan-item it is applied to. |
| `price` | `number` | No | The differential price. If the pricing model of the `item_price_id` is `tiered` , `volume` , or `stairstep` , pass `tiers` instead of this. |
| `price_in_decimal` | `string` | No | The price of the item when the pricing\_model is `flat_fee`. When the pricing model is `per_unit` , it is the price per unit quantity of the item. Not applicable for the other pricing models. The value is in decimal and in major units of the currency. Also, this is only applicable when [multi-decimal pricing](https://docs.corsair.dev/docs/api/currencies) is enabled. |
| `parent_periods` | `object` | No | Parameters for parent\_periods |
| `tiers` | `object` | No | Parameters for tiers |

> [accordion] parent\_periods full type
>
> ```ts theme={null}
> {
>   period_unit: (day | week | month | year)[],
>   period?: any[][]
> }
> ```

> [accordion] tiers full type
>
> ```ts theme={null}
> {
>   starting_unit?: number[],
>   ending_unit?: number[],
>   price?: number[],
>   starting_unit_in_decimal?: string[],
>   ending_unit_in_decimal?: string[],
>   price_in_decimal?: string[],
>   pricing_type?: (per_unit | flat_fee | package)[],
>   package_size?: number[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `differential_price` | `object \| null` | No | Differential pricing helps implement a pricing strategy for addons and charges based on the plans they're purchased with. A differential price a specific price for an addon- or charge-[item price](https://docs.corsair.dev/docs/api/item_prices) when purchased along with a particular plan. Differential pricing for addons ------------------------------- Consider an addon called 24x7 Customer Support provided with a cloud storage service. You can configure differential prices for each of the addon-item prices based on the plan they are purchased with, as follows: \|---\|-----------------------------------------------------\|-----------------------------------------------\|-----------------------------------------------------\| \| \| **Addon item price** \| **Price when applied to *Standard*** **Plan** \| **Price when applied to** ***Enterprise*** **Plan** \| \| 1 \| 24x7 Customer Support, USD, Monthly, Flat fee, $100 \| $90 \| $150 \| \| 2 \| 24x7 Customer Support, USD, Yearly, Flat fee, $1000 \| $900 \| $1500 \| Differential pricing for charges -------------------------------- Consider a charge, called Setup fee, for installing and configuring a cloud-based project management platform. There are two modes in which you can set up differential pricing for a charge: #### Mode A: One charge differential price per plan-item This mode is used to specify one differential price for the charge-item price per [plan-item](https://docs.corsair.dev/docs/api/items) it is applied to. \|-------------------------------\|---------------------------------------------------\|-----------------------------------------------------\| \| **Charge-item price** \| **Price when applied to** ***Standard*** **plan** \| **Price when applied to** ***Enterprise*** **plan** \| \| Setup fee, USD, Flat fee $500 \| $400 \| $700 \| #### Mode B: Multiple charge differential prices per plan item This mode is used to specify multiple differential prices for the charge per plan-item, based on the plan period. \|-------------------------------\|-------------------------------------------------------------\|-----------------------------------------------------------\| \| **Charge-item price** \| **Price when applied to** ***Standard*** **plan, 6 months** \| **Price when applied to** ***Standard*** **plan, yearly** \| \| Setup fee, USD, Flat fee $500 \| $400 \| $300 \| In the above example, even if the "6 month" or "yearly" plan-item prices do not exist, the differential prices for the charge can still be created. They take effect whenever the plan-item prices are eventually created and used in subscriptions. |

> [accordion] differential\_price full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   item_price_id?: string | null,
>   parent_item_id?: string | null,
>   price?: number | null,
>   price_in_decimal?: string | null,
>   status?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   modified_at?: number | null,
>   currency_code?: string | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null,
>   tiers?: {
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   parent_periods?: {
>     period_unit?: string | null,
>     period?: any[] | null
>   }[] | null
> } | null
> ```

***

## Disputes

### get

`disputes.get`

Retrieve A Dispute. Retrieves a dispute identified by its unique id. Use this operation to check the current status of a dispute, the amount under dispute, and the transaction and customer it relates to. To find disputes when you don't have the dispute id, use the List disputes operation.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.disputes.get({ disputeId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `disputeId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `dispute` | `object \| null` | No | This resource represents a [dispute](https://www.chargebee.com/docs/payments/2.0/others/chargeback) raised against a payment collected on your site. A dispute is created when a cardholder questions a payment with their card issuer, either as a formal `chargeback` or as a pre-chargeback `inquiry`. Chargebee records each dispute against the [transaction](https://docs.corsair.dev/docs/api/transactions/transaction-object) that was disputed, the [customer](https://docs.corsair.dev/docs/api/customers/customer-object) who made the payment, and the gateway account that processed it. As the payment gateway moves the dispute toward a resolution, Chargebee updates the dispute [`status`](https://docs.corsair.dev/docs/api/disputes/dispute-object#status). Disputes are read-only through the API. Chargebee creates and updates them from the notifications it receives from the payment gateway, so there are no operations to create, update, or delete a dispute. |

> [accordion] dispute full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   transaction_id?: string | null,
>   gateway_account_id?: string | null,
>   id_at_gateway?: string | null,
>   currency_code?: string | null,
>   amount?: number | null,
>   reason?: string | null,
>   status?: string | null,
>   type?: string | null,
>   is_partial_dispute?: boolean | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null
> } | null
> ```

***

### list

`disputes.list`

List Disputes. Lists the disputes raised against the transactions on your site, with the most recently created dispute first. Use the filter parameters to narrow the list to the disputes you want to act on.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.disputes.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `id` | `object` | No | optional, string filter Uniquely identifies the dispute. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *id\\\[is\\] = "dspt\_16BdDXSlbu4uV1Ee6"* |
| `status` | `object` | No | optional, enumerated string filter The current state of the dispute. Possible values are : initiated, funds\_withdrawn, in\_review, cancelled, lost, won. **Supported operators :** is, is\_not, in, not\_in **Example →** *status\\\[is\\] = "initiated"* |
| `type` | `object` | No | optional, enumerated string filter The nature of the dispute raised against the payment. Possible values are : chargeback, inquiry. **Supported operators :** is, is\_not, in, not\_in **Example →** *type\\\[is\\] = "chargeback"* |
| `customer_id` | `object` | No | optional, string filter Identifier of the customer whose payment was disputed. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *customer\_id\\\[is\\] = "4gmiXbsjdm"* |
| `transaction_id` | `object` | No | optional, string filter Identifier of the transaction that was disputed. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *transaction\_id\\\[is\\] = "txn\_16BdDXSlbu4uV1Ee6"* |
| `amount` | `object` | No | optional, in cents filter To filter based on the amount under dispute. **Supported operators :** is, is\_not, lt, lte, gt, gte, between **Example →** *amount\\\[gt\\] = "1200"* |
| `created_at` | `object` | No | optional, timestamp(UTC) in seconds filter To filter based on the time at which the dispute was created. Use this filter when listing disputes for better query performance. **Supported operators :** after, before, on, between **Example →** *created\_at\\\[after\\] = "1435054328"* |

> [accordion] id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] status full type
>
> ```ts theme={null}
> {
>   is?: initiated | funds_withdrawn | in_review | cancelled | lost | won,
>   is_not?: initiated | funds_withdrawn | in_review | cancelled | lost | won,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] type full type
>
> ```ts theme={null}
> {
>   is?: chargeback | inquiry,
>   is_not?: chargeback | inquiry,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] customer\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] transaction\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] amount full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   lt?: string,
>   lte?: string,
>   gt?: string,
>   gte?: string,
>   between?: string
> }
> ```

> [accordion] created\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   dispute?: {
>     id?: string | null,
>     customer_id?: string | null,
>     transaction_id?: string | null,
>     gateway_account_id?: string | null,
>     id_at_gateway?: string | null,
>     currency_code?: string | null,
>     amount?: number | null,
>     reason?: string | null,
>     status?: string | null,
>     type?: string | null,
>     is_partial_dispute?: boolean | null,
>     created_at?: number | null,
>     resource_version?: number | null,
>     updated_at?: number | null
>   } | null
> }[] | null
> ```

***

## Einvoices

### get

`einvoices.get`

Retrieve an e-invoice. Retrieve the e-invoice for the specified e-invoice id (einvoice\_id).

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.einvoices.get({ einvoiceId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `einvoiceId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `einvoice` | `object \| null` | No | An e-invoice record associated with an invoice or credit note. It includes processing status, provider references, nested artifacts (for example application responses), and related status messages. |

> [accordion] einvoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   entity_type?: string | null,
>   entity_id?: string | null,
>   reference_id?: string | null,
>   reference_number?: string | null,
>   status?: string | null,
>   message?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   deleted?: boolean | null,
>   provider_references?: any[] | null,
>   business_entity_id?: string | null,
>   artifacts?: {
>     artifact_type?: string | null,
>     direction?: string | null,
>     status?: string | null,
>     code?: string | null,
>     external_artifact_id?: string | null,
>     created_at?: number | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     deleted?: boolean | null
>   }[] | null
> } | null
> ```

***

### list

`einvoices.list`

List e-invoices. Returns a list of e-invoices. You can filter by id, reference id, updated at, invoice id, or credit note id.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.einvoices.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `id` | `object` | No | optional, string filter The unique id for the e-invoice. **Supported operators :** is, in **Example →** *id\\\[is\\] = "HmaT0avT2mtbTL3mR"* |
| `reference_id` | `object` | No | optional, string filter Identifier returned by the connected e-invoicing provider for this submission. **Supported operators :** is, in **Example →** *reference\_id\\\[is\\] = "einvoice\_ref\_123"* |
| `updated_at` | `object` | No | optional, timestamp(UTC) in seconds filter Filter e-invoices based on `updated_at`. Useful for downstream delta sync. It is advisable when using this filter, to pass the `sort_by` input parameter as `updated_at` for a faster response. **Supported operators :** after, before, on, between **Example →** *updated\_at\\\[after\\] = "1243545465"* |
| `sort_by` | `object` | No | optional, string filter Sorts based on the specified attribute. **Supported attributes :** updated\_at **Supported sort-orders :** asc, desc **Example →** *sort\_by\\\[desc\\] = "updated\_at"* This will sort the result based on the 'updated\_at' attribute in descending (latest first) order. When omitted, the list defaults to `updated_at` descending (with `id` as tiebreaker). |
| `invoice_id` | `string` | No | Filter e-invoices belonging to the invoice with this id. **Constraints** \* Query parameter (`invoice_id={invoice_id}`), not an operator filter (`invoice_id[is]`). \* Cannot be sent together with `credit_note_id`; the API returns an error if both are passed. |
| `credit_note_id` | `string` | No | Filter e-invoices belonging to the credit note with this id. **Constraints** \* Query parameter (`credit_note_id={credit_note_id}`), not an operator filter (`credit_note_id[is]`). \* Cannot be sent together with `invoice_id`; the API returns an error if both are passed. |

> [accordion] id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   in?: string
> }
> ```

> [accordion] reference\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   in?: string
> }
> ```

> [accordion] updated\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] sort\_by full type
>
> ```ts theme={null}
> {
>   asc?: updated_at,
>   desc?: updated_at
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   einvoice?: {
>     id?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     created_at?: number | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     deleted?: boolean | null,
>     provider_references?: any[] | null,
>     business_entity_id?: string | null,
>     artifacts?: {
>       artifact_type?: string | null,
>       direction?: string | null,
>       status?: string | null,
>       code?: string | null,
>       external_artifact_id?: string | null,
>       created_at?: number | null,
>       resource_version?: number | null,
>       updated_at?: number | null,
>       deleted?: boolean | null
>     }[] | null
>   } | null
> }[] | null
> ```

***

## Entitlements

### create

`entitlements.create`

Manage entitlements for a feature. Create, update, or remove a set of entitlements for a feature. The behavior depends on the specified action. It tries to create, update, or delete entitlement objects. If any of the entitlement objects fail to process, the entire operation stops with an error, and no entitlements are processed.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.entitlements.create({ action: 'upsert' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `action` | `upsert \| remove` | Yes | The specific action to be performed for each `entitlement` specified. \* upsert - If the `entitlement` already exists for the `feature_id` and `entity_id` combination, the `value` of the `entitlement` is updated. If it doesn't exist, a new `entitlement` is created. \* remove - Deletes the `entitlement` for the `feature_id` and `entity_id` combination, if it exists. |
| `change_reason` | `string` | No | Comments or reason for this entitlement change. |
| `entitlements` | `object` | No | Parameters for entitlements |

> [accordion] entitlements full type
>
> ```ts theme={null}
> {
>   entity_id: string[],
>   feature_id: string[],
>   entity_type?: (plan | addon | charge | plan_price | addon_price)[],
>   value?: string[],
>   apply_grandfathering?: boolean[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   entitlement?: {
>     id?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null,
>     feature_id?: string | null,
>     feature_name?: string | null,
>     value?: string | null,
>     name?: string | null
>   } | null
> }[] | null
> ```

***

### list

`entitlements.list`

List entitlements. Retrieves a list of all the entitlements associated with the specified feature.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.entitlements.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `feature_id` | `object` | No | optional, string filter The `id` of the feature associated with this entitlement. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *feature\_id\\\[is\\] = "user-licenses"* |
| `entity_type` | `object` | No | optional, enumerated string filter The `type` of the `entity` to which this entitlement belongs. Possible values are : plan, addon, charge, plan\_price, addon\_price. **Supported operators :** is, is\_not, in, not\_in, in, not\_in **Example →** *entity\_type\\\[in\\] = "plan\_price"* |
| `entity_id` | `object` | No | optional, string filter The `id` of the `entity` to which this entitlement belongs. . **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *entity\_id\\\[in\\] = "usd-professional-monthly"* |

> [accordion] feature\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   in?: string
> }
> ```

> [accordion] entity\_type full type
>
> ```ts theme={null}
> {
>   is?: plan | addon | charge | plan_price | addon_price,
>   in?: string
> }
> ```

> [accordion] entity\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   in?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   entitlement?: {
>     id?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null,
>     feature_id?: string | null,
>     feature_name?: string | null,
>     value?: string | null,
>     name?: string | null
>   } | null
> }[] | null
> ```

***

## Estimates

### createInvoice

`estimates.createInvoice`

Create invoice estimate. Generates an estimate for the 'create an invoice' operation. This is similar to the Create an invoice API, but the invoice will not be generated. Only an estimate for this operation is created. Product Catalog 1.0 sites only.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.estimates.createInvoice({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `currency_code` | `string` | No | The currency code (ISO 4217 format) of the invoice amount. |
| `invoice_note` | `string` | No | A note for this particular invoice. This, and [all other notes](https://docs.corsair.dev/docs/api/invoices/invoice-object#notes) for the invoice are displayed on the PDF invoice sent to the customer. |
| `remove_general_note` | `boolean` | No | Set as `true` to remove the [**general note**](https://www.chargebee.com/docs/invoice_notes.html#adding-general-notes) from this invoice. |
| `coupon_ids` | `string[]` | No | List of Coupons to be added. |
| `authorization_transaction_id` | `string` | No | Authorization transaction to be captured. |
| `payment_source_id` | `string` | No | Payment source to be used for this payment. |
| `auto_collection` | `on \| off` | No | The customer level auto collection will be override if specified. \* on - Whenever an invoice is created, an automatic attempt will be made to charge. \* off - Whenever an invoice is created as payment due. |
| `invoice_date` | `number` | No | 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. |
| `invoice` | `object` | No | Parameters for invoice |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `addons` | `object` | No | Parameters for addons |
| `charges` | `object` | No | Parameters for charges |
| `notes_to_remove` | `object` | No | Parameters for notes\_to\_remove |
| `tax_providers_fields` | `object` | No | Parameters for tax\_providers\_fields |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   customer_id?: string,
>   subscription_id?: string,
>   po_number?: string
> }
> ```

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   unit_price?: number[],
>   unit_price_in_decimal?: string[],
>   date_from?: number[],
>   date_to?: number[]
> }
> ```

> [accordion] charges full type
>
> ```ts theme={null}
> {
>   amount?: number[],
>   amount_in_decimal?: string[],
>   description?: string[],
>   taxable?: boolean[],
>   tax_profile_id?: string[],
>   avalara_tax_code?: string[],
>   hsn_code?: string[],
>   taxjar_product_code?: string[],
>   avalara_sale_type?: (wholesale | retail | consumed | vendor_use)[],
>   avalara_transaction_type?: number[],
>   avalara_service_type?: number[],
>   date_from?: number[],
>   date_to?: number[]
> }
> ```

> [accordion] notes\_to\_remove full type
>
> ```ts theme={null}
> {
>   entity_type?: (plan | addon | customer | subscription | coupon)[],
>   entity_id?: string[]
> }
> ```

> [accordion] tax\_providers\_fields full type
>
> ```ts theme={null}
> {
>   provider_name?: string[],
>   field_id?: string[],
>   field_value?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `estimate` | `object \| null` | No | During the process of signing up customers to subscriptions, use the Estimates API to evaluate the details of the purchase before actually signing them up. The details returned by the API include the invoice amounts, next billing date and unbilled charges. For example, consider that you are creating a new subscription or update an existing one. Use the Estimates API before that to deduce the details such as the amount the customer would be charged, the state the subscription would be in after creation or updation, and so on. If you have configured the [Avalara integration](https://www.chargebee.com/docs/1.0/avalara.html), Chargebee retrieves the tax amount from Avalara for the invoice. This counts against your Avalara API limits. |

> [accordion] estimate full type
>
> ```ts theme={null}
> {
>   created_at?: number | null,
>   subscription_estimate?: {
>     id?: string | null,
>     currency_code?: string | null,
>     status?: string | null,
>     trial_end_action?: string | null,
>     next_billing_at?: number | null,
>     pause_date?: number | null,
>     resume_date?: number | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     contract_term?: {
>       id?: string | null,
>       status?: string | null,
>       contract_start?: number | null,
>       contract_end?: number | null,
>       billing_cycle?: number | null,
>       action_at_term_end?: string | null,
>       total_contract_value?: number | null,
>       total_contract_value_before_tax?: number | null,
>       cancellation_cutoff_period?: number | null,
>       created_at?: number | null,
>       subscription_id?: string | null,
>       remaining_billing_cycles?: number | null
>     } | null
>   } | null,
>   subscription_estimates?: {
>     id?: string | null,
>     currency_code?: string | null,
>     status?: string | null,
>     trial_end_action?: string | null,
>     next_billing_at?: number | null,
>     pause_date?: number | null,
>     resume_date?: number | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     contract_term?: {
>       id?: string | null,
>       status?: string | null,
>       contract_start?: number | null,
>       contract_end?: number | null,
>       billing_cycle?: number | null,
>       action_at_term_end?: string | null,
>       total_contract_value?: number | null,
>       total_contract_value_before_tax?: number | null,
>       cancellation_cutoff_period?: number | null,
>       created_at?: number | null,
>       subscription_id?: string | null,
>       remaining_billing_cycles?: number | null
>     } | null
>   }[] | null,
>   invoice_estimate?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   } | null,
>   invoice_estimates?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   }[] | null,
>   payment_schedule_estimates?: {
>     id?: string | null,
>     scheme_id?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     amount?: number | null,
>     currency_code?: string | null,
>     schedule_entries?: {
>       id?: string | null,
>       date?: number | null,
>       amount?: number | null,
>       scheduled_amount?: number | null,
>       status?: string | null
>     }[] | null
>   }[] | null,
>   next_invoice_estimate?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   } | null,
>   credit_note_estimates?: {
>     reference_invoice_id?: string | null,
>     type?: string | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     amount_allocated?: number | null,
>     amount_available?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   }[] | null,
>   unbilled_charge_estimates?: {
>     id?: string | null,
>     customer_id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     pricing_model?: string | null,
>     quantity?: number | null,
>     amount?: number | null,
>     currency_code?: string | null,
>     discount_amount?: number | null,
>     description?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     is_voided?: boolean | null,
>     voided_at?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     is_advance_charge?: boolean | null,
>     business_entity_id?: string | null,
>     deleted?: boolean | null
>   }[] | null
> } | null
> ```

***

### createInvoiceForItems

`estimates.createInvoiceForItems`

Create invoice for items estimate. This endpoint creates an invoice estimate for non-recurring items. You can optionally override the line item name and description displayed on the invoice for charge-item prices and one-time charges. These overrides are reflected in the returned invoice estimate.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.estimates.createInvoiceForItems({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `currency_code` | `string` | No | The currency code (ISO 4217 format) of the invoice amount. |
| `invoice_note` | `string` | No | A note for this particular invoice. This, and [all other notes](https://docs.corsair.dev/docs/api/invoices/invoice-object#notes) for the invoice are displayed on the PDF invoice sent to the customer. |
| `remove_general_note` | `boolean` | No | Set as `true` to remove the [**general note**](https://www.chargebee.com/docs/invoice_notes.html#adding-general-notes) from this invoice. |
| `coupon_ids` | `string[]` | No | List of Coupons to be added. |
| `authorization_transaction_id` | `string` | No | Authorization transaction to be captured. |
| `payment_source_id` | `string` | No | Payment source to be used for this payment. |
| `auto_collection` | `on \| off` | No | The customer level auto collection will be override if specified. \* on - Whenever an invoice is created, an automatic attempt will be made to charge. \* off - Whenever an invoice is created as payment due. |
| `invoice_date` | `number` | No | 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. |
| `invoice` | `object` | No | Parameters for invoice |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `billing_address` | `object` | No | Parameters for billing\_address |
| `item_prices` | `object` | No | Parameters for item\_prices |
| `item_tiers` | `object` | No | Parameters for item\_tiers |
| `charges` | `object` | No | Parameters for charges |
| `notes_to_remove` | `object` | No | Parameters for notes\_to\_remove |
| `discounts` | `object` | No | Parameters for discounts |
| `tax_providers_fields` | `object` | No | Parameters for tax\_providers\_fields |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   customer_id?: string,
>   subscription_id?: string,
>   po_number?: string
> }
> ```

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] billing\_address full type
>
> ```ts theme={null}
> {
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] item\_prices full type
>
> ```ts theme={null}
> {
>   item_price_id?: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   unit_price?: number[],
>   unit_price_in_decimal?: string[],
>   date_from?: number[],
>   date_to?: number[],
>   description?: string[],
>   entity_description?: string[]
> }
> ```

> [accordion] item\_tiers full type
>
> ```ts theme={null}
> {
>   item_price_id?: string[],
>   starting_unit?: number[],
>   ending_unit?: number[],
>   price?: number[],
>   starting_unit_in_decimal?: string[],
>   ending_unit_in_decimal?: string[],
>   price_in_decimal?: string[],
>   pricing_type?: (per_unit | flat_fee | package)[],
>   package_size?: number[]
> }
> ```

> [accordion] charges full type
>
> ```ts theme={null}
> {
>   amount?: number[],
>   amount_in_decimal?: string[],
>   description?: string[],
>   taxable?: boolean[],
>   tax_profile_id?: string[],
>   avalara_tax_code?: string[],
>   hsn_code?: string[],
>   taxjar_product_code?: string[],
>   avalara_sale_type?: (wholesale | retail | consumed | vendor_use)[],
>   avalara_transaction_type?: number[],
>   avalara_service_type?: number[],
>   date_from?: number[],
>   date_to?: number[],
>   entity_description?: string[]
> }
> ```

> [accordion] notes\_to\_remove full type
>
> ```ts theme={null}
> {
>   entity_type?: (customer | subscription | coupon | plan_item_price | addon_item_price | charge_item_price)[],
>   entity_id?: string[]
> }
> ```

> [accordion] discounts full type
>
> ```ts theme={null}
> {
>   percentage?: number[],
>   amount?: number[],
>   quantity?: number[],
>   apply_on: (invoice_amount | specific_item_price)[],
>   item_price_id?: string[]
> }
> ```

> [accordion] tax\_providers\_fields full type
>
> ```ts theme={null}
> {
>   provider_name?: string[],
>   field_id?: string[],
>   field_value?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `estimate` | `object \| null` | No | During the process of signing up customers to subscriptions, use the Estimates API to evaluate the details of the purchase before actually signing them up. The details returned by the API include the invoice amounts, next billing date and unbilled charges. For example, consider that you are creating a new subscription or update an existing one. Use the Estimates API before that to deduce the details such as the amount the customer would be charged, the state the subscription would be in after creation or updation, and so on. If you have configured the [Avalara integration](https://www.chargebee.com/docs/2.0/avalara.html), Chargebee retrieves the tax amount from Avalara for the invoice. This counts against your Avalara API limits. |

> [accordion] estimate full type
>
> ```ts theme={null}
> {
>   created_at?: number | null,
>   subscription_estimate?: {
>     id?: string | null,
>     currency_code?: string | null,
>     status?: string | null,
>     trial_end_action?: string | null,
>     next_billing_at?: number | null,
>     pause_date?: number | null,
>     resume_date?: number | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     contract_term?: {
>       id?: string | null,
>       status?: string | null,
>       contract_start?: number | null,
>       contract_end?: number | null,
>       billing_cycle?: number | null,
>       action_at_term_end?: string | null,
>       total_contract_value?: number | null,
>       total_contract_value_before_tax?: number | null,
>       cancellation_cutoff_period?: number | null,
>       created_at?: number | null,
>       subscription_id?: string | null,
>       remaining_billing_cycles?: number | null
>     } | null
>   } | null,
>   subscription_estimates?: {
>     id?: string | null,
>     currency_code?: string | null,
>     status?: string | null,
>     trial_end_action?: string | null,
>     next_billing_at?: number | null,
>     pause_date?: number | null,
>     resume_date?: number | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     contract_term?: {
>       id?: string | null,
>       status?: string | null,
>       contract_start?: number | null,
>       contract_end?: number | null,
>       billing_cycle?: number | null,
>       action_at_term_end?: string | null,
>       total_contract_value?: number | null,
>       total_contract_value_before_tax?: number | null,
>       cancellation_cutoff_period?: number | null,
>       created_at?: number | null,
>       subscription_id?: string | null,
>       remaining_billing_cycles?: number | null
>     } | null
>   }[] | null,
>   invoice_estimate?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   } | null,
>   invoice_estimates?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   }[] | null,
>   payment_schedule_estimates?: {
>     id?: string | null,
>     scheme_id?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     amount?: number | null,
>     currency_code?: string | null,
>     schedule_entries?: {
>       id?: string | null,
>       date?: number | null,
>       amount?: number | null,
>       scheduled_amount?: number | null,
>       status?: string | null
>     }[] | null
>   }[] | null,
>   next_invoice_estimate?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   } | null,
>   credit_note_estimates?: {
>     reference_invoice_id?: string | null,
>     type?: string | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     amount_allocated?: number | null,
>     amount_available?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   }[] | null,
>   unbilled_charge_estimates?: {
>     id?: string | null,
>     customer_id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     pricing_model?: string | null,
>     quantity?: number | null,
>     amount?: number | null,
>     currency_code?: string | null,
>     discount_amount?: number | null,
>     description?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     is_voided?: boolean | null,
>     voided_at?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     is_advance_charge?: boolean | null,
>     business_entity_id?: string | null,
>     deleted?: boolean | null
>   }[] | null
> } | null
> ```

***

### createSubscription

`estimates.createSubscription`

Create subscription estimate. Generates an estimate for the 'create subscription' operation. This is similar to the Create Subscription API but no subscription will be created, only an estimate for this operation is created. Product Catalog 1.0 sites only.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.estimates.createSubscription({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `billing_cycles` | `number` | No | Number of cycles(plan interval) this subscription should be charged. After the billing cycles exhausted, the subscription will be cancelled. |
| `mandatory_addons_to_remove` | `string[]` | No | List of addons IDs that are mandatory to the plan and has to be removed from the subscription. |
| `terms_to_charge` | `number` | No | 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` | `immediate \| delayed` | No | 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. \* 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` | `string[]` | No | List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes. |
| `invoice_immediately` | `boolean` | No | 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` | `number` | No | 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` | `string` | No | 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` | `object` | No | Parameters for subscription |
| `billing_address` | `object` | No | Parameters for billing\_address |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `customer` | `object` | No | Parameters for customer |
| `contract_term` | `object` | No | Parameters for contract\_term |
| `addons` | `object` | No | Parameters for addons |
| `event_based_addons` | `object` | No | Parameters for event\_based\_addons |
| `tax_providers_fields` | `object` | No | Parameters for tax\_providers\_fields |

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id?: string,
>   plan_id: string,
>   plan_quantity?: number,
>   plan_quantity_in_decimal?: string,
>   plan_unit_price?: number,
>   plan_unit_price_in_decimal?: string,
>   setup_fee?: number,
>   trial_end?: number,
>   start_date?: number,
>   offline_payment_method?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
>   free_period?: number,
>   free_period_unit?: day | week | month | year,
>   contract_term_billing_cycle_on_renewal?: number,
>   trial_end_action?: site_default | plan_default | activate_subscription | cancel_subscription
> }
> ```

> [accordion] billing\_address full type
>
> ```ts theme={null}
> {
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   vat_number?: string,
>   vat_number_prefix?: string,
>   registered_for_gst?: boolean,
>   taxability?: taxable | exempt | zero_rated,
>   entity_code?: a | b | c | d | e | f | g | h | i | j | k | l | m | n | p | q | r | med1 | med2,
>   exempt_number?: string,
>   exemption_details?: any[],
>   customer_type?: residential | business | senior_citizen | industrial
> }
> ```

> [accordion] contract\_term full type
>
> ```ts theme={null}
> {
>   action_at_term_end?: renew | evergreen | cancel,
>   cancellation_cutoff_period?: number
> }
> ```

> [accordion] addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   unit_price?: number[],
>   unit_price_in_decimal?: string[],
>   billing_cycles?: number[],
>   trial_end?: number[]
> }
> ```

> [accordion] event\_based\_addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   unit_price?: number[],
>   quantity_in_decimal?: string[],
>   unit_price_in_decimal?: string[],
>   service_period_in_days?: number[],
>   on_event?: (subscription_creation | subscription_trial_start | plan_activation | subscription_activation | contract_termination)[],
>   charge_once?: boolean[],
>   charge_on?: (immediately | on_event)[]
> }
> ```

> [accordion] tax\_providers\_fields full type
>
> ```ts theme={null}
> {
>   provider_name?: string[],
>   field_id?: string[],
>   field_value?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `estimate` | `object \| null` | No | During the process of signing up customers to subscriptions, use the Estimates API to evaluate the details of the purchase before actually signing them up. The details returned by the API include the invoice amounts, next billing date and unbilled charges. For example, consider that you are creating a new subscription or update an existing one. Use the Estimates API before that to deduce the details such as the amount the customer would be charged, the state the subscription would be in after creation or updation, and so on. If you have configured the [Avalara integration](https://www.chargebee.com/docs/1.0/avalara.html), Chargebee retrieves the tax amount from Avalara for the invoice. This counts against your Avalara API limits. |

> [accordion] estimate full type
>
> ```ts theme={null}
> {
>   created_at?: number | null,
>   subscription_estimate?: {
>     id?: string | null,
>     currency_code?: string | null,
>     status?: string | null,
>     trial_end_action?: string | null,
>     next_billing_at?: number | null,
>     pause_date?: number | null,
>     resume_date?: number | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     contract_term?: {
>       id?: string | null,
>       status?: string | null,
>       contract_start?: number | null,
>       contract_end?: number | null,
>       billing_cycle?: number | null,
>       action_at_term_end?: string | null,
>       total_contract_value?: number | null,
>       total_contract_value_before_tax?: number | null,
>       cancellation_cutoff_period?: number | null,
>       created_at?: number | null,
>       subscription_id?: string | null,
>       remaining_billing_cycles?: number | null
>     } | null
>   } | null,
>   subscription_estimates?: {
>     id?: string | null,
>     currency_code?: string | null,
>     status?: string | null,
>     trial_end_action?: string | null,
>     next_billing_at?: number | null,
>     pause_date?: number | null,
>     resume_date?: number | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     contract_term?: {
>       id?: string | null,
>       status?: string | null,
>       contract_start?: number | null,
>       contract_end?: number | null,
>       billing_cycle?: number | null,
>       action_at_term_end?: string | null,
>       total_contract_value?: number | null,
>       total_contract_value_before_tax?: number | null,
>       cancellation_cutoff_period?: number | null,
>       created_at?: number | null,
>       subscription_id?: string | null,
>       remaining_billing_cycles?: number | null
>     } | null
>   }[] | null,
>   invoice_estimate?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   } | null,
>   invoice_estimates?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   }[] | null,
>   payment_schedule_estimates?: {
>     id?: string | null,
>     scheme_id?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     amount?: number | null,
>     currency_code?: string | null,
>     schedule_entries?: {
>       id?: string | null,
>       date?: number | null,
>       amount?: number | null,
>       scheduled_amount?: number | null,
>       status?: string | null
>     }[] | null
>   }[] | null,
>   next_invoice_estimate?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   } | null,
>   credit_note_estimates?: {
>     reference_invoice_id?: string | null,
>     type?: string | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     amount_allocated?: number | null,
>     amount_available?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   }[] | null,
>   unbilled_charge_estimates?: {
>     id?: string | null,
>     customer_id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     pricing_model?: string | null,
>     quantity?: number | null,
>     amount?: number | null,
>     currency_code?: string | null,
>     discount_amount?: number | null,
>     description?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     is_voided?: boolean | null,
>     voided_at?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     is_advance_charge?: boolean | null,
>     business_entity_id?: string | null,
>     deleted?: boolean | null
>   }[] | null
> } | null
> ```

***

### createSubscriptionForItems

`estimates.createSubscriptionForItems`

Estimate for creating a customer and subscription. 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.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.estimates.createSubscriptionForItems({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `billing_cycles` | `number` | No | The number of billing cycles the subscription runs before canceling. If not provided, then the billing cycles [set for the plan-item price](https://docs.corsair.dev/docs/api/item_prices/item_price-object#billing_cycles) is used. |
| `mandatory_items_to_remove` | `string[]` | No | Item ids of [mandatorily attached addons](https://docs.corsair.dev/docs/api/attached_items) that are to be removed from the subscription. |
| `terms_to_charge` | `number` | No | 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` | `immediate \| delayed` | No | 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. \* 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` | `string[]` | No | List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes. |
| `invoice_immediately` | `boolean` | No | 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` | `number` | No | 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` | `string` | No | 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` | `object` | No | Parameters for subscription |
| `billing_address` | `object` | No | Parameters for billing\_address |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `customer` | `object` | No | Parameters for customer |
| `contract_term` | `object` | No | Parameters for contract\_term |
| `subscription_items` | `object` | No | Parameters for subscription\_items |
| `discounts` | `object` | No | Parameters for discounts |
| `item_tiers` | `object` | No | Parameters for item\_tiers |
| `tax_providers_fields` | `object` | No | Parameters for tax\_providers\_fields |

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id?: string,
>   trial_end?: number,
>   start_date?: number,
>   offline_payment_method?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
>   free_period?: number,
>   free_period_unit?: day | week | month | year,
>   contract_term_billing_cycle_on_renewal?: number,
>   trial_end_action?: site_default | plan_default | activate_subscription | cancel_subscription
> }
> ```

> [accordion] billing\_address full type
>
> ```ts theme={null}
> {
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   vat_number?: string,
>   vat_number_prefix?: string,
>   registered_for_gst?: boolean,
>   taxability?: taxable | exempt | zero_rated,
>   entity_code?: a | b | c | d | e | f | g | h | i | j | k | l | m | n | p | q | r | med1 | med2,
>   exempt_number?: string,
>   exemption_details?: any[],
>   customer_type?: residential | business | senior_citizen | industrial
> }
> ```

> [accordion] contract\_term full type
>
> ```ts theme={null}
> {
>   action_at_term_end?: renew | evergreen | cancel,
>   cancellation_cutoff_period?: number
> }
> ```

> [accordion] subscription\_items full type
>
> ```ts theme={null}
> {
>   item_price_id: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   unit_price?: number[],
>   unit_price_in_decimal?: string[],
>   billing_cycles?: number[],
>   trial_end?: number[],
>   service_period_days?: number[],
>   charge_on_event?: (subscription_creation | subscription_trial_start | plan_activation | subscription_activation | contract_termination)[],
>   charge_once?: boolean[],
>   description?: string[],
>   charge_on_option?: (immediately | on_event)[]
> }
> ```

> [accordion] discounts full type
>
> ```ts theme={null}
> {
>   apply_on?: (invoice_amount | specific_item_price)[],
>   duration_type: (one_time | forever | limited_period)[],
>   percentage?: number[],
>   amount?: number[],
>   period?: number[],
>   period_unit?: (day | week | month | year)[],
>   included_in_mrr?: boolean[],
>   item_price_id?: string[],
>   quantity?: number[],
>   description?: string[]
> }
> ```

> [accordion] item\_tiers full type
>
> ```ts theme={null}
> {
>   item_price_id?: string[],
>   starting_unit?: number[],
>   ending_unit?: number[],
>   price?: number[],
>   starting_unit_in_decimal?: string[],
>   ending_unit_in_decimal?: string[],
>   price_in_decimal?: string[],
>   pricing_type?: (per_unit | flat_fee | package)[],
>   package_size?: number[]
> }
> ```

> [accordion] tax\_providers\_fields full type
>
> ```ts theme={null}
> {
>   provider_name?: string[],
>   field_id?: string[],
>   field_value?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `estimate` | `object \| null` | No | During the process of signing up customers to subscriptions, use the Estimates API to evaluate the details of the purchase before actually signing them up. The details returned by the API include the invoice amounts, next billing date and unbilled charges. For example, consider that you are creating a new subscription or update an existing one. Use the Estimates API before that to deduce the details such as the amount the customer would be charged, the state the subscription would be in after creation or updation, and so on. If you have configured the [Avalara integration](https://www.chargebee.com/docs/2.0/avalara.html), Chargebee retrieves the tax amount from Avalara for the invoice. This counts against your Avalara API limits. |

> [accordion] estimate full type
>
> ```ts theme={null}
> {
>   created_at?: number | null,
>   subscription_estimate?: {
>     id?: string | null,
>     currency_code?: string | null,
>     status?: string | null,
>     trial_end_action?: string | null,
>     next_billing_at?: number | null,
>     pause_date?: number | null,
>     resume_date?: number | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     contract_term?: {
>       id?: string | null,
>       status?: string | null,
>       contract_start?: number | null,
>       contract_end?: number | null,
>       billing_cycle?: number | null,
>       action_at_term_end?: string | null,
>       total_contract_value?: number | null,
>       total_contract_value_before_tax?: number | null,
>       cancellation_cutoff_period?: number | null,
>       created_at?: number | null,
>       subscription_id?: string | null,
>       remaining_billing_cycles?: number | null
>     } | null
>   } | null,
>   subscription_estimates?: {
>     id?: string | null,
>     currency_code?: string | null,
>     status?: string | null,
>     trial_end_action?: string | null,
>     next_billing_at?: number | null,
>     pause_date?: number | null,
>     resume_date?: number | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     contract_term?: {
>       id?: string | null,
>       status?: string | null,
>       contract_start?: number | null,
>       contract_end?: number | null,
>       billing_cycle?: number | null,
>       action_at_term_end?: string | null,
>       total_contract_value?: number | null,
>       total_contract_value_before_tax?: number | null,
>       cancellation_cutoff_period?: number | null,
>       created_at?: number | null,
>       subscription_id?: string | null,
>       remaining_billing_cycles?: number | null
>     } | null
>   }[] | null,
>   invoice_estimate?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   } | null,
>   invoice_estimates?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   }[] | null,
>   payment_schedule_estimates?: {
>     id?: string | null,
>     scheme_id?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     amount?: number | null,
>     currency_code?: string | null,
>     schedule_entries?: {
>       id?: string | null,
>       date?: number | null,
>       amount?: number | null,
>       scheduled_amount?: number | null,
>       status?: string | null
>     }[] | null
>   }[] | null,
>   next_invoice_estimate?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   } | null,
>   credit_note_estimates?: {
>     reference_invoice_id?: string | null,
>     type?: string | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     amount_allocated?: number | null,
>     amount_available?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   }[] | null,
>   unbilled_charge_estimates?: {
>     id?: string | null,
>     customer_id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     pricing_model?: string | null,
>     quantity?: number | null,
>     amount?: number | null,
>     currency_code?: string | null,
>     discount_amount?: number | null,
>     description?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     is_voided?: boolean | null,
>     voided_at?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     is_advance_charge?: boolean | null,
>     business_entity_id?: string | null,
>     deleted?: boolean | null
>   }[] | null
> } | null
> ```

***

### giftSubscription

`estimates.giftSubscription`

Gift subscription estimate. Generates an estimate for the 'create a gift' operation. This is similar to the Create a gift API, but the gift subscription will not be created. Only an estimate for this operation is created. In the response, \* estimate.subscription\_estimate has the gift subscription details. Product Catalog 1.0 sites only.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.estimates.giftSubscription({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `coupon_ids` | `string[]` | No | List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes. |
| `gift` | `object` | No | Parameters for gift |
| `gifter` | `object` | No | Parameters for gifter |
| `gift_receiver` | `object` | No | Parameters for gift\_receiver |
| `payment_intent` | `object` | No | Parameters for payment\_intent |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `subscription` | `object` | No | Parameters for subscription |
| `addons` | `object` | No | Parameters for addons |

> [accordion] gift full type
>
> ```ts theme={null}
> {
>   scheduled_at?: number,
>   auto_claim?: boolean,
>   no_expiry?: boolean,
>   claim_expiry_date?: number
> }
> ```

> [accordion] gifter full type
>
> ```ts theme={null}
> {
>   customer_id: string,
>   signature: string,
>   note?: string,
>   payment_src_id?: string
> }
> ```

> [accordion] gift\_receiver full type
>
> ```ts theme={null}
> {
>   customer_id: string,
>   first_name: string,
>   last_name: string,
>   email: string
> }
> ```

> [accordion] payment\_intent full type
>
> ```ts theme={null}
> {
>   id?: string,
>   gateway_account_id?: string,
>   gw_token?: string,
>   payment_method_type?: card | ideal | sofort | bancontact | google_pay | dotpay | giropay | apple_pay | upi | netbanking_emandates | paypal_express_checkout | direct_debit | boleto | venmo | amazon_payments | pay_to | faster_payments | sepa_instant_transfer | klarna_pay_now | online_banking_poland | payconiq_by_bancontact | electronic_payment_standard | kbc_payment_button | pay_by_bank | trustly | stablecoin | kakao_pay | naver_pay | revolut_pay | cash_app_pay | wechat_pay | alipay | twint | go_pay | grab_pay | pay_co | after_pay | swish | payme | pix | klarna | alipay_hk | paypay | gcash | south_korean_cards | paynow | bizum | promptpay | dana | touch_n_go | tamara | qpay | ovo | momo | mercado_pago | nequi | nupay | picpay | thai_qr | blik | fpx | wero | p24 | affirm_pay | rakuten_pay,
>   reference_id?: string,
>   additional_information?: {
>   }
> }
> ```

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   plan_id: string,
>   plan_quantity?: number,
>   plan_quantity_in_decimal?: string
> }
> ```

> [accordion] addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `estimate` | `object \| null` | No | During the process of signing up customers to subscriptions, use the Estimates API to evaluate the details of the purchase before actually signing them up. The details returned by the API include the invoice amounts, next billing date and unbilled charges. For example, consider that you are creating a new subscription or update an existing one. Use the Estimates API before that to deduce the details such as the amount the customer would be charged, the state the subscription would be in after creation or updation, and so on. If you have configured the [Avalara integration](https://www.chargebee.com/docs/1.0/avalara.html), Chargebee retrieves the tax amount from Avalara for the invoice. This counts against your Avalara API limits. |

> [accordion] estimate full type
>
> ```ts theme={null}
> {
>   created_at?: number | null,
>   subscription_estimate?: {
>     id?: string | null,
>     currency_code?: string | null,
>     status?: string | null,
>     trial_end_action?: string | null,
>     next_billing_at?: number | null,
>     pause_date?: number | null,
>     resume_date?: number | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     contract_term?: {
>       id?: string | null,
>       status?: string | null,
>       contract_start?: number | null,
>       contract_end?: number | null,
>       billing_cycle?: number | null,
>       action_at_term_end?: string | null,
>       total_contract_value?: number | null,
>       total_contract_value_before_tax?: number | null,
>       cancellation_cutoff_period?: number | null,
>       created_at?: number | null,
>       subscription_id?: string | null,
>       remaining_billing_cycles?: number | null
>     } | null
>   } | null,
>   subscription_estimates?: {
>     id?: string | null,
>     currency_code?: string | null,
>     status?: string | null,
>     trial_end_action?: string | null,
>     next_billing_at?: number | null,
>     pause_date?: number | null,
>     resume_date?: number | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     contract_term?: {
>       id?: string | null,
>       status?: string | null,
>       contract_start?: number | null,
>       contract_end?: number | null,
>       billing_cycle?: number | null,
>       action_at_term_end?: string | null,
>       total_contract_value?: number | null,
>       total_contract_value_before_tax?: number | null,
>       cancellation_cutoff_period?: number | null,
>       created_at?: number | null,
>       subscription_id?: string | null,
>       remaining_billing_cycles?: number | null
>     } | null
>   }[] | null,
>   invoice_estimate?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   } | null,
>   invoice_estimates?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   }[] | null,
>   payment_schedule_estimates?: {
>     id?: string | null,
>     scheme_id?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     amount?: number | null,
>     currency_code?: string | null,
>     schedule_entries?: {
>       id?: string | null,
>       date?: number | null,
>       amount?: number | null,
>       scheduled_amount?: number | null,
>       status?: string | null
>     }[] | null
>   }[] | null,
>   next_invoice_estimate?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   } | null,
>   credit_note_estimates?: {
>     reference_invoice_id?: string | null,
>     type?: string | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     amount_allocated?: number | null,
>     amount_available?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   }[] | null,
>   unbilled_charge_estimates?: {
>     id?: string | null,
>     customer_id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     pricing_model?: string | null,
>     quantity?: number | null,
>     amount?: number | null,
>     currency_code?: string | null,
>     discount_amount?: number | null,
>     description?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     is_voided?: boolean | null,
>     voided_at?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     is_advance_charge?: boolean | null,
>     business_entity_id?: string | null,
>     deleted?: boolean | null
>   }[] | null
> } | null
> ```

***

### giftSubscriptionForItems

`estimates.giftSubscriptionForItems`

Gift subscription estimate for items. This endpoint generates an estimate for a subscription that is intended to be a gift. The estimate provides details about the gift sender, gift recipient, address details of the recipient, and the type and details of subscription items included in the gift.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.estimates.giftSubscriptionForItems({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `coupon_ids` | `string[]` | No | List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes. |
| `gift` | `object` | No | Parameters for gift |
| `gifter` | `object` | No | Parameters for gifter |
| `gift_receiver` | `object` | No | Parameters for gift\_receiver |
| `payment_intent` | `object` | No | Parameters for payment\_intent |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `subscription_items` | `object` | No | Parameters for subscription\_items |
| `item_tiers` | `object` | No | Parameters for item\_tiers |

> [accordion] gift full type
>
> ```ts theme={null}
> {
>   scheduled_at?: number,
>   auto_claim?: boolean,
>   no_expiry?: boolean,
>   claim_expiry_date?: number
> }
> ```

> [accordion] gifter full type
>
> ```ts theme={null}
> {
>   customer_id: string,
>   signature: string,
>   note?: string,
>   payment_src_id?: string
> }
> ```

> [accordion] gift\_receiver full type
>
> ```ts theme={null}
> {
>   customer_id: string,
>   first_name: string,
>   last_name: string,
>   email: string
> }
> ```

> [accordion] payment\_intent full type
>
> ```ts theme={null}
> {
>   id?: string,
>   gateway_account_id?: string,
>   gw_token?: string,
>   payment_method_type?: card | ideal | sofort | bancontact | google_pay | dotpay | giropay | apple_pay | upi | netbanking_emandates | paypal_express_checkout | direct_debit | boleto | venmo | amazon_payments | pay_to | faster_payments | sepa_instant_transfer | klarna_pay_now | online_banking_poland | payconiq_by_bancontact | electronic_payment_standard | kbc_payment_button | pay_by_bank | trustly | stablecoin | kakao_pay | naver_pay | revolut_pay | cash_app_pay | wechat_pay | alipay | twint | go_pay | grab_pay | pay_co | after_pay | swish | payme | pix | klarna | alipay_hk | paypay | gcash | south_korean_cards | paynow | bizum | promptpay | dana | touch_n_go | tamara | qpay | ovo | momo | mercado_pago | nequi | nupay | picpay | thai_qr | blik | fpx | wero | p24 | affirm_pay | rakuten_pay,
>   reference_id?: string,
>   additional_information?: {
>   }
> }
> ```

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] subscription\_items full type
>
> ```ts theme={null}
> {
>   item_price_id?: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   unit_price?: number[],
>   unit_price_in_decimal?: string[]
> }
> ```

> [accordion] item\_tiers full type
>
> ```ts theme={null}
> {
>   item_price_id?: string[],
>   starting_unit?: number[],
>   ending_unit?: number[],
>   price?: number[],
>   starting_unit_in_decimal?: string[],
>   ending_unit_in_decimal?: string[],
>   price_in_decimal?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `estimate` | `object \| null` | No | During the process of signing up customers to subscriptions, use the Estimates API to evaluate the details of the purchase before actually signing them up. The details returned by the API include the invoice amounts, next billing date and unbilled charges. For example, consider that you are creating a new subscription or update an existing one. Use the Estimates API before that to deduce the details such as the amount the customer would be charged, the state the subscription would be in after creation or updation, and so on. If you have configured the [Avalara integration](https://www.chargebee.com/docs/2.0/avalara.html), Chargebee retrieves the tax amount from Avalara for the invoice. This counts against your Avalara API limits. |

> [accordion] estimate full type
>
> ```ts theme={null}
> {
>   created_at?: number | null,
>   subscription_estimate?: {
>     id?: string | null,
>     currency_code?: string | null,
>     status?: string | null,
>     trial_end_action?: string | null,
>     next_billing_at?: number | null,
>     pause_date?: number | null,
>     resume_date?: number | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     contract_term?: {
>       id?: string | null,
>       status?: string | null,
>       contract_start?: number | null,
>       contract_end?: number | null,
>       billing_cycle?: number | null,
>       action_at_term_end?: string | null,
>       total_contract_value?: number | null,
>       total_contract_value_before_tax?: number | null,
>       cancellation_cutoff_period?: number | null,
>       created_at?: number | null,
>       subscription_id?: string | null,
>       remaining_billing_cycles?: number | null
>     } | null
>   } | null,
>   subscription_estimates?: {
>     id?: string | null,
>     currency_code?: string | null,
>     status?: string | null,
>     trial_end_action?: string | null,
>     next_billing_at?: number | null,
>     pause_date?: number | null,
>     resume_date?: number | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     contract_term?: {
>       id?: string | null,
>       status?: string | null,
>       contract_start?: number | null,
>       contract_end?: number | null,
>       billing_cycle?: number | null,
>       action_at_term_end?: string | null,
>       total_contract_value?: number | null,
>       total_contract_value_before_tax?: number | null,
>       cancellation_cutoff_period?: number | null,
>       created_at?: number | null,
>       subscription_id?: string | null,
>       remaining_billing_cycles?: number | null
>     } | null
>   }[] | null,
>   invoice_estimate?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   } | null,
>   invoice_estimates?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   }[] | null,
>   payment_schedule_estimates?: {
>     id?: string | null,
>     scheme_id?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     amount?: number | null,
>     currency_code?: string | null,
>     schedule_entries?: {
>       id?: string | null,
>       date?: number | null,
>       amount?: number | null,
>       scheduled_amount?: number | null,
>       status?: string | null
>     }[] | null
>   }[] | null,
>   next_invoice_estimate?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   } | null,
>   credit_note_estimates?: {
>     reference_invoice_id?: string | null,
>     type?: string | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     amount_allocated?: number | null,
>     amount_available?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   }[] | null,
>   unbilled_charge_estimates?: {
>     id?: string | null,
>     customer_id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     pricing_model?: string | null,
>     quantity?: number | null,
>     amount?: number | null,
>     currency_code?: string | null,
>     discount_amount?: number | null,
>     description?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     is_voided?: boolean | null,
>     voided_at?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     is_advance_charge?: boolean | null,
>     business_entity_id?: string | null,
>     deleted?: boolean | null
>   }[] | null
> } | null
> ```

***

### paymentSchedules

`estimates.paymentSchedules`

Create a payment schedule estimate. Generates an estimate without creating a payment schedule. This endpoint can be called when you want to preview details of a new payment schedule before actually creating one.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.estimates.paymentSchedules({ scheme_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `scheme_id` | `string` | Yes | The unique identifier for the `payment_schedule_scheme`. This identifier is used to retrieve the payment schedule scheme, which is then applied to calculate the amount and date for the specified number of payment schedules. |
| `amount` | `number` | No | Defines the payment schedule amount set for an invoice. If this is not provided, the total `invoice.amount_due` is used. This value is mandatory in case `invoice_id` is not provided. |
| `invoice_id` | `string` | No | Unique identifier of the invoice. |
| `payment_schedule_start_date` | `number` | No | The date from which the payment schedule will start. This is applicable only when invoice\_id is not provided. If `invoice_id` is provided, we will consider `invoice.due_date` . |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `estimate` | `object \| null` | No | During the process of signing up customers to subscriptions, use the Estimates API to evaluate the details of the purchase before actually signing them up. The details returned by the API include the invoice amounts, next billing date and unbilled charges. For example, consider that you are creating a new subscription or update an existing one. Use the Estimates API before that to deduce the details such as the amount the customer would be charged, the state the subscription would be in after creation or updation, and so on. If you have configured the [Avalara integration](https://www.chargebee.com/docs/2.0/avalara.html), Chargebee retrieves the tax amount from Avalara for the invoice. This counts against your Avalara API limits. |

> [accordion] estimate full type
>
> ```ts theme={null}
> {
>   created_at?: number | null,
>   subscription_estimate?: {
>     id?: string | null,
>     currency_code?: string | null,
>     status?: string | null,
>     trial_end_action?: string | null,
>     next_billing_at?: number | null,
>     pause_date?: number | null,
>     resume_date?: number | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     contract_term?: {
>       id?: string | null,
>       status?: string | null,
>       contract_start?: number | null,
>       contract_end?: number | null,
>       billing_cycle?: number | null,
>       action_at_term_end?: string | null,
>       total_contract_value?: number | null,
>       total_contract_value_before_tax?: number | null,
>       cancellation_cutoff_period?: number | null,
>       created_at?: number | null,
>       subscription_id?: string | null,
>       remaining_billing_cycles?: number | null
>     } | null
>   } | null,
>   subscription_estimates?: {
>     id?: string | null,
>     currency_code?: string | null,
>     status?: string | null,
>     trial_end_action?: string | null,
>     next_billing_at?: number | null,
>     pause_date?: number | null,
>     resume_date?: number | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     contract_term?: {
>       id?: string | null,
>       status?: string | null,
>       contract_start?: number | null,
>       contract_end?: number | null,
>       billing_cycle?: number | null,
>       action_at_term_end?: string | null,
>       total_contract_value?: number | null,
>       total_contract_value_before_tax?: number | null,
>       cancellation_cutoff_period?: number | null,
>       created_at?: number | null,
>       subscription_id?: string | null,
>       remaining_billing_cycles?: number | null
>     } | null
>   }[] | null,
>   invoice_estimate?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   } | null,
>   invoice_estimates?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   }[] | null,
>   payment_schedule_estimates?: {
>     id?: string | null,
>     scheme_id?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     amount?: number | null,
>     currency_code?: string | null,
>     schedule_entries?: {
>       id?: string | null,
>       date?: number | null,
>       amount?: number | null,
>       scheduled_amount?: number | null,
>       status?: string | null
>     }[] | null
>   }[] | null,
>   next_invoice_estimate?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   } | null,
>   credit_note_estimates?: {
>     reference_invoice_id?: string | null,
>     type?: string | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     amount_allocated?: number | null,
>     amount_available?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   }[] | null,
>   unbilled_charge_estimates?: {
>     id?: string | null,
>     customer_id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     pricing_model?: string | null,
>     quantity?: number | null,
>     amount?: number | null,
>     currency_code?: string | null,
>     discount_amount?: number | null,
>     description?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     is_voided?: boolean | null,
>     voided_at?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     is_advance_charge?: boolean | null,
>     business_entity_id?: string | null,
>     deleted?: boolean | null
>   }[] | null
> } | null
> ```

***

### updateSubscription

`estimates.updateSubscription`

Update subscription estimate. Generates an estimate for the 'update subscription' operation. The input will be similar to the Update Subscription API but subscription will not be updated, only an estimate will be created. Product Catalog 1.0 sites only.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.estimates.updateSubscription({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `changes_scheduled_at` | `number` | No | 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` | `immediately \| end_of_term \| specific_date` | No | When the quote is converted, this attribute determines the date/time as of when the subscription change is to be carried out. \* 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` . \* immediately - The change is carried out immediately. |
| `replace_addon_list` | `boolean` | No | Should be true if the existing addons should be replaced with the ones that are being passed. |
| `mandatory_addons_to_remove` | `string[]` | No | List of addons IDs that are mandatory to the plan and has to be removed from the subscription. |
| `invoice_date` | `number` | No | 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` | `number` | No | 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` | `number` | No | 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` | `number` | No | 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` | `immediate \| delayed` | No | 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. \* 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` | `string[]` | No | List of coupons to be applied to this subscription. You can provide coupon ids or [coupon codes](https://docs.corsair.dev/docs/api/coupon_codes) . |
| `replace_coupon_list` | `boolean` | No | 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` | `boolean` | No | \* 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` | `boolean` | No | Set this to true if you want the update to be applied at the end of the current subscription billing cycle. |
| `force_term_reset` | `boolean` | No | 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` | `boolean` | No | 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` | `boolean` | No | If true, all the unbilled charges will be included for the invoice estimate. |
| `use_existing_balances` | `boolean` | No | 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` | `boolean` | No | 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` | `object` | No | Parameters for subscription |
| `billing_address` | `object` | No | Parameters for billing\_address |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `customer` | `object` | No | Parameters for customer |
| `addons` | `object` | No | Parameters for addons |
| `event_based_addons` | `object` | No | Parameters for event\_based\_addons |

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id: string,
>   plan_id?: string,
>   plan_quantity?: number,
>   plan_unit_price?: number,
>   setup_fee?: number,
>   plan_quantity_in_decimal?: string,
>   plan_unit_price_in_decimal?: string,
>   start_date?: number,
>   trial_end?: number,
>   auto_collection?: on | off,
>   offline_payment_method?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
>   free_period?: number,
>   free_period_unit?: day | week | month | year,
>   trial_end_action?: site_default | plan_default | activate_subscription | cancel_subscription
> }
> ```

> [accordion] billing\_address full type
>
> ```ts theme={null}
> {
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   vat_number?: string,
>   vat_number_prefix?: string,
>   registered_for_gst?: boolean
> }
> ```

> [accordion] addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   unit_price?: number[],
>   billing_cycles?: number[],
>   quantity_in_decimal?: string[],
>   unit_price_in_decimal?: string[],
>   trial_end?: number[],
>   proration_type?: (full_term | partial_term | none)[]
> }
> ```

> [accordion] event\_based\_addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   unit_price?: number[],
>   service_period_in_days?: number[],
>   charge_on?: (immediately | on_event)[],
>   on_event?: (subscription_creation | subscription_trial_start | plan_activation | subscription_activation | contract_termination)[],
>   charge_once?: boolean[],
>   quantity_in_decimal?: string[],
>   unit_price_in_decimal?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `estimate` | `object \| null` | No | During the process of signing up customers to subscriptions, use the Estimates API to evaluate the details of the purchase before actually signing them up. The details returned by the API include the invoice amounts, next billing date and unbilled charges. For example, consider that you are creating a new subscription or update an existing one. Use the Estimates API before that to deduce the details such as the amount the customer would be charged, the state the subscription would be in after creation or updation, and so on. If you have configured the [Avalara integration](https://www.chargebee.com/docs/1.0/avalara.html), Chargebee retrieves the tax amount from Avalara for the invoice. This counts against your Avalara API limits. |

> [accordion] estimate full type
>
> ```ts theme={null}
> {
>   created_at?: number | null,
>   subscription_estimate?: {
>     id?: string | null,
>     currency_code?: string | null,
>     status?: string | null,
>     trial_end_action?: string | null,
>     next_billing_at?: number | null,
>     pause_date?: number | null,
>     resume_date?: number | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     contract_term?: {
>       id?: string | null,
>       status?: string | null,
>       contract_start?: number | null,
>       contract_end?: number | null,
>       billing_cycle?: number | null,
>       action_at_term_end?: string | null,
>       total_contract_value?: number | null,
>       total_contract_value_before_tax?: number | null,
>       cancellation_cutoff_period?: number | null,
>       created_at?: number | null,
>       subscription_id?: string | null,
>       remaining_billing_cycles?: number | null
>     } | null
>   } | null,
>   subscription_estimates?: {
>     id?: string | null,
>     currency_code?: string | null,
>     status?: string | null,
>     trial_end_action?: string | null,
>     next_billing_at?: number | null,
>     pause_date?: number | null,
>     resume_date?: number | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     contract_term?: {
>       id?: string | null,
>       status?: string | null,
>       contract_start?: number | null,
>       contract_end?: number | null,
>       billing_cycle?: number | null,
>       action_at_term_end?: string | null,
>       total_contract_value?: number | null,
>       total_contract_value_before_tax?: number | null,
>       cancellation_cutoff_period?: number | null,
>       created_at?: number | null,
>       subscription_id?: string | null,
>       remaining_billing_cycles?: number | null
>     } | null
>   }[] | null,
>   invoice_estimate?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   } | null,
>   invoice_estimates?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   }[] | null,
>   payment_schedule_estimates?: {
>     id?: string | null,
>     scheme_id?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     amount?: number | null,
>     currency_code?: string | null,
>     schedule_entries?: {
>       id?: string | null,
>       date?: number | null,
>       amount?: number | null,
>       scheduled_amount?: number | null,
>       status?: string | null
>     }[] | null
>   }[] | null,
>   next_invoice_estimate?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   } | null,
>   credit_note_estimates?: {
>     reference_invoice_id?: string | null,
>     type?: string | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     amount_allocated?: number | null,
>     amount_available?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   }[] | null,
>   unbilled_charge_estimates?: {
>     id?: string | null,
>     customer_id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     pricing_model?: string | null,
>     quantity?: number | null,
>     amount?: number | null,
>     currency_code?: string | null,
>     discount_amount?: number | null,
>     description?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     is_voided?: boolean | null,
>     voided_at?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     is_advance_charge?: boolean | null,
>     business_entity_id?: string | null,
>     deleted?: boolean | null
>   }[] | null
> } | null
> ```

***

### updateSubscriptionForItems

`estimates.updateSubscriptionForItems`

Estimate for updating a subscription. Returns an estimate for updating a subscription. In the response, \* subscription\_estimate: The details of the changed subscription such as status, next billing date, and so on. \* invoice\_estimate:The details of the immediate invoice, if it is generated.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.estimates.updateSubscriptionForItems({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `changes_scheduled_at` | `number` | No | When `change_option` is set to `specific_date`, then set the date/time at which the subscription change is to happen or has happened. **Constraints** \* Do not pass this parameter along with `reactivate_from`. \* The `changes_scheduled_at` parameter does not apply to `auto_collection`, `shipping_address`, and `po_number`; these parameters take effect **immediately** when scheduling a subscription update. **Backdated changes** `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` | `immediately \| end_of_term \| specific_date` | No | Specifies the effective date for the subscription change. \* end\_of\_term - The change is carried out at the end of the current billing cycle of the subscription. \* specific\_date - Executes the change on a specified date. The change occurs as of the date/time defined in `changes_scheduled_at`. \* immediately - The change is carried out immediately. |
| `mandatory_items_to_remove` | `string[]` | No | Item ids of [mandatorily attached addons](https://docs.corsair.dev/docs/api/attached_items) that are to be removed from the subscription. |
| `replace_items_list` | `boolean` | No | If `true` then the existing `subscription_items` list for the subscription is replaced by the one provided. If `false` then the provided `subscription_items` list gets added to the existing list. |
| `invoice_date` | `number` | No | 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` | `number` | No | Billing cycles set for plan-item price is used by default. |
| `terms_to_charge` | `number` | No | 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` | `number` | No | 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` | `immediate \| delayed` | No | 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. \* 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` | `string[]` | No | List of coupons to be applied to this subscription. You can provide coupon ids or [coupon codes](https://docs.corsair.dev/docs/api/coupon_codes) . |
| `replace_coupon_list` | `boolean` | No | 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` | `boolean` | No | \* When `true`: [Prorated credits or charges](https://www.chargebee.com/docs/2.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/2.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 items or their prices. |
| `end_of_term` | `boolean` | No | **Deprecated** \* Use `change_option` instead. \* If you pass this parameter along with `change_option`, then `change_option` wins. Set this to true if you want the update to be applied at the end of the current subscription billing cycle. |
| `force_term_reset` | `boolean` | No | 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` | `boolean` | No | 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` | `boolean` | No | If true, all the unbilled charges will be included for the invoice estimate. |
| `use_existing_balances` | `boolean` | No | 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` | `boolean` | No | 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_usages` | `boolean` | No | Setting this attribute to `true` will invoice the overages for the metered item during subscription changes . |
| `subscription` | `object` | No | Parameters for subscription |
| `billing_address` | `object` | No | Parameters for billing\_address |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `customer` | `object` | No | Parameters for customer |
| `billing_override` | `object` | No | Parameters for billing\_override |
| `subscription_items` | `object` | No | Parameters for subscription\_items |
| `discounts` | `object` | No | Parameters for discounts |
| `item_tiers` | `object` | No | Parameters for item\_tiers |

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id: string,
>   start_date?: number,
>   trial_end?: number,
>   auto_collection?: on | off,
>   offline_payment_method?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
>   free_period?: number,
>   free_period_unit?: day | week | month | year,
>   trial_end_action?: site_default | plan_default | activate_subscription | cancel_subscription
> }
> ```

> [accordion] billing\_address full type
>
> ```ts theme={null}
> {
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   vat_number?: string,
>   vat_number_prefix?: string,
>   registered_for_gst?: boolean
> }
> ```

> [accordion] billing\_override full type
>
> ```ts theme={null}
> {
>   max_excess_payment_usage?: number,
>   max_refundable_credits_usage?: number
> }
> ```

> [accordion] subscription\_items full type
>
> ```ts theme={null}
> {
>   item_price_id: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   unit_price?: number[],
>   unit_price_in_decimal?: string[],
>   billing_cycles?: number[],
>   trial_end?: number[],
>   service_period_days?: number[],
>   charge_on_event?: (subscription_creation | subscription_trial_start | plan_activation | subscription_activation | contract_termination)[],
>   charge_once?: boolean[],
>   charge_on_option?: (immediately | on_event)[],
>   description?: string[],
>   proration_type?: (full_term | partial_term | none)[]
> }
> ```

> [accordion] discounts full type
>
> ```ts theme={null}
> {
>   apply_on?: (invoice_amount | specific_item_price)[],
>   duration_type: (one_time | forever | limited_period)[],
>   percentage?: number[],
>   amount?: number[],
>   period?: number[],
>   period_unit?: (day | week | month | year)[],
>   included_in_mrr?: boolean[],
>   item_price_id?: string[],
>   quantity?: number[],
>   operation_type: (add | remove)[],
>   id?: string[],
>   description?: string[]
> }
> ```

> [accordion] item\_tiers full type
>
> ```ts theme={null}
> {
>   item_price_id?: string[],
>   starting_unit?: number[],
>   ending_unit?: number[],
>   price?: number[],
>   starting_unit_in_decimal?: string[],
>   ending_unit_in_decimal?: string[],
>   price_in_decimal?: string[],
>   pricing_type?: (per_unit | flat_fee | package)[],
>   package_size?: number[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `estimate` | `object \| null` | No | During the process of signing up customers to subscriptions, use the Estimates API to evaluate the details of the purchase before actually signing them up. The details returned by the API include the invoice amounts, next billing date and unbilled charges. For example, consider that you are creating a new subscription or update an existing one. Use the Estimates API before that to deduce the details such as the amount the customer would be charged, the state the subscription would be in after creation or updation, and so on. If you have configured the [Avalara integration](https://www.chargebee.com/docs/2.0/avalara.html), Chargebee retrieves the tax amount from Avalara for the invoice. This counts against your Avalara API limits. |

> [accordion] estimate full type
>
> ```ts theme={null}
> {
>   created_at?: number | null,
>   subscription_estimate?: {
>     id?: string | null,
>     currency_code?: string | null,
>     status?: string | null,
>     trial_end_action?: string | null,
>     next_billing_at?: number | null,
>     pause_date?: number | null,
>     resume_date?: number | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     contract_term?: {
>       id?: string | null,
>       status?: string | null,
>       contract_start?: number | null,
>       contract_end?: number | null,
>       billing_cycle?: number | null,
>       action_at_term_end?: string | null,
>       total_contract_value?: number | null,
>       total_contract_value_before_tax?: number | null,
>       cancellation_cutoff_period?: number | null,
>       created_at?: number | null,
>       subscription_id?: string | null,
>       remaining_billing_cycles?: number | null
>     } | null
>   } | null,
>   subscription_estimates?: {
>     id?: string | null,
>     currency_code?: string | null,
>     status?: string | null,
>     trial_end_action?: string | null,
>     next_billing_at?: number | null,
>     pause_date?: number | null,
>     resume_date?: number | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     contract_term?: {
>       id?: string | null,
>       status?: string | null,
>       contract_start?: number | null,
>       contract_end?: number | null,
>       billing_cycle?: number | null,
>       action_at_term_end?: string | null,
>       total_contract_value?: number | null,
>       total_contract_value_before_tax?: number | null,
>       cancellation_cutoff_period?: number | null,
>       created_at?: number | null,
>       subscription_id?: string | null,
>       remaining_billing_cycles?: number | null
>     } | null
>   }[] | null,
>   invoice_estimate?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   } | null,
>   invoice_estimates?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   }[] | null,
>   payment_schedule_estimates?: {
>     id?: string | null,
>     scheme_id?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     amount?: number | null,
>     currency_code?: string | null,
>     schedule_entries?: {
>       id?: string | null,
>       date?: number | null,
>       amount?: number | null,
>       scheduled_amount?: number | null,
>       status?: string | null
>     }[] | null
>   }[] | null,
>   next_invoice_estimate?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   } | null,
>   credit_note_estimates?: {
>     reference_invoice_id?: string | null,
>     type?: string | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     amount_allocated?: number | null,
>     amount_available?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   }[] | null,
>   unbilled_charge_estimates?: {
>     id?: string | null,
>     customer_id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     pricing_model?: string | null,
>     quantity?: number | null,
>     amount?: number | null,
>     currency_code?: string | null,
>     discount_amount?: number | null,
>     description?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     is_voided?: boolean | null,
>     voided_at?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     is_advance_charge?: boolean | null,
>     business_entity_id?: string | null,
>     deleted?: boolean | null
>   }[] | null
> } | null
> ```

***

## Events

### get

`events.get`

Retrieve an event. Retrieves a specific event identified by a unique event identifier. Note: Only events that are less than 90 days old will be retrieved.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.events.get({ eventId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `eventId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `event` | `object \| null` | No | ### Introduction When important changes occur on your Chargebee site, they are recorded as events. An event contains data about the affected resources and metadata, such as the timestamp of the change. For example, when a subscription is canceled due to non-payment, an event such as `subscription_cancelled` is recorded. ### Webhooks If webhooks are [configured](https://www.chargebee.com/docs/webhook_settings.html#configure-webhooks) in Chargebee, events trigger those webhooks. If multiple webhooks are configured, Chargebee calls each webhook sequentially for every event. If a webhook call fails or times out, it is retried based on a [fixed schedule](https://www.chargebee.com/docs/webhook_settings.html#automatic-retries). The webhook call is an HTTP POST with the content type `application/json`. #### Retries and Duplicate Handling To mark a webhook notification successful, the webhook must return an [HTTP status code](http://en.wikipedia.org/wiki/List_of_HTTP_status_codes) in the `2XX` range. If a `2XX` response is not received, Chargebee [retries](https://www.chargebee.com/docs/webhook_settings.html#automatic-retries) the webhook call with increasing delays for up to 2 days. You can also [resend](https://www.chargebee.com/docs/webhook_settings.html#automatic-retries) webhook calls manually from the web console. Due to webhook retries, it is possible that your application receives the same webhook more than once. Detect such duplicates within your application to ensure the idempotency of the webhook call. This can be done by examining the [id](https://docs.corsair.dev/docs/api/events/event-object#id) parameter since its value uniquely identifies an event. For example, your application can do the following for each webhook notification: 1. Get the event `id` and keep it in a persistent store such as a relational database or redis. 2. Check whether the event `id` is already processed. 3. If the event has not been processed, process it; otherwise, it is a duplicate event, so it can be ignored. 4. Also, since the last retry for a webhook happens around 3 days and 7 hours after the original event trigger, keep the idempotency window at 3 days and 7 hours. In other words, you can purge stored event IDs that are older than 3 days and 7 hours. #### Out-of-order Delivery Webhooks can also arrive at your application out-of-order. This can be due to issues such as network delays or webhook failures. However, you can order the events by examining the `resource_version` attribute of the resource sent by the webhook. For every change made to the resource, `resource_version` is updated with a new timestamp in milliseconds. For example, if you wish to sync resource changes from Chargebee to your application, you can: 1. Get the value `rv1` of the `resource_version` attribute from the resource in the webhook. 2. Get the value `rv2` of `resource_version` from the resource stored on your side. 3. If `rv1` \\> `rv2`, process the resource; otherwise, ignore. **API Version** Chargebee supports multiple API versions now. The [`api_version`](https://docs.corsair.dev/docs/api/events/event-object#api_version) attribute indicates the API version based on which the event content is structured. While processing webhooks, ensure that `api_version` is the same as the API version used by your webhook server's client library. #### Securing Your Webhook URL You can have **basic authentication** for the webhook URL. 1. On the Webhook Settings page (**Settings \\> Configure Chargebee \\> Webhooks** ), select the webhook tab and check the option **My webhook URL is protected by basic authentication.** 2. Enter **Username** and **Password** and click **Update Webhook.** **OR** Generate a random key and have it as part of your webhook URL *eg, [http://yourapp.com/chargebee-webhook/cuktqaem0i2fkd5jt9cdtojcn9cvb3Y](http://yourapp.com/chargebee-webhook/cuktqaem0i2fkd5jt9cdtojcn9cvb3Y)* In addition to securing your webhook, you can ensure the integrity of the event data by fetching it again using the [Retrieve an Event](https://docs.corsair.dev/docs/api/events/retrieve-an-event) API call. #### About Webhook IP Addresses Webhooks from Chargebee originate from a [specific set of IP addresses](https://docs.corsair.dev/docs/api/webhooks). |

> [accordion] event full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   occurred_at?: number | null,
>   source?: string | null,
>   user?: string | null,
>   event_type?: string | null,
>   site_id?: string | null,
>   api_version?: string | null,
>   content?: {
>   } | null,
>   origin_user?: string | null,
>   webhooks?: {
>     id?: string | null,
>     webhook_status?: string | null
>   }[] | null
> } | null
> ```

***

### list

`events.list`

List events. Retrieves list of events. (GET /events)

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.events.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `id` | `object` | No | optional, string filter Uniquely identifies a event. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *id\\\[is\\] = "8ndk0hbKm"* |
| `webhook_status` | `object` | No | optional, enumerated string filter Returns the events (occurred in the past 6 days) which has this status in any of the events' webhooks. **Note**: To retrieve events which have occurred before the 6 day period, use the occurred\_at(start\_time/end\_time) attribute. Possible values are : not\_configured, scheduled, succeeded, re\_scheduled, failed, skipped, not\_applicable. **Supported operators :** is, is\_not, in, not\_in **Example →** *webhook\_status\\\[is\\] = "succeeded"* |
| `event_type` | `object` | No | optional, enumerated string filter Specify it if you need to fetch events of a particular type. Possible values are : coupon\_created, coupon\_updated, coupon\_deleted, coupon\_set\_created, coupon\_set\_updated, coupon\_set\_deleted, coupon\_codes\_added, coupon\_codes\_deleted, coupon\_codes\_updated, customer\_created, customer\_changed, customer\_deleted, customer\_moved\_out, customer\_moved\_in, promotional\_credits\_added, promotional\_credits\_deducted, subscription\_created, subscription\_created\_with\_backdating, subscription\_started, subscription\_trial\_end\_reminder, subscription\_activated, subscription\_activated\_with\_backdating, subscription\_changed, mrr\_updated, subscription\_changed\_with\_backdating, subscription\_cancellation\_scheduled, subscription\_cancellation\_reminder, subscription\_cancelled, subscription\_canceled\_with\_backdating, subscription\_reactivated, subscription\_reactivated\_with\_backdating, subscription\_renewed, subscription\_scheduled\_cancellation\_removed, subscription\_changes\_scheduled, subscription\_scheduled\_changes\_removed, subscription\_shipping\_address\_updated, subscription\_deleted, subscription\_paused, subscription\_pause\_scheduled, subscription\_scheduled\_pause\_removed, subscription\_resumed, subscription\_resumption\_scheduled, subscription\_scheduled\_resumption\_removed, subscription\_advance\_invoice\_schedule\_added, subscription\_advance\_invoice\_schedule\_updated, subscription\_advance\_invoice\_schedule\_removed, pending\_invoice\_created, pending\_invoice\_updated, invoice\_generated, invoice\_generated\_with\_backdating, invoice\_updated, invoice\_deleted, credit\_note\_created, credit\_note\_created\_with\_backdating, credit\_note\_updated, credit\_note\_deleted, subscription\_renewal\_reminder, add\_usages\_reminder, transaction\_created, transaction\_updated, transaction\_deleted, payment\_succeeded, payment\_failed, payment\_refunded, payment\_initiated, refund\_initiated, authorization\_succeeded, authorization\_voided, card\_added, card\_updated, card\_expiry\_reminder, card\_expired, card\_deleted, payment\_source\_added, payment\_source\_updated, payment\_source\_deleted, payment\_source\_expiring, payment\_source\_expired, virtual\_bank\_account\_added, virtual\_bank\_account\_updated, virtual\_bank\_account\_deleted, token\_created, token\_consumed, token\_expired, unbilled\_charges\_created, unbilled\_charges\_voided, unbilled\_charges\_deleted, unbilled\_charges\_invoiced, order\_created, order\_updated, order\_cancelled, order\_delivered, order\_returned, order\_ready\_to\_process, order\_ready\_to\_ship, order\_deleted, order\_resent, quote\_created, quote\_updated, quote\_deleted, tax\_withheld\_recorded, tax\_withheld\_deleted, tax\_withheld\_refunded, gift\_scheduled, gift\_unclaimed, gift\_claimed, gift\_expired, gift\_cancelled, gift\_updated, hierarchy\_created, hierarchy\_deleted, payment\_intent\_created, payment\_intent\_updated, contract\_term\_created, contract\_term\_renewed, contract\_term\_terminated, contract\_term\_completed, contract\_term\_cancelled, item\_family\_created, item\_family\_updated, item\_family\_deleted, item\_created, item\_updated, item\_deleted, item\_price\_created, item\_price\_updated, item\_price\_deleted, attached\_item\_created, attached\_item\_updated, attached\_item\_deleted, differential\_price\_created, differential\_price\_updated, differential\_price\_deleted, feature\_created, feature\_updated, feature\_deleted, feature\_activated, feature\_reactivated, feature\_archived, item\_entitlements\_updated, entitlement\_overrides\_updated, entitlement\_overrides\_removed, item\_entitlements\_removed, entitlement\_overrides\_auto\_removed, business\_entity\_created, business\_entity\_updated, business\_entity\_deleted, purchase\_created. **Supported operators :** is, is\_not, in, not\_in **Example →** *event\_type\\\[is\\] = "customer\_created"* |
| `source` | `object` | No | optional, enumerated string filter Source of the event. Possible values are : admin\_console, api, scheduled\_job, hosted\_page, portal, system, none, js\_api, migration, bulk\_operation, external\_service. **Supported operators :** is, is\_not, in, not\_in **Example →** *source\\\[is\_not\\] = "hosted\_page"* |
| `occurred_at` | `object` | No | optional, timestamp(UTC) in seconds filter Timestamp indicating when this event had occurred. **Supported operators :** after, before, on, between **Example →** *occurred\_at\\\[after\\] = "1349116200"* |
| `sort_by` | `object` | No | optional, string filter Sorts based on the specified attribute. **Supported attributes :** occurred\_at **Supported sort-orders :** asc, desc **Example →** *sort\_by\\\[asc\\] = "occurred\_at"* This will sort the result based on the 'occurred\_at' attribute in ascending(earliest first) order. |

> [accordion] id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] webhook\_status full type
>
> ```ts theme={null}
> {
>   is?: not_configured | scheduled | succeeded | re_scheduled | failed | skipped | not_applicable | disabled | rate_limited,
>   is_not?: not_configured | scheduled | succeeded | re_scheduled | failed | skipped | not_applicable | disabled | rate_limited,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] event\_type full type
>
> ```ts theme={null}
> {
>   is?: coupon_created | coupon_updated | coupon_deleted | coupon_set_created | coupon_set_updated | coupon_set_deleted | coupon_codes_added | coupon_codes_deleted | coupon_codes_updated | customer_created | customer_changed | customer_deleted | customer_moved_out | customer_moved_in | promotional_credits_added | promotional_credits_deducted | subscription_created | subscription_created_with_backdating | subscription_started | subscription_trial_end_reminder | subscription_activated | subscription_activated_with_backdating | subscription_changed | subscription_trial_extended | mrr_updated | subscription_changed_with_backdating | subscription_cancellation_scheduled | subscription_cancellation_reminder | subscription_cancelled | subscription_canceled_with_backdating | subscription_reactivated | subscription_reactivated_with_backdating | subscription_renewed | subscription_items_renewed | subscription_scheduled_cancellation_removed | subscription_changes_scheduled | subscription_scheduled_changes_removed | subscription_shipping_address_updated | subscription_deleted | subscription_paused | subscription_pause_scheduled | subscription_scheduled_pause_removed | subscription_resumed | subscription_resumption_scheduled | subscription_scheduled_resumption_removed | subscription_advance_invoice_schedule_added | subscription_advance_invoice_schedule_updated | subscription_advance_invoice_schedule_removed | pending_invoice_created | pending_invoice_updated | invoice_generated | invoice_generated_with_backdating | invoice_updated | invoice_deleted | credit_note_created | credit_note_created_with_backdating | credit_note_updated | credit_note_deleted | einvoice_created | einvoice_updated | payment_schedules_created | payment_schedules_updated | payment_schedule_scheme_created | payment_schedule_scheme_deleted | payment_schedules_cancelled | subscription_renewal_reminder | add_usages_reminder | payment_due_reminder | transaction_created | transaction_updated | transaction_deleted | payment_succeeded | payment_failed | dunning_updated | payment_refunded | refund_failed | payment_initiated | refund_initiated | authorization_succeeded | authorization_voided | card_added | card_updated | card_expiry_reminder | card_expired | card_deleted | payment_source_added | payment_source_updated | payment_source_deleted | payment_source_expiring | payment_source_expired | payment_source_locally_deleted | virtual_bank_account_added | virtual_bank_account_updated | virtual_bank_account_deleted | token_created | token_consumed | token_expired | unbilled_charges_created | unbilled_charges_voided | unbilled_charges_deleted | unbilled_charges_invoiced | order_created | order_updated | order_cancelled | order_delivered | order_returned | order_ready_to_process | order_ready_to_ship | order_deleted | order_resent | quote_created | quote_updated | quote_deleted | tax_withheld_recorded | tax_withheld_deleted | tax_withheld_refunded | gift_scheduled | gift_unclaimed | gift_claimed | gift_expired | gift_cancelled | gift_updated | hierarchy_created | hierarchy_deleted | payment_intent_created | payment_intent_updated | contract_term_created | contract_term_renewed | contract_term_terminated | contract_term_completed | contract_term_cancelled | item_family_created | item_family_updated | item_family_deleted | item_created | item_updated | item_deleted | item_price_created | item_price_updated | item_price_deleted | attached_item_created | attached_item_updated | attached_item_deleted | differential_price_created | differential_price_updated | differential_price_deleted | feature_created | feature_updated | feature_deleted | feature_activated | feature_reactivated | feature_archived | item_entitlements_updated | entitlement_overrides_updated | entitlement_overrides_removed | item_entitlements_removed | entitlement_overrides_auto_removed | subscription_entitlements_created | subscription_entitlements_updated | business_entity_created | business_entity_updated | business_entity_deleted | customer_business_entity_changed | subscription_business_entity_changed | payment_source_business_entity_changed | organization_details_created | organization_details_updated | purchase_created | voucher_created | voucher_expired | voucher_create_failed | item_price_entitlements_updated | item_price_entitlements_removed | subscription_ramp_created | subscription_ramp_deleted | subscription_ramp_applied | subscription_ramp_drafted | subscription_ramp_updated | price_variant_created | price_variant_updated | price_variant_deleted | customer_entitlements_updated | subscription_moved_in | subscription_moved_out | subscription_movement_failed | omnichannel_subscription_created | omnichannel_subscription_item_renewed | omnichannel_subscription_item_downgraded | omnichannel_subscription_item_expired | omnichannel_subscription_item_cancellation_scheduled | omnichannel_subscription_item_scheduled_cancellation_removed | omnichannel_subscription_item_resubscribed | omnichannel_subscription_item_upgraded | omnichannel_subscription_item_cancelled | omnichannel_subscription_imported | omnichannel_subscription_item_grace_period_started | omnichannel_subscription_item_grace_period_expired | omnichannel_subscription_item_dunning_started | omnichannel_subscription_item_dunning_expired | rule_created | rule_updated | rule_deleted | record_purchase_failed | omnichannel_subscription_item_change_scheduled | omnichannel_subscription_item_scheduled_change_removed | omnichannel_subscription_item_reactivated | sales_order_created | sales_order_updated | omnichannel_subscription_item_changed | omnichannel_subscription_item_paused | omnichannel_subscription_item_resumed | omnichannel_one_time_order_created | omnichannel_one_time_order_item_cancelled | usage_file_ingested | omnichannel_subscription_item_pause_scheduled | omnichannel_subscription_moved_in | omnichannel_transaction_created | alert_status_changed | omnichannel_subscription_item_updated | omnichannel_subscription_item_recovered | price_ramp_created | price_ramp_updated | price_ramp_deleted | omnichannel_subscription_item_mrr_updated | ledger_account_balance_updated | grant_blocks_created | grant_blocks_updated | ledger_updated | business_rule_created | business_rule_updated | business_rule_activated | business_rule_deactivated | business_rule_deleted | business_rule_released | vault_token_created | vault_token_updated | vault_token_deleted | chargeback_initiated | chargeback_won | chargeback_lost | business_ruleset_created | business_ruleset_updated | business_ruleset_activated | business_ruleset_deactivated | business_ruleset_deleted | collections_reminder_sequence_created | collections_reminder_sequence_paused | collections_reminder_sequence_resumed | collections_reminder_sequence_completed | collections_payment_promise_created | collections_payment_promise_updated | collections_payment_promise_fulfilled | collections_payment_promise_cancelled | collections_payment_promise_broken | collections_dispute_created | collections_dispute_updated | collections_dispute_resolved | collections_dispute_withdrawn | email_message_received | private_note_added,
>   is_not?: coupon_created | coupon_updated | coupon_deleted | coupon_set_created | coupon_set_updated | coupon_set_deleted | coupon_codes_added | coupon_codes_deleted | coupon_codes_updated | customer_created | customer_changed | customer_deleted | customer_moved_out | customer_moved_in | promotional_credits_added | promotional_credits_deducted | subscription_created | subscription_created_with_backdating | subscription_started | subscription_trial_end_reminder | subscription_activated | subscription_activated_with_backdating | subscription_changed | subscription_trial_extended | mrr_updated | subscription_changed_with_backdating | subscription_cancellation_scheduled | subscription_cancellation_reminder | subscription_cancelled | subscription_canceled_with_backdating | subscription_reactivated | subscription_reactivated_with_backdating | subscription_renewed | subscription_items_renewed | subscription_scheduled_cancellation_removed | subscription_changes_scheduled | subscription_scheduled_changes_removed | subscription_shipping_address_updated | subscription_deleted | subscription_paused | subscription_pause_scheduled | subscription_scheduled_pause_removed | subscription_resumed | subscription_resumption_scheduled | subscription_scheduled_resumption_removed | subscription_advance_invoice_schedule_added | subscription_advance_invoice_schedule_updated | subscription_advance_invoice_schedule_removed | pending_invoice_created | pending_invoice_updated | invoice_generated | invoice_generated_with_backdating | invoice_updated | invoice_deleted | credit_note_created | credit_note_created_with_backdating | credit_note_updated | credit_note_deleted | einvoice_created | einvoice_updated | payment_schedules_created | payment_schedules_updated | payment_schedule_scheme_created | payment_schedule_scheme_deleted | payment_schedules_cancelled | subscription_renewal_reminder | add_usages_reminder | payment_due_reminder | transaction_created | transaction_updated | transaction_deleted | payment_succeeded | payment_failed | dunning_updated | payment_refunded | refund_failed | payment_initiated | refund_initiated | authorization_succeeded | authorization_voided | card_added | card_updated | card_expiry_reminder | card_expired | card_deleted | payment_source_added | payment_source_updated | payment_source_deleted | payment_source_expiring | payment_source_expired | payment_source_locally_deleted | virtual_bank_account_added | virtual_bank_account_updated | virtual_bank_account_deleted | token_created | token_consumed | token_expired | unbilled_charges_created | unbilled_charges_voided | unbilled_charges_deleted | unbilled_charges_invoiced | order_created | order_updated | order_cancelled | order_delivered | order_returned | order_ready_to_process | order_ready_to_ship | order_deleted | order_resent | quote_created | quote_updated | quote_deleted | tax_withheld_recorded | tax_withheld_deleted | tax_withheld_refunded | gift_scheduled | gift_unclaimed | gift_claimed | gift_expired | gift_cancelled | gift_updated | hierarchy_created | hierarchy_deleted | payment_intent_created | payment_intent_updated | contract_term_created | contract_term_renewed | contract_term_terminated | contract_term_completed | contract_term_cancelled | item_family_created | item_family_updated | item_family_deleted | item_created | item_updated | item_deleted | item_price_created | item_price_updated | item_price_deleted | attached_item_created | attached_item_updated | attached_item_deleted | differential_price_created | differential_price_updated | differential_price_deleted | feature_created | feature_updated | feature_deleted | feature_activated | feature_reactivated | feature_archived | item_entitlements_updated | entitlement_overrides_updated | entitlement_overrides_removed | item_entitlements_removed | entitlement_overrides_auto_removed | subscription_entitlements_created | subscription_entitlements_updated | business_entity_created | business_entity_updated | business_entity_deleted | customer_business_entity_changed | subscription_business_entity_changed | payment_source_business_entity_changed | organization_details_created | organization_details_updated | purchase_created | voucher_created | voucher_expired | voucher_create_failed | item_price_entitlements_updated | item_price_entitlements_removed | subscription_ramp_created | subscription_ramp_deleted | subscription_ramp_applied | subscription_ramp_drafted | subscription_ramp_updated | price_variant_created | price_variant_updated | price_variant_deleted | customer_entitlements_updated | subscription_moved_in | subscription_moved_out | subscription_movement_failed | omnichannel_subscription_created | omnichannel_subscription_item_renewed | omnichannel_subscription_item_downgraded | omnichannel_subscription_item_expired | omnichannel_subscription_item_cancellation_scheduled | omnichannel_subscription_item_scheduled_cancellation_removed | omnichannel_subscription_item_resubscribed | omnichannel_subscription_item_upgraded | omnichannel_subscription_item_cancelled | omnichannel_subscription_imported | omnichannel_subscription_item_grace_period_started | omnichannel_subscription_item_grace_period_expired | omnichannel_subscription_item_dunning_started | omnichannel_subscription_item_dunning_expired | rule_created | rule_updated | rule_deleted | record_purchase_failed | omnichannel_subscription_item_change_scheduled | omnichannel_subscription_item_scheduled_change_removed | omnichannel_subscription_item_reactivated | sales_order_created | sales_order_updated | omnichannel_subscription_item_changed | omnichannel_subscription_item_paused | omnichannel_subscription_item_resumed | omnichannel_one_time_order_created | omnichannel_one_time_order_item_cancelled | usage_file_ingested | omnichannel_subscription_item_pause_scheduled | omnichannel_subscription_moved_in | omnichannel_transaction_created | alert_status_changed | omnichannel_subscription_item_updated | omnichannel_subscription_item_recovered | price_ramp_created | price_ramp_updated | price_ramp_deleted | omnichannel_subscription_item_mrr_updated | ledger_account_balance_updated | grant_blocks_created | grant_blocks_updated | ledger_updated | business_rule_created | business_rule_updated | business_rule_activated | business_rule_deactivated | business_rule_deleted | business_rule_released | vault_token_created | vault_token_updated | vault_token_deleted | chargeback_initiated | chargeback_won | chargeback_lost | business_ruleset_created | business_ruleset_updated | business_ruleset_activated | business_ruleset_deactivated | business_ruleset_deleted | collections_reminder_sequence_created | collections_reminder_sequence_paused | collections_reminder_sequence_resumed | collections_reminder_sequence_completed | collections_payment_promise_created | collections_payment_promise_updated | collections_payment_promise_fulfilled | collections_payment_promise_cancelled | collections_payment_promise_broken | collections_dispute_created | collections_dispute_updated | collections_dispute_resolved | collections_dispute_withdrawn | email_message_received | private_note_added,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] source full type
>
> ```ts theme={null}
> {
>   is?: admin_console | api | scheduled_job | hosted_page | portal | system | none | js_api | migration | bulk_operation | external_service | mcp | copilot | agent,
>   is_not?: admin_console | api | scheduled_job | hosted_page | portal | system | none | js_api | migration | bulk_operation | external_service | mcp | copilot | agent,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] occurred\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] sort\_by full type
>
> ```ts theme={null}
> {
>   asc?: occurred_at,
>   desc?: occurred_at
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   event?: {
>     id?: string | null,
>     occurred_at?: number | null,
>     source?: string | null,
>     user?: string | null,
>     event_type?: string | null,
>     site_id?: string | null,
>     api_version?: string | null,
>     content?: {
>     } | null,
>     origin_user?: string | null,
>     webhooks?: {
>       id?: string | null,
>       webhook_status?: string | null
>     }[] | null
>   } | null
> }[] | null
> ```

***

## Exports

### addons

`exports.addons`

Export addons. This API triggers export of addon data. The exported zip file contains CSV files with addon-related data. Product Catalog 1.0 sites only.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.exports.addons({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `currency_code` | `object` | No | optional, string filter The currency code (ISO 4217 format) of the addon. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *currency\_code\\\[is\\] = "USD"* |
| `addon` | `object` | No | Parameters for addon |

> [accordion] currency\_code full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] addon full type
>
> ```ts theme={null}
> {
>   id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   name?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   charge_type?: {
>     is?: recurring | non_recurring,
>     is_not?: recurring | non_recurring,
>     in?: string,
>     not_in?: string
>   },
>   price?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string
>   },
>   period?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string
>   },
>   period_unit?: {
>     is?: day | week | month | year | not_applicable,
>     is_not?: day | week | month | year | not_applicable,
>     in?: string,
>     not_in?: string
>   },
>   status?: {
>     is?: active | archived | deleted,
>     is_not?: active | archived | deleted,
>     in?: string,
>     not_in?: string
>   },
>   updated_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   channel?: {
>     is?: web | app_store | play_store,
>     is_not?: web | app_store | play_store,
>     in?: string,
>     not_in?: string
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `export` | `object \| null` | No | Export resource represents an export job and contains the status of the job and the download URL, if the job is successfully completed. Export operations are asynchronous and will return "Export" resource in response . The export resource will contain the status of the export job (like in-process, completed...) . If the status is completed, it will contain the download url pointing to the zip/pdf containing the exported data. **Note:** At any given point, only 5 export jobs can be processed. Beyond that, an error stating that the API request limit has been reached will be returned. **Note:** Export operations are eventually consistent, so exported data might not reflect a recent write. For more information, see [Read consistency](https://docs.corsair.dev/docs/api/v2/pcv-1/read-consistency). |

> [accordion] export full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   operation_type?: string | null,
>   mime_type?: string | null,
>   status?: string | null,
>   created_at?: number | null,
>   download?: {
>     download_url?: string | null,
>     valid_till?: number | null,
>     mime_type?: string | null
>   } | null
> } | null
> ```

***

### attachedItems

`exports.attachedItems`

Export attached items. This API triggers export of attached item data. The exported zip file contains CSV files with attached item-related data.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.exports.attachedItems({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `item_type` | `object` | No | optional, enumerated string filter To filter based on the type of of the attached item. Possible values are : `addon` , `charge`. Possible values are : plan, addon, charge. **Supported operators :** is, is\_not, in, not\_in **Example →** *item\_type\\\[is\_not\\] = "plan"* |
| `attached_item` | `object` | No | Parameters for attached\_item |

> [accordion] item\_type full type
>
> ```ts theme={null}
> {
>   is?: plan | addon | charge,
>   is_not?: plan | addon | charge,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] attached\_item full type
>
> ```ts theme={null}
> {
>   id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   item_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   type?: {
>     is?: recommended | mandatory | optional,
>     is_not?: recommended | mandatory | optional,
>     in?: string,
>     not_in?: string
>   },
>   charge_on_event?: {
>     is?: subscription_creation | subscription_trial_start | plan_activation | subscription_activation | contract_termination | on_demand,
>     is_not?: subscription_creation | subscription_trial_start | plan_activation | subscription_activation | contract_termination | on_demand,
>     in?: string,
>     not_in?: string
>   },
>   updated_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   parent_item_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `export` | `object \| null` | No | Export resource represents an export job and contains the status of the job and the download URL, if the job is successfully completed. Export operations are asynchronous and will return "Export" resource in response . The export resource will contain the status of the export job (like in-process, completed...) . If the status is completed, it will contain the download url pointing to the zip/pdf containing the exported data. **Note:** At any given point, only 5 export jobs can be processed. Beyond that, an error stating that the API request limit has been reached will be returned. **Note:** Export operations are eventually consistent, so exported data might not reflect a recent write. For more information, see [Read consistency](https://docs.corsair.dev/docs/api/read-consistency). |

> [accordion] export full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   operation_type?: string | null,
>   mime_type?: string | null,
>   status?: string | null,
>   created_at?: number | null,
>   download?: {
>     download_url?: string | null,
>     valid_till?: number | null,
>     mime_type?: string | null
>   } | null
> } | null
> ```

***

### coupons

`exports.coupons`

Export coupons. This API triggers export of coupon data. The exported zip file contains CSV files with coupon-related data.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.exports.coupons({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `currency_code` | `object` | No | optional, string filter The currency code ([ISO 4217 format](https://www.chargebee.com/docs/supported-currencies.html) ) of the coupon. Applicable for *fixed\_amount* coupons alone. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *currency\_code\\\[is\\] = "USD"* |
| `applicable_item_price_ids` | `object` | No | optional, string filter List of itemPrice ids for which these coupons are applicable. **Supported operators :** in, is **Example →** *applicable\_item\_price\_ids\\\[in\\] = "day-pass-USD"* |
| `coupon` | `object` | No | Parameters for coupon |

> [accordion] currency\_code full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] applicable\_item\_price\_ids full type
>
> ```ts theme={null}
> {
>   is?: string,
>   in?: string
> }
> ```

> [accordion] coupon full type
>
> ```ts theme={null}
> {
>   id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   name?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   discount_type?: {
>     is?: fixed_amount | percentage | offer_quantity,
>     is_not?: fixed_amount | percentage | offer_quantity,
>     in?: string,
>     not_in?: string
>   },
>   duration_type?: {
>     is?: one_time | forever | limited_period,
>     is_not?: one_time | forever | limited_period,
>     in?: string,
>     not_in?: string
>   },
>   status?: {
>     is?: active | expired | archived | deleted | future,
>     is_not?: active | expired | archived | deleted | future,
>     in?: string,
>     not_in?: string
>   },
>   apply_on?: {
>     is?: invoice_amount | each_specified_item,
>     is_not?: invoice_amount | each_specified_item,
>     in?: string,
>     not_in?: string
>   },
>   created_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   updated_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `export` | `object \| null` | No | Export resource represents an export job and contains the status of the job and the download URL, if the job is successfully completed. Export operations are asynchronous and will return "Export" resource in response . The export resource will contain the status of the export job (like in-process, completed...) . If the status is completed, it will contain the download url pointing to the zip/pdf containing the exported data. **Note:** At any given point, only 5 export jobs can be processed. Beyond that, an error stating that the API request limit has been reached will be returned. **Note:** Export operations are eventually consistent, so exported data might not reflect a recent write. For more information, see [Read consistency](https://docs.corsair.dev/docs/api/read-consistency). |

> [accordion] export full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   operation_type?: string | null,
>   mime_type?: string | null,
>   status?: string | null,
>   created_at?: number | null,
>   download?: {
>     download_url?: string | null,
>     valid_till?: number | null,
>     mime_type?: string | null
>   } | null
> } | null
> ```

***

### creditNotes

`exports.creditNotes`

Export credit notes. This API triggers export of credit note data. The exported zip file contains CSV files with credit note-related data.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.exports.creditNotes({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `credit_note` | `object` | No | Parameters for credit\_note |

> [accordion] credit\_note full type
>
> ```ts theme={null}
> {
>   id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   customer_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   subscription_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     is_present?: true | false,
>     in?: string,
>     not_in?: string
>   },
>   reference_invoice_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     is_present?: true | false,
>     in?: string,
>     not_in?: string
>   },
>   type?: {
>     is?: adjustment | refundable | store,
>     is_not?: adjustment | refundable | store,
>     in?: string,
>     not_in?: string
>   },
>   reason_code?: {
>     is?: write_off | subscription_change | subscription_cancellation | subscription_pause | chargeback | product_unsatisfactory | service_unsatisfactory | order_change | order_cancellation | waiver | other | fraudulent,
>     is_not?: write_off | subscription_change | subscription_cancellation | subscription_pause | chargeback | product_unsatisfactory | service_unsatisfactory | order_change | order_cancellation | waiver | other | fraudulent,
>     in?: string,
>     not_in?: string
>   },
>   create_reason_code?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   status?: {
>     is?: adjusted | refunded | refund_due | voided,
>     is_not?: adjusted | refunded | refund_due | voided,
>     in?: string,
>     not_in?: string
>   },
>   date?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   total?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string
>   },
>   price_type?: {
>     is?: tax_exclusive | tax_inclusive,
>     is_not?: tax_exclusive | tax_inclusive,
>     in?: string,
>     not_in?: string
>   },
>   amount_allocated?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string
>   },
>   amount_refunded?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string
>   },
>   amount_available?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string
>   },
>   voided_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   updated_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   channel?: {
>     is?: web | app_store | play_store,
>     is_not?: web | app_store | play_store,
>     in?: string,
>     not_in?: string
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `export` | `object \| null` | No | Export resource represents an export job and contains the status of the job and the download URL, if the job is successfully completed. Export operations are asynchronous and will return "Export" resource in response . The export resource will contain the status of the export job (like in-process, completed...) . If the status is completed, it will contain the download url pointing to the zip/pdf containing the exported data. **Note:** At any given point, only 5 export jobs can be processed. Beyond that, an error stating that the API request limit has been reached will be returned. **Note:** Export operations are eventually consistent, so exported data might not reflect a recent write. For more information, see [Read consistency](https://docs.corsair.dev/docs/api/read-consistency). |

> [accordion] export full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   operation_type?: string | null,
>   mime_type?: string | null,
>   status?: string | null,
>   created_at?: number | null,
>   download?: {
>     download_url?: string | null,
>     valid_till?: number | null,
>     mime_type?: string | null
>   } | null
> } | null
> ```

***

### customers

`exports.customers`

Export customers. This API triggers export of customer data. The exported zip file contains CSV files with customer-related data. Starts an export job; read exports.get until its download URL is ready.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.exports.customers({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `export_type` | `data \| import_friendly_data` | No | Determines the format of the data. Returns the export type based on the selected value. \* data - Provides the full set of data for the customers in multiple `.csv` files. \* import\_friendly\_data - Provides a `.csv` file whose columns match the [`customer`](https://docs.corsair.dev/docs/api/customers/customer-object) schema. This file format can be readily imported through the UI by using [Bulk Operations](https://www.chargebee.com/docs/bulk-operations.html). |
| `business_entity_id` | `object` | No | optional, string filter The unique ID of the [business entity](https://docs.corsair.dev/docs/api/getting-started) of this subscription. This is always the same as the [business entity](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#customer_id) of the customer. **Supported operators :** is, is\_not, starts\_with **Example →** *business\_entity\_id\\\[is\\] = "business\_entity\_id"* |
| `customer` | `object` | No | Parameters for customer |
| `relationship` | `object` | No | Parameters for relationship |

> [accordion] business\_entity\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string
> }
> ```

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   first_name?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     is_present?: true | false
>   },
>   last_name?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     is_present?: true | false
>   },
>   email?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     is_present?: true | false
>   },
>   company?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     is_present?: true | false
>   },
>   phone?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     is_present?: true | false
>   },
>   auto_collection?: {
>     is?: on | off,
>     is_not?: on | off,
>     in?: string,
>     not_in?: string
>   },
>   taxability?: {
>     is?: taxable | exempt | zero_rated,
>     is_not?: taxable | exempt | zero_rated,
>     in?: string,
>     not_in?: string
>   },
>   created_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   updated_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   offline_payment_method?: {
>     is?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
>     is_not?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
>     in?: string,
>     not_in?: string
>   },
>   auto_close_invoices?: {
>     is?: true | false
>   },
>   channel?: {
>     is?: web | app_store | play_store,
>     is_not?: web | app_store | play_store,
>     in?: string,
>     not_in?: string
>   }
> }
> ```

> [accordion] relationship full type
>
> ```ts theme={null}
> {
>   parent_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string
>   },
>   payment_owner_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string
>   },
>   invoice_owner_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `export` | `object \| null` | No | Export resource represents an export job and contains the status of the job and the download URL, if the job is successfully completed. Export operations are asynchronous and will return "Export" resource in response . The export resource will contain the status of the export job (like in-process, completed...) . If the status is completed, it will contain the download url pointing to the zip/pdf containing the exported data. **Note:** At any given point, only 5 export jobs can be processed. Beyond that, an error stating that the API request limit has been reached will be returned. **Note:** Export operations are eventually consistent, so exported data might not reflect a recent write. For more information, see [Read consistency](https://docs.corsair.dev/docs/api/read-consistency). |

> [accordion] export full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   operation_type?: string | null,
>   mime_type?: string | null,
>   status?: string | null,
>   created_at?: number | null,
>   download?: {
>     download_url?: string | null,
>     valid_till?: number | null,
>     mime_type?: string | null
>   } | null
> } | null
> ```

***

### deferredRevenue

`exports.deferredRevenue`

Export deferred revenue reports. Important: This report is deprecated. Therefore, the endpoint is also deprecated. This API triggers export for the Deferred Revenue Report. Note: This API call is asynchronous. You need to check if this operation has completed by checking if the export status is completed .

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.exports.deferredRevenue({
	report_by: 'customer',
	report_from_month: 1,
	report_from_year: 1,
	report_to_month: 1,
	report_to_year: 1,
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `report_by` | `customer \| invoice \| product \| subscription` | Yes | Determines the scope of the report. Returns the report based on the value specified. \* subscription - Subscription \* invoice - Invoice \* product - Product (Includes Plan, Addon and Adhoc) \* customer - Customer |
| `currency_code` | `string` | No | Value must be in ISO 4217 format. Generates the report based on the value specified. If no currency\_code value is specified, then consolidated report based on base currency is returned. |
| `report_from_month` | `number` | Yes | Obtains report data from the specified month, combined with the value specified for report\_from\_year.Values must be between 1 and 12, where 1 is January and 12 is December. |
| `report_from_year` | `number` | Yes | Obtains report data from the specified year, combined with the value specified for report\_from\_month. |
| `report_to_month` | `number` | Yes | Obtains report data from the specified month, combined with the value specified for report\_to\_year.Values must be between 1 and 12, where 1 is January and 12 is December. |
| `report_to_year` | `number` | Yes | Obtains report data until the specified year, combined with the value specified for report\_to\_month. |
| `include_discounts` | `boolean` | No | Returns amount with discount in the report. If value specified is false, it returns amount without discount. |
| `payment_owner` | `object` | No | optional, string filter Payment owner of an invoice. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *payment\_owner\\\[is\\] = "payment\_customer"* |
| `item_id` | `object` | No | optional, string filter The plan item code. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *item\_id\\\[is\\] = "silver"* |
| `item_price_id` | `object` | No | optional, string filter The plan item price code. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *item\_price\_id\\\[is\\] = "silver-USD-monthly"* |
| `cancel_reason_code` | `object` | No | optional, string filter Reason code for canceling the subscription. Must be one from a list of reason codes set in the Chargebee app in **Settings \\> Configure Chargebee \\> Reason Codes \\> Subscriptions \\> Subscription Cancellation** . Must be passed if set as mandatory in the app. The codes are case-sensitive. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *cancel\_reason\_code\\\[is\\] = "Not Paid"* |
| `business_entity_id` | `object` | No | optional, string filter The unique ID of the [business entity](https://docs.corsair.dev/docs/api/getting-started) of this subscription. This is always the same as the [business entity](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#customer_id) of the customer. **Supported operators :** is, is\_not, starts\_with **Example →** *business\_entity\_id\\\[is\_not\\] = "business\_entity\_id"* |
| `invoice` | `object` | No | Parameters for invoice |
| `subscription` | `object` | No | Parameters for subscription |
| `customer` | `object` | No | Parameters for customer |
| `relationship` | `object` | No | Parameters for relationship |

> [accordion] payment\_owner full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] item\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] item\_price\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] cancel\_reason\_code full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] business\_entity\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string
> }
> ```

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   recurring?: {
>     is?: true | false
>   },
>   status?: {
>     is?: paid | posted | payment_due | not_paid | voided | pending,
>     is_not?: paid | posted | payment_due | not_paid | voided | pending,
>     in?: string,
>     not_in?: string
>   },
>   price_type?: {
>     is?: tax_exclusive | tax_inclusive,
>     is_not?: tax_exclusive | tax_inclusive,
>     in?: string,
>     not_in?: string
>   },
>   date?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   paid_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   total?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string
>   },
>   amount_paid?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string
>   },
>   amount_adjusted?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string
>   },
>   credits_applied?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string
>   },
>   amount_due?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string
>   },
>   dunning_status?: {
>     is?: in_progress | exhausted | stopped | success,
>     is_not?: in_progress | exhausted | stopped | success,
>     in?: string,
>     not_in?: string,
>     is_present?: true | false
>   },
>   updated_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   channel?: {
>     is?: web | app_store | play_store,
>     is_not?: web | app_store | play_store,
>     in?: string,
>     not_in?: string
>   }
> }
> ```

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   customer_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   status?: {
>     is?: future | in_trial | active | non_renewing | paused | cancelled | transferred,
>     is_not?: future | in_trial | active | non_renewing | paused | cancelled | transferred,
>     in?: string,
>     not_in?: string
>   },
>   cancel_reason?: {
>     is?: not_paid | no_card | fraud_review_failed | non_compliant_eu_customer | tax_calculation_failed | currency_incompatible_with_gateway | non_compliant_customer,
>     is_not?: not_paid | no_card | fraud_review_failed | non_compliant_eu_customer | tax_calculation_failed | currency_incompatible_with_gateway | non_compliant_customer,
>     in?: string,
>     not_in?: string,
>     is_present?: true | false
>   },
>   remaining_billing_cycles?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string,
>     is_present?: true | false
>   },
>   created_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   activated_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string,
>     is_present?: true | false
>   },
>   next_billing_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   cancelled_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   has_scheduled_changes?: {
>     is?: true | false
>   },
>   updated_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   offline_payment_method?: {
>     is?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
>     is_not?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
>     in?: string,
>     not_in?: string
>   },
>   auto_close_invoices?: {
>     is?: true | false
>   },
>   channel?: {
>     is?: web | app_store | play_store,
>     is_not?: web | app_store | play_store,
>     in?: string,
>     not_in?: string
>   }
> }
> ```

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   first_name?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     is_present?: true | false
>   },
>   last_name?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     is_present?: true | false
>   },
>   email?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     is_present?: true | false
>   },
>   company?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     is_present?: true | false
>   },
>   phone?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     is_present?: true | false
>   },
>   auto_collection?: {
>     is?: on | off,
>     is_not?: on | off,
>     in?: string,
>     not_in?: string
>   },
>   taxability?: {
>     is?: taxable | exempt | zero_rated,
>     is_not?: taxable | exempt | zero_rated,
>     in?: string,
>     not_in?: string
>   },
>   created_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   updated_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   offline_payment_method?: {
>     is?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
>     is_not?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
>     in?: string,
>     not_in?: string
>   },
>   auto_close_invoices?: {
>     is?: true | false
>   },
>   channel?: {
>     is?: web | app_store | play_store,
>     is_not?: web | app_store | play_store,
>     in?: string,
>     not_in?: string
>   }
> }
> ```

> [accordion] relationship full type
>
> ```ts theme={null}
> {
>   parent_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string
>   },
>   payment_owner_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string
>   },
>   invoice_owner_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `export` | `object \| null` | No | Export resource represents an export job and contains the status of the job and the download URL, if the job is successfully completed. Export operations are asynchronous and will return "Export" resource in response . The export resource will contain the status of the export job (like in-process, completed...) . If the status is completed, it will contain the download url pointing to the zip/pdf containing the exported data. **Note:** At any given point, only 5 export jobs can be processed. Beyond that, an error stating that the API request limit has been reached will be returned. **Note:** Export operations are eventually consistent, so exported data might not reflect a recent write. For more information, see [Read consistency](https://docs.corsair.dev/docs/api/read-consistency). |

> [accordion] export full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   operation_type?: string | null,
>   mime_type?: string | null,
>   status?: string | null,
>   created_at?: number | null,
>   download?: {
>     download_url?: string | null,
>     valid_till?: number | null,
>     mime_type?: string | null
>   } | null
> } | null
> ```

***

### differentialPrices

`exports.differentialPrices`

Export differential price. This API triggers export of differential price data. The exported zip file contains CSV files with differential price-related data.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.exports.differentialPrices({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `item_id` | `object` | No | optional, string filter Item Id of Addon / Charge item price for which differential pricing is applied to. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *item\_id\\\[is\\] = "day-pass"* |
| `differential_price` | `object` | No | Parameters for differential\_price |

> [accordion] item\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] differential\_price full type
>
> ```ts theme={null}
> {
>   item_price_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   parent_item_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `export` | `object \| null` | No | Export resource represents an export job and contains the status of the job and the download URL, if the job is successfully completed. Export operations are asynchronous and will return "Export" resource in response . The export resource will contain the status of the export job (like in-process, completed...) . If the status is completed, it will contain the download url pointing to the zip/pdf containing the exported data. **Note:** At any given point, only 5 export jobs can be processed. Beyond that, an error stating that the API request limit has been reached will be returned. **Note:** Export operations are eventually consistent, so exported data might not reflect a recent write. For more information, see [Read consistency](https://docs.corsair.dev/docs/api/read-consistency). |

> [accordion] export full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   operation_type?: string | null,
>   mime_type?: string | null,
>   status?: string | null,
>   created_at?: number | null,
>   download?: {
>     download_url?: string | null,
>     valid_till?: number | null,
>     mime_type?: string | null
>   } | null
> } | null
> ```

***

### get

`exports.get`

Retrieve an export. This API gets the status of the export job initiated by the Exports API. If the export job is completed, the downloads resource will also be obtained in the API response. The returned URL in the downloads resource is secure and can be downloaded. The URL expires after 4 hours.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.exports.get({ exportId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `exportId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `export` | `object \| null` | No | Export resource represents an export job and contains the status of the job and the download URL, if the job is successfully completed. Export operations are asynchronous and will return "Export" resource in response . The export resource will contain the status of the export job (like in-process, completed...) . If the status is completed, it will contain the download url pointing to the zip/pdf containing the exported data. **Note:** At any given point, only 5 export jobs can be processed. Beyond that, an error stating that the API request limit has been reached will be returned. **Note:** Export operations are eventually consistent, so exported data might not reflect a recent write. For more information, see [Read consistency](https://docs.corsair.dev/docs/api/read-consistency). |

> [accordion] export full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   operation_type?: string | null,
>   mime_type?: string | null,
>   status?: string | null,
>   created_at?: number | null,
>   download?: {
>     download_url?: string | null,
>     valid_till?: number | null,
>     mime_type?: string | null
>   } | null
> } | null
> ```

***

### invoices

`exports.invoices`

Export invoices. This API triggers export of invoice data. The exported zip file contains CSV files with invoice-related data. ### Invoice Export Best Practice For a full export, Chargebee recommends exporting data in batches by using date filters.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.exports.invoices({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `payment_owner` | `object` | No | optional, string filter Payment owner of an invoice. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *payment\_owner\\\[is\\] = "payment\_customer"* |
| `invoice` | `object` | No | Parameters for invoice |

> [accordion] payment\_owner full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   subscription_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     is_present?: true | false,
>     in?: string,
>     not_in?: string
>   },
>   customer_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   recurring?: {
>     is?: true | false
>   },
>   status?: {
>     is?: paid | posted | payment_due | not_paid | voided | pending,
>     is_not?: paid | posted | payment_due | not_paid | voided | pending,
>     in?: string,
>     not_in?: string
>   },
>   price_type?: {
>     is?: tax_exclusive | tax_inclusive,
>     is_not?: tax_exclusive | tax_inclusive,
>     in?: string,
>     not_in?: string
>   },
>   date?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   paid_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   total?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string
>   },
>   amount_paid?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string
>   },
>   amount_adjusted?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string
>   },
>   credits_applied?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string
>   },
>   amount_due?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string
>   },
>   dunning_status?: {
>     is?: in_progress | exhausted | stopped | success,
>     is_not?: in_progress | exhausted | stopped | success,
>     in?: string,
>     not_in?: string,
>     is_present?: true | false
>   },
>   updated_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   channel?: {
>     is?: web | app_store | play_store,
>     is_not?: web | app_store | play_store,
>     in?: string,
>     not_in?: string
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `export` | `object \| null` | No | Export resource represents an export job and contains the status of the job and the download URL, if the job is successfully completed. Export operations are asynchronous and will return "Export" resource in response . The export resource will contain the status of the export job (like in-process, completed...) . If the status is completed, it will contain the download url pointing to the zip/pdf containing the exported data. **Note:** At any given point, only 5 export jobs can be processed. Beyond that, an error stating that the API request limit has been reached will be returned. **Note:** Export operations are eventually consistent, so exported data might not reflect a recent write. For more information, see [Read consistency](https://docs.corsair.dev/docs/api/read-consistency). |

> [accordion] export full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   operation_type?: string | null,
>   mime_type?: string | null,
>   status?: string | null,
>   created_at?: number | null,
>   download?: {
>     download_url?: string | null,
>     valid_till?: number | null,
>     mime_type?: string | null
>   } | null
> } | null
> ```

***

### itemFamilies

`exports.itemFamilies`

Export item families. This API triggers export of item family data. The exported zip file contains CSV files with item family-related data.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.exports.itemFamilies({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `business_entity_id` | `object` | No | optional, string filter The unique ID of the [business entity](https://docs.corsair.dev/docs/api/business_entities) of this `item_family`. [Learn more](https://docs.corsair.dev/docs/api/using_business_entity_filters_in_product_catalog_list_apis) about all the scenarios before using this filter. **Supported operators :** is, is\_present **Example →** *business\_entity\_id\\\[is\_present\\] = "true"* |
| `include_site_level_resources` | `object` | No | optional, boolean filter Default value is `true` . To exclude site-level resources in [specific cases](https://docs.corsair.dev/docs/api/using_business_entity_filters_in_product_catalog_list_apis), set this parameter to `false`. Possible values are : *true, false* **Supported operators :** is **Example →** *include\_site\_level\_resources\\\[is\\] = "null"* |
| `item_family` | `object` | No | Parameters for item\_family |

> [accordion] business\_entity\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_present?: true | false
> }
> ```

> [accordion] include\_site\_level\_resources full type
>
> ```ts theme={null}
> {
>   is?: true | false
> }
> ```

> [accordion] item\_family full type
>
> ```ts theme={null}
> {
>   id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   name?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string
>   },
>   updated_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `export` | `object \| null` | No | Export resource represents an export job and contains the status of the job and the download URL, if the job is successfully completed. Export operations are asynchronous and will return "Export" resource in response . The export resource will contain the status of the export job (like in-process, completed...) . If the status is completed, it will contain the download url pointing to the zip/pdf containing the exported data. **Note:** At any given point, only 5 export jobs can be processed. Beyond that, an error stating that the API request limit has been reached will be returned. **Note:** Export operations are eventually consistent, so exported data might not reflect a recent write. For more information, see [Read consistency](https://docs.corsair.dev/docs/api/read-consistency). |

> [accordion] export full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   operation_type?: string | null,
>   mime_type?: string | null,
>   status?: string | null,
>   created_at?: number | null,
>   download?: {
>     download_url?: string | null,
>     valid_till?: number | null,
>     mime_type?: string | null
>   } | null
> } | null
> ```

***

### itemPrices

`exports.itemPrices`

Export item prices. This API triggers export of item price data. The exported zip file contains CSV files with item price-related data.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.exports.itemPrices({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `item_family_id` | `object` | No | optional, string filter Filter item prices based on `item_family_id` . **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *item\_family\_id\\\[is\\] = "Acme"* |
| `item_type` | `object` | No | optional, enumerated string filter Filter item prices based on `item_type`. Possible values are : plan, addon, charge. **Supported operators :** is, is\_not, in, not\_in **Example →** *item\_type\\\[is\_not\\] = "plan"* |
| `currency_code` | `object` | No | optional, string filter Filter item prices based on their `currency_code` . **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *currency\_code\\\[is\\] = "USD"* |
| `business_entity_id` | `object` | No | optional, string filter The unique ID of the [business entity](https://docs.corsair.dev/docs/api/business_entities) of this `item_price`. [Learn more](https://docs.corsair.dev/docs/api/using_business_entity_filters_in_product_catalog_list_apis) about all the scenarios before using this filter. **Supported operators :** is, is\_present **Example →** *business\_entity\_id\\\[is\_present\\] = "true"* |
| `include_site_level_resources` | `object` | No | optional, boolean filter Default value is `true` . To exclude site-level resources in [specific cases](), set this parameter to `false`. Possible values are : *true, false* **Supported operators :** is **Example →** *include\_site\_level\_resources\\\[is\\] = "null"* |
| `item_price` | `object` | No | Parameters for item\_price |

> [accordion] item\_family\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] item\_type full type
>
> ```ts theme={null}
> {
>   is?: plan | addon | charge,
>   is_not?: plan | addon | charge,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] currency\_code full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] business\_entity\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_present?: true | false
> }
> ```

> [accordion] include\_site\_level\_resources full type
>
> ```ts theme={null}
> {
>   is?: true | false
> }
> ```

> [accordion] item\_price full type
>
> ```ts theme={null}
> {
>   id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   name?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   pricing_model?: {
>     is?: flat_fee | per_unit | tiered | volume | stairstep,
>     is_not?: flat_fee | per_unit | tiered | volume | stairstep,
>     in?: string,
>     not_in?: string
>   },
>   item_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   price_variant_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   trial_period?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string
>   },
>   trial_period_unit?: {
>     is?: day | month,
>     is_not?: day | month,
>     in?: string,
>     not_in?: string
>   },
>   status?: {
>     is?: active | archived | deleted,
>     is_not?: active | archived | deleted,
>     in?: string,
>     not_in?: string
>   },
>   updated_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   period_unit?: {
>     is?: day | week | month | year,
>     is_not?: day | week | month | year,
>     in?: string,
>     not_in?: string
>   },
>   period?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string
>   },
>   channel?: {
>     is?: web | app_store | play_store,
>     is_not?: web | app_store | play_store,
>     in?: string,
>     not_in?: string
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `export` | `object \| null` | No | Export resource represents an export job and contains the status of the job and the download URL, if the job is successfully completed. Export operations are asynchronous and will return "Export" resource in response . The export resource will contain the status of the export job (like in-process, completed...) . If the status is completed, it will contain the download url pointing to the zip/pdf containing the exported data. **Note:** At any given point, only 5 export jobs can be processed. Beyond that, an error stating that the API request limit has been reached will be returned. **Note:** Export operations are eventually consistent, so exported data might not reflect a recent write. For more information, see [Read consistency](https://docs.corsair.dev/docs/api/read-consistency). |

> [accordion] export full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   operation_type?: string | null,
>   mime_type?: string | null,
>   status?: string | null,
>   created_at?: number | null,
>   download?: {
>     download_url?: string | null,
>     valid_till?: number | null,
>     mime_type?: string | null
>   } | null
> } | null
> ```

***

### items

`exports.items`

Export items. This API triggers export of item data. The exported zip file contains CSV files with item-related data.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.exports.items({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `business_entity_id` | `object` | No | optional, string filter The unique ID of the [business entity](https://docs.corsair.dev/docs/api/business_entities) of this `item`. [Learn more](https://docs.corsair.dev/docs/api/using_business_entity_filters_in_product_catalog_list_apis) about all the scenarios before using this filter. **Supported operators :** is, is\_present **Example →** *business\_entity\_id\\\[is\_present\\] = "true"* |
| `include_site_level_resources` | `object` | No | optional, boolean filter Default value is `true` . To exclude site-level resources in [specific cases](), set this parameter to `false`. Possible values are : *true, false* **Supported operators :** is **Example →** *include\_site\_level\_resources\\\[is\\] = "null"* |
| `item` | `object` | No | Parameters for item |

> [accordion] business\_entity\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_present?: true | false
> }
> ```

> [accordion] include\_site\_level\_resources full type
>
> ```ts theme={null}
> {
>   is?: true | false
> }
> ```

> [accordion] item full type
>
> ```ts theme={null}
> {
>   id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   item_family_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   type?: {
>     is?: plan | addon | charge,
>     is_not?: plan | addon | charge,
>     in?: string,
>     not_in?: string
>   },
>   name?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string
>   },
>   item_applicability?: {
>     is?: all | restricted,
>     is_not?: all | restricted,
>     in?: string,
>     not_in?: string
>   },
>   status?: {
>     is?: active | archived | deleted,
>     is_not?: active | archived | deleted,
>     in?: string,
>     not_in?: string
>   },
>   is_giftable?: {
>     is?: true | false
>   },
>   updated_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   enabled_for_checkout?: {
>     is?: true | false
>   },
>   enabled_in_portal?: {
>     is?: true | false
>   },
>   metered?: {
>     is?: true | false
>   },
>   usage_calculation?: {
>     is?: sum_of_usages | last_usage | max_usage,
>     is_not?: sum_of_usages | last_usage | max_usage,
>     in?: string,
>     not_in?: string
>   },
>   channel?: {
>     is?: web | app_store | play_store,
>     is_not?: web | app_store | play_store,
>     in?: string,
>     not_in?: string
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `export` | `object \| null` | No | Export resource represents an export job and contains the status of the job and the download URL, if the job is successfully completed. Export operations are asynchronous and will return "Export" resource in response . The export resource will contain the status of the export job (like in-process, completed...) . If the status is completed, it will contain the download url pointing to the zip/pdf containing the exported data. **Note:** At any given point, only 5 export jobs can be processed. Beyond that, an error stating that the API request limit has been reached will be returned. **Note:** Export operations are eventually consistent, so exported data might not reflect a recent write. For more information, see [Read consistency](https://docs.corsair.dev/docs/api/read-consistency). |

> [accordion] export full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   operation_type?: string | null,
>   mime_type?: string | null,
>   status?: string | null,
>   created_at?: number | null,
>   download?: {
>     download_url?: string | null,
>     valid_till?: number | null,
>     mime_type?: string | null
>   } | null
> } | null
> ```

***

### orders

`exports.orders`

Export orders. This API triggers export of order data. The exported zip file contains CSV files with order-related data.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.exports.orders({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `total` | `object` | No | optional, in cents filter Total amount charged for the order. **Supported operators :** is, is\_not, lt, lte, gt, gte, between **Example →** *total\\\[is\\] = "1394532759"* |
| `order` | `object` | No | Parameters for order |

> [accordion] total full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   lt?: string,
>   lte?: string,
>   gt?: string,
>   gte?: string,
>   between?: string
> }
> ```

> [accordion] order full type
>
> ```ts theme={null}
> {
>   id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   subscription_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     is_present?: true | false,
>     in?: string,
>     not_in?: string
>   },
>   customer_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   status?: {
>     is?: new | processing | complete | cancelled | voided | queued | awaiting_shipment | on_hold | delivered | shipped | partially_delivered | returned,
>     is_not?: new | processing | complete | cancelled | voided | queued | awaiting_shipment | on_hold | delivered | shipped | partially_delivered | returned,
>     in?: string,
>     not_in?: string
>   },
>   price_type?: {
>     is?: tax_exclusive | tax_inclusive,
>     is_not?: tax_exclusive | tax_inclusive,
>     in?: string,
>     not_in?: string
>   },
>   order_date?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   shipping_date?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   shipped_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   delivered_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   cancelled_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   amount_paid?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string
>   },
>   refundable_credits?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string
>   },
>   refundable_credits_issued?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string
>   },
>   updated_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   resent_status?: {
>     is?: fully_resent | partially_resent,
>     is_not?: fully_resent | partially_resent,
>     in?: string,
>     not_in?: string
>   },
>   is_resent?: {
>     is?: true | false
>   },
>   original_order_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `export` | `object \| null` | No | Export resource represents an export job and contains the status of the job and the download URL, if the job is successfully completed. Export operations are asynchronous and will return "Export" resource in response . The export resource will contain the status of the export job (like in-process, completed...) . If the status is completed, it will contain the download url pointing to the zip/pdf containing the exported data. **Note:** At any given point, only 5 export jobs can be processed. Beyond that, an error stating that the API request limit has been reached will be returned. **Note:** Export operations are eventually consistent, so exported data might not reflect a recent write. For more information, see [Read consistency](https://docs.corsair.dev/docs/api/read-consistency). |

> [accordion] export full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   operation_type?: string | null,
>   mime_type?: string | null,
>   status?: string | null,
>   created_at?: number | null,
>   download?: {
>     download_url?: string | null,
>     valid_till?: number | null,
>     mime_type?: string | null
>   } | null
> } | null
> ```

***

### plans

`exports.plans`

Export plans. This API triggers export of plan data. The exported zip file contains CSV files with plan-related data. Product Catalog 1.0 sites only.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.exports.plans({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `currency_code` | `object` | No | optional, string filter The currency code (ISO 4217 format) of the plan. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *currency\_code\\\[is\\] = "USD"* |
| `plan` | `object` | No | Parameters for plan |

> [accordion] currency\_code full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] plan full type
>
> ```ts theme={null}
> {
>   id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   name?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   price?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string
>   },
>   period?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string
>   },
>   period_unit?: {
>     is?: day | week | month | year,
>     is_not?: day | week | month | year,
>     in?: string,
>     not_in?: string
>   },
>   trial_period?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string,
>     is_present?: true | false
>   },
>   trial_period_unit?: {
>     is?: day | month,
>     is_not?: day | month,
>     in?: string,
>     not_in?: string
>   },
>   addon_applicability?: {
>     is?: all | restricted,
>     is_not?: all | restricted,
>     in?: string,
>     not_in?: string
>   },
>   giftable?: {
>     is?: true | false
>   },
>   status?: {
>     is?: active | archived | deleted,
>     is_not?: active | archived | deleted,
>     in?: string,
>     not_in?: string
>   },
>   updated_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   channel?: {
>     is?: web | app_store | play_store,
>     is_not?: web | app_store | play_store,
>     in?: string,
>     not_in?: string
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `export` | `object \| null` | No | Export resource represents an export job and contains the status of the job and the download URL, if the job is successfully completed. Export operations are asynchronous and will return "Export" resource in response . The export resource will contain the status of the export job (like in-process, completed...) . If the status is completed, it will contain the download url pointing to the zip/pdf containing the exported data. **Note:** At any given point, only 5 export jobs can be processed. Beyond that, an error stating that the API request limit has been reached will be returned. **Note:** Export operations are eventually consistent, so exported data might not reflect a recent write. For more information, see [Read consistency](https://docs.corsair.dev/docs/api/v2/pcv-1/read-consistency). |

> [accordion] export full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   operation_type?: string | null,
>   mime_type?: string | null,
>   status?: string | null,
>   created_at?: number | null,
>   download?: {
>     download_url?: string | null,
>     valid_till?: number | null,
>     mime_type?: string | null
>   } | null
> } | null
> ```

***

### priceVariants

`exports.priceVariants`

Export price variants. This API triggers export of price variant data. The exported zip file contains CSV files with price variant-related data.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.exports.priceVariants({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `business_entity_id` | `object` | No | optional, string filter The unique ID of the [business entity](https://docs.corsair.dev/docs/api/business_entities) of this `price_variant`. [Learn more](https://docs.corsair.dev/docs/api/using_business_entity_filters_in_product_catalog_list_apis) about all the scenarios before using this filter. **Supported operators :** is, is\_present **Example →** *business\_entity\_id\\\[is\_present\\] = "true"* |
| `include_site_level_resources` | `object` | No | optional, boolean filter Default value is `true` . To exclude site-level resources in [specific cases](), set this parameter to `false`. Possible values are : *true, false* **Supported operators :** is **Example →** *include\_site\_level\_resources\\\[is\\] = "null"* |
| `price_variant` | `object` | No | Parameters for price\_variant |

> [accordion] business\_entity\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_present?: true | false
> }
> ```

> [accordion] include\_site\_level\_resources full type
>
> ```ts theme={null}
> {
>   is?: true | false
> }
> ```

> [accordion] price\_variant full type
>
> ```ts theme={null}
> {
>   id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   name?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   status?: {
>     is?: active | archived,
>     is_not?: active | archived,
>     in?: string,
>     not_in?: string
>   },
>   updated_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   created_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `export` | `object \| null` | No | Export resource represents an export job and contains the status of the job and the download URL, if the job is successfully completed. Export operations are asynchronous and will return "Export" resource in response . The export resource will contain the status of the export job (like in-process, completed...) . If the status is completed, it will contain the download url pointing to the zip/pdf containing the exported data. **Note:** At any given point, only 5 export jobs can be processed. Beyond that, an error stating that the API request limit has been reached will be returned. **Note:** Export operations are eventually consistent, so exported data might not reflect a recent write. For more information, see [Read consistency](https://docs.corsair.dev/docs/api/read-consistency). |

> [accordion] export full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   operation_type?: string | null,
>   mime_type?: string | null,
>   status?: string | null,
>   created_at?: number | null,
>   download?: {
>     download_url?: string | null,
>     valid_till?: number | null,
>     mime_type?: string | null
>   } | null
> } | null
> ```

***

### ramps

`exports.ramps`

Export Subscription Ramps. Starts an export job for subscription ramps data. The exported zip file contains CSV files with ramp-related data. ### Best practice For a full data export, use filters to export in batches, as suggested in the samples below.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.exports.ramps({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `export_type` | `data \| import_friendly_data` | No | Determines the format of the data. Returns the export type based on the selected value. \* data - Provides the full set of data for the subscription ramps in multiple `.csv` files. \* import\_friendly\_data - Provides a `.csv` file whose columns match the [`ramp`](https://docs.corsair.dev/docs/api/ramps/ramp-object) schema. This file format can be readily imported through the UI by using [Bulk Operations](https://www.chargebee.com/docs/bulk-operations.html). |
| `ramp` | `object` | No | Parameters for ramp |

> [accordion] ramp full type
>
> ```ts theme={null}
> {
>   status?: {
>     is?: scheduled | succeeded | failed | draft,
>     in?: string
>   },
>   subscription_id?: {
>     is?: string,
>     in?: string
>   },
>   effective_from?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   updated_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `export` | `object \| null` | No | Export resource represents an export job and contains the status of the job and the download URL, if the job is successfully completed. Export operations are asynchronous and will return "Export" resource in response . The export resource will contain the status of the export job (like in-process, completed...) . If the status is completed, it will contain the download url pointing to the zip/pdf containing the exported data. **Note:** At any given point, only 5 export jobs can be processed. Beyond that, an error stating that the API request limit has been reached will be returned. **Note:** Export operations are eventually consistent, so exported data might not reflect a recent write. For more information, see [Read consistency](https://docs.corsair.dev/docs/api/read-consistency). |

> [accordion] export full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   operation_type?: string | null,
>   mime_type?: string | null,
>   status?: string | null,
>   created_at?: number | null,
>   download?: {
>     download_url?: string | null,
>     valid_till?: number | null,
>     mime_type?: string | null
>   } | null
> } | null
> ```

***

### revenueRecognition

`exports.revenueRecognition`

Export revenue recognition reports. Important: This report is deprecated. Therefore, the endpoint is also deprecated. This API triggers export for the revenue recognition report. Note: This API call is asynchronous. You need to check if this operation has completed by checking if the export status is completed .

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.exports.revenueRecognition({
	report_by: 'customer',
	report_from_month: 1,
	report_from_year: 1,
	report_to_month: 1,
	report_to_year: 1,
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `report_by` | `customer \| invoice \| product \| subscription` | Yes | Determines the scope of the report. Returns the report based on the value specified. \* subscription - Subscription \* invoice - Invoice \* product - Product (Includes Plan, Addon and Adhoc) \* customer - Customer |
| `currency_code` | `string` | No | Value must be in [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) format. Generates the report based on the value specified. If no currency\_code value is specified, then consolidated report based on base currency is returned. |
| `report_from_month` | `number` | Yes | Obtains report data from the specified month, combined with the value specified for report\_from\_year. Values must be between 1 and 12, where 1 is January and 12 is December. |
| `report_from_year` | `number` | Yes | Obtains report data from the specified year, combined with the value specified for report\_from\_month. |
| `report_to_month` | `number` | Yes | Obtains report data from the specified month, combined with the value specified for report\_to\_year. Values must be between 1 and 12, where 1 is January and 12 is December. |
| `report_to_year` | `number` | Yes | Obtains report data until the specified year, combined with the value specified for report\_to\_month. |
| `include_discounts` | `boolean` | No | Returns amount with discount in the report. If value specified is false, it returns amount without discount. |
| `payment_owner` | `object` | No | optional, string filter Payment owner of an invoice. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *payment\_owner\\\[is\\] = "payment\_customer"* |
| `item_id` | `object` | No | optional, string filter The plan item code. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *item\_id\\\[is\\] = "silver"* |
| `item_price_id` | `object` | No | optional, string filter The plan item price code. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *item\_price\_id\\\[is\\] = "silver-USD-monthly"* |
| `cancel_reason_code` | `object` | No | optional, string filter Reason code for canceling the subscription. Must be one from a list of reason codes set in the Chargebee app in **Settings \\> Configure Chargebee \\> Reason Codes \\> Subscriptions \\> Subscription Cancellation** . Must be passed if set as mandatory in the app. The codes are case-sensitive. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *cancel\_reason\_code\\\[is\\] = "Not Paid"* |
| `business_entity_id` | `object` | No | optional, string filter The unique ID of the [business entity](https://docs.corsair.dev/docs/api/getting-started) of this subscription. This is always the same as the [business entity](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#customer_id) of the customer. **Supported operators :** is, is\_not, starts\_with **Example →** *business\_entity\_id\\\[is\_not\\] = "business\_entity\_id"* |
| `invoice` | `object` | No | Parameters for invoice |
| `subscription` | `object` | No | Parameters for subscription |
| `customer` | `object` | No | Parameters for customer |
| `relationship` | `object` | No | Parameters for relationship |

> [accordion] payment\_owner full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] item\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] item\_price\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] cancel\_reason\_code full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] business\_entity\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string
> }
> ```

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   recurring?: {
>     is?: true | false
>   },
>   status?: {
>     is?: paid | posted | payment_due | not_paid | voided | pending,
>     is_not?: paid | posted | payment_due | not_paid | voided | pending,
>     in?: string,
>     not_in?: string
>   },
>   price_type?: {
>     is?: tax_exclusive | tax_inclusive,
>     is_not?: tax_exclusive | tax_inclusive,
>     in?: string,
>     not_in?: string
>   },
>   date?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   paid_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   total?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string
>   },
>   amount_paid?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string
>   },
>   amount_adjusted?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string
>   },
>   credits_applied?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string
>   },
>   amount_due?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string
>   },
>   dunning_status?: {
>     is?: in_progress | exhausted | stopped | success,
>     is_not?: in_progress | exhausted | stopped | success,
>     in?: string,
>     not_in?: string,
>     is_present?: true | false
>   },
>   updated_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   channel?: {
>     is?: web | app_store | play_store,
>     is_not?: web | app_store | play_store,
>     in?: string,
>     not_in?: string
>   }
> }
> ```

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   customer_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   status?: {
>     is?: future | in_trial | active | non_renewing | paused | cancelled | transferred,
>     is_not?: future | in_trial | active | non_renewing | paused | cancelled | transferred,
>     in?: string,
>     not_in?: string
>   },
>   cancel_reason?: {
>     is?: not_paid | no_card | fraud_review_failed | non_compliant_eu_customer | tax_calculation_failed | currency_incompatible_with_gateway | non_compliant_customer,
>     is_not?: not_paid | no_card | fraud_review_failed | non_compliant_eu_customer | tax_calculation_failed | currency_incompatible_with_gateway | non_compliant_customer,
>     in?: string,
>     not_in?: string,
>     is_present?: true | false
>   },
>   remaining_billing_cycles?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string,
>     is_present?: true | false
>   },
>   created_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   activated_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string,
>     is_present?: true | false
>   },
>   next_billing_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   cancelled_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   has_scheduled_changes?: {
>     is?: true | false
>   },
>   updated_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   offline_payment_method?: {
>     is?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
>     is_not?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
>     in?: string,
>     not_in?: string
>   },
>   auto_close_invoices?: {
>     is?: true | false
>   },
>   channel?: {
>     is?: web | app_store | play_store,
>     is_not?: web | app_store | play_store,
>     in?: string,
>     not_in?: string
>   }
> }
> ```

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   first_name?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     is_present?: true | false
>   },
>   last_name?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     is_present?: true | false
>   },
>   email?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     is_present?: true | false
>   },
>   company?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     is_present?: true | false
>   },
>   phone?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     is_present?: true | false
>   },
>   auto_collection?: {
>     is?: on | off,
>     is_not?: on | off,
>     in?: string,
>     not_in?: string
>   },
>   taxability?: {
>     is?: taxable | exempt | zero_rated,
>     is_not?: taxable | exempt | zero_rated,
>     in?: string,
>     not_in?: string
>   },
>   created_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   updated_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   offline_payment_method?: {
>     is?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
>     is_not?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
>     in?: string,
>     not_in?: string
>   },
>   auto_close_invoices?: {
>     is?: true | false
>   },
>   channel?: {
>     is?: web | app_store | play_store,
>     is_not?: web | app_store | play_store,
>     in?: string,
>     not_in?: string
>   }
> }
> ```

> [accordion] relationship full type
>
> ```ts theme={null}
> {
>   parent_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string
>   },
>   payment_owner_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string
>   },
>   invoice_owner_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `export` | `object \| null` | No | Export resource represents an export job and contains the status of the job and the download URL, if the job is successfully completed. Export operations are asynchronous and will return "Export" resource in response . The export resource will contain the status of the export job (like in-process, completed...) . If the status is completed, it will contain the download url pointing to the zip/pdf containing the exported data. **Note:** At any given point, only 5 export jobs can be processed. Beyond that, an error stating that the API request limit has been reached will be returned. **Note:** Export operations are eventually consistent, so exported data might not reflect a recent write. For more information, see [Read consistency](https://docs.corsair.dev/docs/api/read-consistency). |

> [accordion] export full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   operation_type?: string | null,
>   mime_type?: string | null,
>   status?: string | null,
>   created_at?: number | null,
>   download?: {
>     download_url?: string | null,
>     valid_till?: number | null,
>     mime_type?: string | null
>   } | null
> } | null
> ```

***

### subscriptions

`exports.subscriptions`

Export subscriptions. This API triggers export of subscription data. The exported zip file contains CSV files with subscription-related data.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.exports.subscriptions({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `export_type` | `data \| import_friendly_data` | No | Determines the format of the data. Returns the export type based on the selected value. \* data - Provides the full set of data for the subscriptions in multiple `.csv` files. \* import\_friendly\_data - Provides a `.csv` file whose columns match the [`subscription`](https://docs.corsair.dev/docs/api/subscriptions/subscription-object) schema. This file format can be readily imported through the UI by using [Bulk Operations](https://www.chargebee.com/docs/bulk-operations.html). |
| `item_id` | `object` | No | optional, string filter The plan item code. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *item\_id\\\[is\\] = "silver"* |
| `item_price_id` | `object` | No | optional, string filter The plan item price code. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *item\_price\_id\\\[is\\] = "silver-USD-monthly"* |
| `cancel_reason_code` | `object` | No | optional, string filter Reason code for canceling the subscription. Must be one from a list of reason codes set in the Chargebee app in **Settings \\> Configure Chargebee \\> Reason Codes \\> Subscriptions \\> Subscription Cancellation** . Must be passed if set as mandatory in the app. The codes are case-sensitive. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *cancel\_reason\_code\\\[is\\] = "Not Paid"* |
| `subscription` | `object` | No | Parameters for subscription |

> [accordion] item\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] item\_price\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] cancel\_reason\_code full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   customer_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   status?: {
>     is?: future | in_trial | active | non_renewing | paused | cancelled | transferred,
>     is_not?: future | in_trial | active | non_renewing | paused | cancelled | transferred,
>     in?: string,
>     not_in?: string
>   },
>   cancel_reason?: {
>     is?: not_paid | no_card | fraud_review_failed | non_compliant_eu_customer | tax_calculation_failed | currency_incompatible_with_gateway | non_compliant_customer,
>     is_not?: not_paid | no_card | fraud_review_failed | non_compliant_eu_customer | tax_calculation_failed | currency_incompatible_with_gateway | non_compliant_customer,
>     in?: string,
>     not_in?: string,
>     is_present?: true | false
>   },
>   remaining_billing_cycles?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string,
>     is_present?: true | false
>   },
>   created_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   activated_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string,
>     is_present?: true | false
>   },
>   next_billing_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   cancelled_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   has_scheduled_changes?: {
>     is?: true | false
>   },
>   updated_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   offline_payment_method?: {
>     is?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
>     is_not?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
>     in?: string,
>     not_in?: string
>   },
>   auto_close_invoices?: {
>     is?: true | false
>   },
>   channel?: {
>     is?: web | app_store | play_store,
>     is_not?: web | app_store | play_store,
>     in?: string,
>     not_in?: string
>   },
>   decommissioned?: {
>     is?: true | false
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `export` | `object \| null` | No | Export resource represents an export job and contains the status of the job and the download URL, if the job is successfully completed. Export operations are asynchronous and will return "Export" resource in response . The export resource will contain the status of the export job (like in-process, completed...) . If the status is completed, it will contain the download url pointing to the zip/pdf containing the exported data. **Note:** At any given point, only 5 export jobs can be processed. Beyond that, an error stating that the API request limit has been reached will be returned. **Note:** Export operations are eventually consistent, so exported data might not reflect a recent write. For more information, see [Read consistency](https://docs.corsair.dev/docs/api/read-consistency). |

> [accordion] export full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   operation_type?: string | null,
>   mime_type?: string | null,
>   status?: string | null,
>   created_at?: number | null,
>   download?: {
>     download_url?: string | null,
>     valid_till?: number | null,
>     mime_type?: string | null
>   } | null
> } | null
> ```

***

### transactions

`exports.transactions`

Export transactions. This API triggers export of transaction data. The exported zip file contains CSV files with transaction-related data.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.exports.transactions({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `transaction` | `object` | No | Parameters for transaction |

> [accordion] transaction full type
>
> ```ts theme={null}
> {
>   id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   customer_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     is_present?: true | false,
>     in?: string,
>     not_in?: string
>   },
>   subscription_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     is_present?: true | false,
>     in?: string,
>     not_in?: string
>   },
>   payment_source_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     is_present?: true | false,
>     in?: string,
>     not_in?: string
>   },
>   payment_method?: {
>     is?: card | cash | check | chargeback | bank_transfer | amazon_payments | paypal_express_checkout | direct_debit | alipay | unionpay | apple_pay | wechat_pay | ach_credit | sepa_credit | ideal | google_pay | sofort | bancontact | giropay | dotpay | other | upi | netbanking_emandates | custom | boleto | venmo | pay_to | faster_payments | sepa_instant_transfer | automated_bank_transfer | klarna_pay_now | online_banking_poland | payconiq_by_bancontact | electronic_payment_standard | kbc_payment_button | pay_by_bank | trustly | stablecoin | kakao_pay | naver_pay | revolut_pay | cash_app_pay | pix | twint | go_pay | grab_pay | pay_co | after_pay | swish | payme | klarna | alipay_hk | paypay | gcash | south_korean_cards | paynow | bizum | promptpay | dana | touch_n_go | tamara | qpay | ovo | momo | mercado_pago | nequi | nupay | picpay | thai_qr | blik | fpx | wero | p24 | affirm_pay | rakuten_pay,
>     is_not?: card | cash | check | chargeback | bank_transfer | amazon_payments | paypal_express_checkout | direct_debit | alipay | unionpay | apple_pay | wechat_pay | ach_credit | sepa_credit | ideal | google_pay | sofort | bancontact | giropay | dotpay | other | upi | netbanking_emandates | custom | boleto | venmo | pay_to | faster_payments | sepa_instant_transfer | automated_bank_transfer | klarna_pay_now | online_banking_poland | payconiq_by_bancontact | electronic_payment_standard | kbc_payment_button | pay_by_bank | trustly | stablecoin | kakao_pay | naver_pay | revolut_pay | cash_app_pay | pix | twint | go_pay | grab_pay | pay_co | after_pay | swish | payme | klarna | alipay_hk | paypay | gcash | south_korean_cards | paynow | bizum | promptpay | dana | touch_n_go | tamara | qpay | ovo | momo | mercado_pago | nequi | nupay | picpay | thai_qr | blik | fpx | wero | p24 | affirm_pay | rakuten_pay,
>     in?: string,
>     not_in?: string
>   },
>   gateway?: {
>     is?: chargebee | chargebee_payments | adyen | stripe | wepay | braintree | authorize_net | paypal_pro | pin | eway | eway_rapid | worldpay | balanced_payments | beanstream | bluepay | elavon | first_data_global | hdfc | migs | nmi | ogone | paymill | paypal_payflow_pro | sage_pay | tco | wirecard | amazon_payments | paypal_express_checkout | gocardless | orbital | moneris_us | moneris | bluesnap | cybersource | vantiv | checkout_com | paypal | ingenico_direct | exact | mollie | quickbooks | razorpay | global_payments | bank_of_america | ecentric | metrics_global | windcave | pay_com | ebanx | dlocal | nuvei | solidgate | paystack | jp_morgan | deutsche_bank | ezidebit | twikey | tempus | moyasar | payway | payu | not_applicable,
>     is_not?: chargebee | chargebee_payments | adyen | stripe | wepay | braintree | authorize_net | paypal_pro | pin | eway | eway_rapid | worldpay | balanced_payments | beanstream | bluepay | elavon | first_data_global | hdfc | migs | nmi | ogone | paymill | paypal_payflow_pro | sage_pay | tco | wirecard | amazon_payments | paypal_express_checkout | gocardless | orbital | moneris_us | moneris | bluesnap | cybersource | vantiv | checkout_com | paypal | ingenico_direct | exact | mollie | quickbooks | razorpay | global_payments | bank_of_america | ecentric | metrics_global | windcave | pay_com | ebanx | dlocal | nuvei | solidgate | paystack | jp_morgan | deutsche_bank | ezidebit | twikey | tempus | moyasar | payway | payu | not_applicable,
>     in?: string,
>     not_in?: string
>   },
>   gateway_account_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     in?: string,
>     not_in?: string
>   },
>   id_at_gateway?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string
>   },
>   reference_number?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string,
>     is_present?: true | false
>   },
>   type?: {
>     is?: authorization | payment | refund | payment_reversal,
>     is_not?: authorization | payment | refund | payment_reversal,
>     in?: string,
>     not_in?: string
>   },
>   date?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   },
>   amount?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string
>   },
>   amount_capturable?: {
>     is?: string,
>     is_not?: string,
>     lt?: string,
>     lte?: string,
>     gt?: string,
>     gte?: string,
>     between?: string
>   },
>   status?: {
>     is?: in_progress | success | voided | failure | timeout | needs_attention | late_failure,
>     is_not?: in_progress | success | voided | failure | timeout | needs_attention | late_failure,
>     in?: string,
>     not_in?: string
>   },
>   updated_at?: {
>     after?: string,
>     before?: string,
>     on?: string,
>     between?: string
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `export` | `object \| null` | No | Export resource represents an export job and contains the status of the job and the download URL, if the job is successfully completed. Export operations are asynchronous and will return "Export" resource in response . The export resource will contain the status of the export job (like in-process, completed...) . If the status is completed, it will contain the download url pointing to the zip/pdf containing the exported data. **Note:** At any given point, only 5 export jobs can be processed. Beyond that, an error stating that the API request limit has been reached will be returned. **Note:** Export operations are eventually consistent, so exported data might not reflect a recent write. For more information, see [Read consistency](https://docs.corsair.dev/docs/api/read-consistency). |

> [accordion] export full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   operation_type?: string | null,
>   mime_type?: string | null,
>   status?: string | null,
>   created_at?: number | null,
>   download?: {
>     download_url?: string | null,
>     valid_till?: number | null,
>     mime_type?: string | null
>   } | null
> } | null
> ```

***

## Features

### activate

`features.activate`

Activate a feature. Activates a draft feature so that any entitlements or subscription entitlements defined towards it take effect immediately. This operation changes the status of the feature to active. ### Prerequisites & Constraints \* Only a feature in draft status can be activated.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.features.activate({ featureId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `featureId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `feature` | `object \| null` | No | Subscriptions are created in Chargebee using items. Items represent the products or services that you offer to your customers. Items often differ in the number of product features that are available to them. The Features API helps you define the various features offered as part of your product line. It also defines the entitlements that items and subscriptions can have towards said features. **Note** The maximum number of features a site can have is 400. Features of this API -------------------- The Features API enables you to: \* Define the set of features provided by your product. \* Specify the entitlements that items have towards said features. \* For a given subscription, modify the entitlements inherited from items in the subscription. \* Offer additional feature entitlements to subscriptions than those inherited from items in the subscription. \* Serve as a source of truth to your provisioning systems for subscription entitlements. \* Use entitlement information to understand which features drive value and revenue. **See also** \* [Entitlements](https://docs.corsair.dev/docs/api/entitlements) \* [Subscription Entitlements](https://docs.corsair.dev/docs/api/subscription_entitlements) \* [Entitlement Overrides](https://docs.corsair.dev/docs/api/entitlement_overrides) |

> [accordion] feature full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   status?: string | null,
>   type?: string | null,
>   unit?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   metered?: boolean | null,
>   levels?: {
>     name?: string | null,
>     value?: string | null,
>     level?: number | null,
>     is_unlimited?: boolean | null
>   }[] | null
> } | null
> ```

***

### archive

`features.archive`

Archive a feature. Archives an active feature so that no new entitlements or subscription entitlements can be created towards the feature. Any pre-existing item or subscription entitlements from the time that the feature was active remain effective. This operation changes the status of the feature to archived.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.features.archive({ featureId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `featureId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `feature` | `object \| null` | No | Subscriptions are created in Chargebee using items. Items represent the products or services that you offer to your customers. Items often differ in the number of product features that are available to them. The Features API helps you define the various features offered as part of your product line. It also defines the entitlements that items and subscriptions can have towards said features. **Note** The maximum number of features a site can have is 400. Features of this API -------------------- The Features API enables you to: \* Define the set of features provided by your product. \* Specify the entitlements that items have towards said features. \* For a given subscription, modify the entitlements inherited from items in the subscription. \* Offer additional feature entitlements to subscriptions than those inherited from items in the subscription. \* Serve as a source of truth to your provisioning systems for subscription entitlements. \* Use entitlement information to understand which features drive value and revenue. **See also** \* [Entitlements](https://docs.corsair.dev/docs/api/entitlements) \* [Subscription Entitlements](https://docs.corsair.dev/docs/api/subscription_entitlements) \* [Entitlement Overrides](https://docs.corsair.dev/docs/api/entitlement_overrides) |

> [accordion] feature full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   status?: string | null,
>   type?: string | null,
>   unit?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   metered?: boolean | null,
>   levels?: {
>     name?: string | null,
>     value?: string | null,
>     level?: number | null,
>     is_unlimited?: boolean | null
>   }[] | null
> } | null
> ```

***

### create

`features.create`

Create a feature. Creates a new feature. Note: This operation creates non-metered features only. To create a metered feature, use the Create a metered feature operation.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.features.create({ name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `id` | `string` | No | A unique and immutable identifier for the feature. You can set it yourself, in which case it is recommended that a human-readable format (or slug) be used. For example, `number-of-users-ccjht01`. When not provided, a random value is automatically set. |
| `name` | `string` | Yes | A case-sensitive unique name for the feature. For example: `user license` , `data storage` , `Salesforce Integration` , `devices` , `UHD Streaming` , and so on. **Note:** This name is not displayed on any customer-facing documents or pages such as [invoice PDFs](https://docs.corsair.dev/docs/api/invoices/retrieve-invoice-as-pdf) or [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages). However, in the future, it is likely to be introduced on the [Self-Serve Portal](https://docs.corsair.dev/docs/api/portal_sessions) . |
| `description` | `string` | No | A brief description of the feature. For example: `Access to 10TB cloud storage` . |
| `type` | `switch \| custom \| quantity \| range` | No | The type of feature. \* quantity - The feature is quantity-based and entitlement levels available for it are a set of predefined number of quantity units. For example, a feature with `name` such as `number of users` can have entitlement levels of say, `5` , `20` , `50` , and `100`. `levels[is_unlimited]` is used for specifying the "unlimited" entitlement level. \* range - The feature is quantity-based and the entitlement levels available for it are the set of whole numbers within a range. The range is defined by a minimum and a maximum value. For example, a feature such as `number of users` can have entitlement levels starting at `5` users and go up to `50000`. `levels[is_unlimited]` is used for specifying the "unlimited" entitlement level. \* switch - A switch or toggle is a feature that an item or subscription can be either fully entitled to or not entitled to at all. \* custom - The entitlement levels available for this feature are defined as a set of custom values. For example, a feature `Email Support` can have entitlement levels as `24×7` and `24×5` . |
| `status` | `active \| draft` | No | The current status of the feature. \* active - A `draft` or an `archived` feature can be changed to `active`. Any [entitlements](https://docs.corsair.dev/docs/api/entitlements) or [subscription entitlements](https://docs.corsair.dev/docs/api/subscription_entitlements) defined for the feature take effect immediately. \* draft - The feature is in an unpublished state. [Entitlements](https://docs.corsair.dev/docs/api/entitlements) and [subscription entitlements](https://docs.corsair.dev/docs/api/subscription_entitlements) can be created for a draft feature but they are not effective until the feature is active. A feature `status` cannot be changed back to `draft` once it is in `active` or `archived` `status` . |
| `unit` | `string` | No | For features of `type` `quantity` or `range` , this specifies the unit of measure. The value is expected in the singular form and when used by the system, it is pluralized automatically as needed. For example, for a feature such as `user licenses` , the `unit` can be `license` . |
| `levels` | `object` | No | Parameters for levels |

> [accordion] levels full type
>
> ```ts theme={null}
> {
>   name?: string[],
>   value?: string[],
>   is_unlimited?: boolean[],
>   level?: number[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `feature` | `object \| null` | No | Subscriptions are created in Chargebee using items. Items represent the products or services that you offer to your customers. Items often differ in the number of product features that are available to them. The Features API helps you define the various features offered as part of your product line. It also defines the entitlements that items and subscriptions can have towards said features. **Note** The maximum number of features a site can have is 400. Features of this API -------------------- The Features API enables you to: \* Define the set of features provided by your product. \* Specify the entitlements that items have towards said features. \* For a given subscription, modify the entitlements inherited from items in the subscription. \* Offer additional feature entitlements to subscriptions than those inherited from items in the subscription. \* Serve as a source of truth to your provisioning systems for subscription entitlements. \* Use entitlement information to understand which features drive value and revenue. **See also** \* [Entitlements](https://docs.corsair.dev/docs/api/entitlements) \* [Subscription Entitlements](https://docs.corsair.dev/docs/api/subscription_entitlements) \* [Entitlement Overrides](https://docs.corsair.dev/docs/api/entitlement_overrides) |

> [accordion] feature full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   status?: string | null,
>   type?: string | null,
>   unit?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   metered?: boolean | null,
>   levels?: {
>     name?: string | null,
>     value?: string | null,
>     level?: number | null,
>     is_unlimited?: boolean | null
>   }[] | null
> } | null
> ```

***

### delete

`features.delete`

Delete a feature. Deletes a feature. Any entitlements and subscription entitlements defined for the feature are also removed. This action is not permissible when the status of the feature is active .

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.features.delete({ featureId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `featureId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `feature` | `object \| null` | No | Subscriptions are created in Chargebee using items. Items represent the products or services that you offer to your customers. Items often differ in the number of product features that are available to them. The Features API helps you define the various features offered as part of your product line. It also defines the entitlements that items and subscriptions can have towards said features. **Note** The maximum number of features a site can have is 400. Features of this API -------------------- The Features API enables you to: \* Define the set of features provided by your product. \* Specify the entitlements that items have towards said features. \* For a given subscription, modify the entitlements inherited from items in the subscription. \* Offer additional feature entitlements to subscriptions than those inherited from items in the subscription. \* Serve as a source of truth to your provisioning systems for subscription entitlements. \* Use entitlement information to understand which features drive value and revenue. **See also** \* [Entitlements](https://docs.corsair.dev/docs/api/entitlements) \* [Subscription Entitlements](https://docs.corsair.dev/docs/api/subscription_entitlements) \* [Entitlement Overrides](https://docs.corsair.dev/docs/api/entitlement_overrides) |

> [accordion] feature full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   status?: string | null,
>   type?: string | null,
>   unit?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   metered?: boolean | null,
>   levels?: {
>     name?: string | null,
>     value?: string | null,
>     level?: number | null,
>     is_unlimited?: boolean | null
>   }[] | null
> } | null
> ```

***

### get

`features.get`

Retrieve a feature. Retrieve a specific feature using its ID.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.features.get({ featureId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `featureId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `feature` | `object \| null` | No | Subscriptions are created in Chargebee using items. Items represent the products or services that you offer to your customers. Items often differ in the number of product features that are available to them. The Features API helps you define the various features offered as part of your product line. It also defines the entitlements that items and subscriptions can have towards said features. **Note** The maximum number of features a site can have is 400. Features of this API -------------------- The Features API enables you to: \* Define the set of features provided by your product. \* Specify the entitlements that items have towards said features. \* For a given subscription, modify the entitlements inherited from items in the subscription. \* Offer additional feature entitlements to subscriptions than those inherited from items in the subscription. \* Serve as a source of truth to your provisioning systems for subscription entitlements. \* Use entitlement information to understand which features drive value and revenue. **See also** \* [Entitlements](https://docs.corsair.dev/docs/api/entitlements) \* [Subscription Entitlements](https://docs.corsair.dev/docs/api/subscription_entitlements) \* [Entitlement Overrides](https://docs.corsair.dev/docs/api/entitlement_overrides) |

> [accordion] feature full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   status?: string | null,
>   type?: string | null,
>   unit?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   metered?: boolean | null,
>   levels?: {
>     name?: string | null,
>     value?: string | null,
>     level?: number | null,
>     is_unlimited?: boolean | null
>   }[] | null
> } | null
> ```

***

### list

`features.list`

List features. Retrieves a list of features meeting all the conditions specified in the filter parameters.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.features.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `name` | `object` | No | optional, string filter A case-sensitive unique name for the feature. For example: `user license` , `data storage` , `Salesforce Integration` , `devices` , `UHD Streaming` , and so on. **Note:** This name is not displayed on any customer-facing documents or pages such as [invoice PDFs](https://docs.corsair.dev/docs/api/invoices/retrieve-invoice-as-pdf) or [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages). However, in the future, it is likely to be introduced on the [Self-Serve Portal](https://docs.corsair.dev/docs/api/portal_sessions) . **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *name\\\[is\\] = "User licenses"* |
| `id` | `object` | No | optional, string filter A unique and immutable identifier for the feature. You can set it yourself, in which case it is recommended that a human-readable format (or slug) be used. For example, `number-of-users-ccjht01`. When not provided, a random value is automatically set. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *id\\\[is\\] = "fea-user-licenses"* |
| `status` | `object` | No | optional, enumerated string filter The current status of the feature. Possible values are : active, archived, draft. **Supported operators :** is, is\_not, in, not\_in **Example →** *status\\\[is\\] = "active"* |
| `type` | `object` | No | optional, enumerated string filter The type of feature. Possible values are : switch, custom, quantity, range. **Supported operators :** is, is\_not, in, not\_in **Example →** *type\\\[is\\] = "boolean"* |
| `metered` | `object` | No | optional, boolean filter Specifies whether the feature is a metered feature. **Supported operators :** is **Example →** *metered\\\[is\\] = "true"* |

> [accordion] name full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] status full type
>
> ```ts theme={null}
> {
>   is?: active | archived | draft,
>   is_not?: active | archived | draft,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] type full type
>
> ```ts theme={null}
> {
>   is?: switch | custom | quantity | range,
>   is_not?: switch | custom | quantity | range,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] metered full type
>
> ```ts theme={null}
> {
>   is?: true | false
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   feature?: {
>     id?: string | null,
>     name?: string | null,
>     description?: string | null,
>     status?: string | null,
>     type?: string | null,
>     unit?: string | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     created_at?: number | null,
>     metered?: boolean | null,
>     levels?: {
>       name?: string | null,
>       value?: string | null,
>       level?: number | null,
>       is_unlimited?: boolean | null
>     }[] | null
>   } | null
> }[] | null
> ```

***

### listItemEntitlements

`features.listItemEntitlements`

List item entitlements for a feature. Deprecated This operation is deprecated and no longer maintained. Migrate your integration to List entitlements. Retrieves a list of all the item\_entitlement s for the feature specified.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.features.listItemEntitlements({ featureId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `featureId` | `string` | Yes | — |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   item_entitlement?: {
>     id?: string | null,
>     item_id?: string | null,
>     item_type?: string | null,
>     feature_id?: string | null,
>     feature_name?: string | null,
>     value?: string | null,
>     name?: string | null
>   } | null
> }[] | null
> ```

***

### reactivate

`features.reactivate`

Reactivate a feature. Reactivates an archived feature so that new entitlements or subscription entitlements can be created towards the feature. This operation changes the status of the feature to active. ### Prerequisites & Constraints \* Only a feature in archived status can be reactivated.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.features.reactivate({ featureId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `featureId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `feature` | `object \| null` | No | Subscriptions are created in Chargebee using items. Items represent the products or services that you offer to your customers. Items often differ in the number of product features that are available to them. The Features API helps you define the various features offered as part of your product line. It also defines the entitlements that items and subscriptions can have towards said features. **Note** The maximum number of features a site can have is 400. Features of this API -------------------- The Features API enables you to: \* Define the set of features provided by your product. \* Specify the entitlements that items have towards said features. \* For a given subscription, modify the entitlements inherited from items in the subscription. \* Offer additional feature entitlements to subscriptions than those inherited from items in the subscription. \* Serve as a source of truth to your provisioning systems for subscription entitlements. \* Use entitlement information to understand which features drive value and revenue. **See also** \* [Entitlements](https://docs.corsair.dev/docs/api/entitlements) \* [Subscription Entitlements](https://docs.corsair.dev/docs/api/subscription_entitlements) \* [Entitlement Overrides](https://docs.corsair.dev/docs/api/entitlement_overrides) |

> [accordion] feature full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   status?: string | null,
>   type?: string | null,
>   unit?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   metered?: boolean | null,
>   levels?: {
>     name?: string | null,
>     value?: string | null,
>     level?: number | null,
>     is_unlimited?: boolean | null
>   }[] | null
> } | null
> ```

***

### update

`features.update`

Update a feature. Updates a specific feature. Note The list of objects levels\[] provided as part of this operation fully replaces the existing list of objects [levels\[\]](https://docs.corsair.dev/docs/api/features/feature-object#levels) of the feature.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.features.update({ featureId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `featureId` | `string` | Yes | — |
| `name` | `string` | No | A case-sensitive unique name for the feature. For example: `user license` , `data storage` , `Salesforce Integration` , `devices` , `UHD Streaming` , and so on. **Note:** This name is not displayed on any customer-facing documents or pages such as [invoice PDFs](https://docs.corsair.dev/docs/api/invoices/retrieve-invoice-as-pdf) or [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages). However, in the future, it is likely to be introduced on the [Self-Serve Portal](https://docs.corsair.dev/docs/api/portal_sessions) . |
| `description` | `string` | No | A brief description of the feature. For example: `Access to 10TB cloud storage` . |
| `status` | `active \| archived \| draft` | No | The current status of the feature. \* active - A `draft` or an `archived` feature can be changed to `active`. Any [entitlements](https://docs.corsair.dev/docs/api/entitlements) or [subscription entitlements](https://docs.corsair.dev/docs/api/subscription_entitlements) defined for the feature take effect immediately. \* draft - The feature is in an unpublished state. [Entitlements](https://docs.corsair.dev/docs/api/entitlements) and [subscription entitlements](https://docs.corsair.dev/docs/api/subscription_entitlements) can be created for a draft feature but they are not effective until the feature is active. A feature `status` cannot be changed back to `draft` once it is in `active` or `archived` `status` . \* archived - An `active` feature can be changed to `archived`. Once `archived` , no **new** [entitlements](https://docs.corsair.dev/docs/api/entitlements) or [subscription entitlements](https://docs.corsair.dev/docs/api/subscription_entitlements) can be created for the feature. However, any pre-existing item or subscription entitlements from the time that the feature was `active` , remain effective. |
| `unit` | `string` | No | For features of `type` `quantity` or `range` , this specifies the unit of measure. The value is expected in the singular form and when used by the system, it is pluralized automatically as needed. For example, for a feature such as `user licenses` , the `unit` can be `license` . |
| `levels` | `object` | No | Parameters for levels |

> [accordion] levels full type
>
> ```ts theme={null}
> {
>   name?: string[],
>   value?: string[],
>   is_unlimited?: boolean[],
>   level?: number[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `feature` | `object \| null` | No | Subscriptions are created in Chargebee using items. Items represent the products or services that you offer to your customers. Items often differ in the number of product features that are available to them. The Features API helps you define the various features offered as part of your product line. It also defines the entitlements that items and subscriptions can have towards said features. **Note** The maximum number of features a site can have is 400. Features of this API -------------------- The Features API enables you to: \* Define the set of features provided by your product. \* Specify the entitlements that items have towards said features. \* For a given subscription, modify the entitlements inherited from items in the subscription. \* Offer additional feature entitlements to subscriptions than those inherited from items in the subscription. \* Serve as a source of truth to your provisioning systems for subscription entitlements. \* Use entitlement information to understand which features drive value and revenue. **See also** \* [Entitlements](https://docs.corsair.dev/docs/api/entitlements) \* [Subscription Entitlements](https://docs.corsair.dev/docs/api/subscription_entitlements) \* [Entitlement Overrides](https://docs.corsair.dev/docs/api/entitlement_overrides) |

> [accordion] feature full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   status?: string | null,
>   type?: string | null,
>   unit?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   metered?: boolean | null,
>   levels?: {
>     name?: string | null,
>     value?: string | null,
>     level?: number | null,
>     is_unlimited?: boolean | null
>   }[] | null
> } | null
> ```

***

### upsertItemEntitlements

`features.upsertItemEntitlements`

Upsert or remove item entitlements for a feature. Deprecated This operation is deprecated and no longer maintained. Migrate your integration to Manage entitlements. Warning This operation is not supported when grandfathering is enabled. Upserts or removes a set of item\_entitlements for an feature depending on the action specified.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.features.upsertItemEntitlements({ featureId: 'example', action: 'upsert' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `featureId` | `string` | Yes | — |
| `action` | `upsert \| remove` | Yes | The specific action to be performed for each `item_entitlement` specified. \* remove - Deletes the `item_entitlement` for the `feature_id` and `item_id` combination, if it exists. \* upsert - If the `item_entitlement` already exists for the `feature_id` and `item_id` combination, the `value` of the `item_entitlement` is updated. If it doesn't exist, a new `item_entitelment` is created. |
| `item_entitlements` | `object` | No | Parameters for item\_entitlements |

> [accordion] item\_entitlements full type
>
> ```ts theme={null}
> {
>   item_id: string[],
>   item_type?: (plan | addon | charge | subscription | item)[],
>   value?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   item_entitlement?: {
>     id?: string | null,
>     item_id?: string | null,
>     item_type?: string | null,
>     feature_id?: string | null,
>     feature_name?: string | null,
>     value?: string | null,
>     name?: string | null
>   } | null
> }[] | null
> ```

***

## Full Exports

### getStatus

`fullExports.getStatus`

Retrieve full export status. This endpoint retrieves the status of your data export request.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.fullExports.getStatus({ table: 'example', date: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `table` | `string` | Yes | The name of the table for which the export status is to be retrieved. For example, invoices. |
| `date` | `string` | Yes | The date for which the export status is required, formatted in YYYY-MM-DD format. For example, 2023-08-29. |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `full_export` | `object \| null` | No | The Full Export API allows bulk download of various datasets from a secure location where data is loaded daily on a predefined schedule. Users can request dataset downloads by specifying the dataset name and date, among others. All the records of a given day (from 12:00 a.m. to 11:59 p.m. UTC) are available to query by the following day. The API responds with a download URL upon successful availability. |

> [accordion] full\_export full type
>
> ```ts theme={null}
> {
>   table?: string | null,
>   status?: string | null,
>   export_date?: string | null,
>   created_at?: number | null,
>   download?: {
>     download_url?: string | null,
>     valid_till?: number | null,
>     mime_type?: string | null
>   } | null
> } | null
> ```

***

## Gateway Request Logs

### get

`gatewayRequestLogs.get`

Retrieve a gateway request log. (GET /gateway\_request\_logs/\{gateway-request-log-log-id})

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.gatewayRequestLogs.get({ gatewayRequestLogLogId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `gatewayRequestLogLogId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `gateway_request_log` | `object \| null` | No | — |

> [accordion] gateway\_request\_log full type
>
> ```ts theme={null}
> {
>   log_id?: string | null,
>   url?: string | null,
>   status_code?: string | null,
>   method?: string | null,
>   request_body?: string | null,
>   response_body?: string | null,
>   request_headers?: string | null,
>   response_headers?: string | null,
>   gateway?: string | null,
>   customer_handle?: string | null,
>   invoice_handle?: string | null,
>   transaction_handle?: string | null,
>   payment_method_handle?: string | null,
>   gateway_credential_handle?: string | null,
>   payment_attempt_handle?: string | null,
>   payment_intent_handle?: string | null,
>   payment_method_name?: string | null,
>   operation_name?: string | null,
>   operation_type?: string | null,
>   action_type?: string | null,
>   source?: string | null,
>   trace_id_hash?: string | null,
>   invocation_time?: number | null,
>   response_received_at?: number | null,
>   response_time?: number | null
> } | null
> ```

***

### list

`gatewayRequestLogs.list`

List gateway request logs. (GET /gateway\_request\_logs)

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.gatewayRequestLogs.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set 'offset' to the value of 'next\_offset' obtained in the previous iteration of the API call. |
| `log_id` | `object` | No | This is a unique identifier assigned by open search. It is used to track the request within the Chargebee open search system |
| `gateway` | `object` | No | Payment Gateway through which the API call was made. |
| `status_code` | `object` | No | Http status code of the API call. |
| `method` | `object` | No | Http Method of the API call. |
| `url` | `object` | No | Third Party Gateway URL that was invoked. |
| `customer_handle` | `object` | No | Customer handle used in the API call. |
| `invoice_handle` | `object` | No | Invoice handle used in the API call. |
| `transaction_handle` | `object` | No | Transaction handle used in the API call. |
| `payment_method_handle` | `object` | No | Payment Method handle used in the API call. |
| `gateway_credential_handle` | `object` | No | Gateway Credential used for the API call. |
| `payment_attempt_handle` | `object` | No | Payment Attempt handle used in the API call. |
| `payment_intent_handle` | `object` | No | Payment Intent handle used in the API call. |
| `operation_name` | `object` | No | Name of the operation performed in the API call. |
| `operation_type` | `object` | No | Type of the operation performed in the API call. |
| `source` | `object` | No | Source of the API call (e.g., Chargebee App, OpenPay, etc.). |
| `invocation_time` | `object` | No | API invocation time in milliseconds. |
| `response_received_at` | `object` | No | Timestamp when response was received from Gateway. |
| `sort_by` | `object` | No | — |

> [accordion] log\_id full type
>
> ```ts theme={null}
> {
>   not_in?: string,
>   is_not?: string,
>   is?: string,
>   in?: string
> }
> ```

> [accordion] gateway full type
>
> ```ts theme={null}
> {
>   not_in?: string,
>   is_not?: string,
>   is?: string,
>   in?: string
> }
> ```

> [accordion] status\_code full type
>
> ```ts theme={null}
> {
>   not_in?: string,
>   is_not?: string,
>   is?: string,
>   in?: string
> }
> ```

> [accordion] method full type
>
> ```ts theme={null}
> {
>   not_in?: string,
>   is_not?: string,
>   is?: string,
>   in?: string
> }
> ```

> [accordion] url full type
>
> ```ts theme={null}
> {
>   not_in?: string,
>   is_not?: string,
>   is?: string,
>   in?: string
> }
> ```

> [accordion] customer\_handle full type
>
> ```ts theme={null}
> {
>   not_in?: string,
>   is_not?: string,
>   is?: string,
>   in?: string
> }
> ```

> [accordion] invoice\_handle full type
>
> ```ts theme={null}
> {
>   not_in?: string,
>   is_not?: string,
>   is?: string,
>   in?: string
> }
> ```

> [accordion] transaction\_handle full type
>
> ```ts theme={null}
> {
>   not_in?: string,
>   is_not?: string,
>   is?: string,
>   in?: string
> }
> ```

> [accordion] payment\_method\_handle full type
>
> ```ts theme={null}
> {
>   not_in?: string,
>   is_not?: string,
>   is?: string,
>   in?: string
> }
> ```

> [accordion] gateway\_credential\_handle full type
>
> ```ts theme={null}
> {
>   not_in?: string,
>   is_not?: string,
>   is?: string,
>   in?: string
> }
> ```

> [accordion] payment\_attempt\_handle full type
>
> ```ts theme={null}
> {
>   not_in?: string,
>   is_not?: string,
>   is?: string,
>   in?: string
> }
> ```

> [accordion] payment\_intent\_handle full type
>
> ```ts theme={null}
> {
>   not_in?: string,
>   is_not?: string,
>   is?: string,
>   in?: string
> }
> ```

> [accordion] operation\_name full type
>
> ```ts theme={null}
> {
>   not_in?: string,
>   is_not?: string,
>   is?: string,
>   in?: string
> }
> ```

> [accordion] operation\_type full type
>
> ```ts theme={null}
> {
>   not_in?: string,
>   is_not?: string,
>   is?: string,
>   in?: string
> }
> ```

> [accordion] source full type
>
> ```ts theme={null}
> {
>   not_in?: string,
>   is_not?: string,
>   is?: string,
>   in?: string
> }
> ```

> [accordion] invocation\_time full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] response\_received\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] sort\_by full type
>
> ```ts theme={null}
> {
>   asc?: invocation_time,
>   desc?: invocation_time
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   gateway_request_log?: {
>     log_id?: string | null,
>     url?: string | null,
>     status_code?: string | null,
>     method?: string | null,
>     request_body?: string | null,
>     response_body?: string | null,
>     request_headers?: string | null,
>     response_headers?: string | null,
>     gateway?: string | null,
>     customer_handle?: string | null,
>     invoice_handle?: string | null,
>     transaction_handle?: string | null,
>     payment_method_handle?: string | null,
>     gateway_credential_handle?: string | null,
>     payment_attempt_handle?: string | null,
>     payment_intent_handle?: string | null,
>     payment_method_name?: string | null,
>     operation_name?: string | null,
>     operation_type?: string | null,
>     action_type?: string | null,
>     source?: string | null,
>     trace_id_hash?: string | null,
>     invocation_time?: number | null,
>     response_received_at?: number | null,
>     response_time?: number | null
>   } | null
> }[] | null
> ```

***

## Gateway Webhook Logs

### get

`gatewayWebhookLogs.get`

Retrieve a gateway webhook log. (GET /gateway\_webhook\_logs/\{gateway-webhook-log-webhook-id})

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.gatewayWebhookLogs.get({ gatewayWebhookLogWebhookId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `gatewayWebhookLogWebhookId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `gateway_webhook_log` | `object \| null` | No | — |

> [accordion] gateway\_webhook\_log full type
>
> ```ts theme={null}
> {
>   webhook_id?: string | null,
>   url?: string | null,
>   method?: string | null,
>   status_code?: string | null,
>   gateway?: string | null,
>   id_at_gateway?: string | null,
>   customer_handle?: string | null,
>   invoice_handle?: string | null,
>   transaction_handle?: string | null,
>   payment_method_handle?: string | null,
>   gateway_credential_handle?: string | null,
>   payment_attempt_handle?: string | null,
>   payment_intent_handle?: string | null,
>   payment_method_name?: string | null,
>   request_body?: string | null,
>   response_body?: string | null,
>   request_headers?: string | null,
>   response_headers?: string | null,
>   received_at?: number | null,
>   response_time?: number | null
> } | null
> ```

***

### list

`gatewayWebhookLogs.list`

List gateway webhook logs. (GET /gateway\_webhook\_logs)

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.gatewayWebhookLogs.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set 'offset' to the value of 'next\_offset' obtained in the previous iteration of the API call. |
| `webhook_id` | `object` | No | Unique identifier for the webhook log in OpenSearch. |
| `gateway` | `object` | No | Payment gateway that sent the webhook. |
| `status_code` | `object` | No | HTTP status code returned in the webhook response. |
| `method` | `object` | No | HTTP method of the incoming webhook request. |
| `url` | `object` | No | URL from which the webhook request was received. |
| `id_at_gateway` | `object` | No | Gateway transaction reference from webhook metadata (e.g. Adyen originalReference or pspReference) for linking to transactions. |
| `customer_handle` | `object` | No | Customer handle resolved from the matched transaction or payment intent for UI deep links. |
| `invoice_handle` | `object` | No | Invoice number from the matched transaction when available. |
| `transaction_handle` | `object` | No | Chargebee transaction external\_id resolved from id\_at\_gateway for UI deep links. |
| `payment_method_handle` | `object` | No | Payment method external id from the matched transaction when available. |
| `gateway_credential_handle` | `object` | No | Gateway credential external id from the matched transaction or payment intent. |
| `payment_attempt_handle` | `object` | No | Payment attempt token or id resolved from id\_at\_gateway when no transaction match. |
| `payment_intent_handle` | `object` | No | Payment intent external id from the matched payment attempt when available. |
| `received_at` | `object` | No | Timestamp when the webhook was received. |
| `sort_by` | `object` | No | — |

> [accordion] webhook\_id full type
>
> ```ts theme={null}
> {
>   not_in?: string,
>   is_not?: string,
>   is?: string,
>   in?: string
> }
> ```

> [accordion] gateway full type
>
> ```ts theme={null}
> {
>   not_in?: string,
>   is_not?: string,
>   is?: string,
>   in?: string
> }
> ```

> [accordion] status\_code full type
>
> ```ts theme={null}
> {
>   not_in?: string,
>   is_not?: string,
>   is?: string,
>   in?: string
> }
> ```

> [accordion] method full type
>
> ```ts theme={null}
> {
>   not_in?: string,
>   is_not?: string,
>   is?: string,
>   in?: string
> }
> ```

> [accordion] url full type
>
> ```ts theme={null}
> {
>   not_in?: string,
>   is_not?: string,
>   is?: string,
>   in?: string
> }
> ```

> [accordion] id\_at\_gateway full type
>
> ```ts theme={null}
> {
>   not_in?: string,
>   is_not?: string,
>   is?: string,
>   in?: string
> }
> ```

> [accordion] customer\_handle full type
>
> ```ts theme={null}
> {
>   not_in?: string,
>   is_not?: string,
>   is?: string,
>   in?: string
> }
> ```

> [accordion] invoice\_handle full type
>
> ```ts theme={null}
> {
>   not_in?: string,
>   is_not?: string,
>   is?: string,
>   in?: string
> }
> ```

> [accordion] transaction\_handle full type
>
> ```ts theme={null}
> {
>   not_in?: string,
>   is_not?: string,
>   is?: string,
>   in?: string
> }
> ```

> [accordion] payment\_method\_handle full type
>
> ```ts theme={null}
> {
>   not_in?: string,
>   is_not?: string,
>   is?: string,
>   in?: string
> }
> ```

> [accordion] gateway\_credential\_handle full type
>
> ```ts theme={null}
> {
>   not_in?: string,
>   is_not?: string,
>   is?: string,
>   in?: string
> }
> ```

> [accordion] payment\_attempt\_handle full type
>
> ```ts theme={null}
> {
>   not_in?: string,
>   is_not?: string,
>   is?: string,
>   in?: string
> }
> ```

> [accordion] payment\_intent\_handle full type
>
> ```ts theme={null}
> {
>   not_in?: string,
>   is_not?: string,
>   is?: string,
>   in?: string
> }
> ```

> [accordion] received\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] sort\_by full type
>
> ```ts theme={null}
> {
>   asc?: received_at,
>   desc?: received_at
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   gateway_webhook_log?: {
>     webhook_id?: string | null,
>     url?: string | null,
>     method?: string | null,
>     status_code?: string | null,
>     gateway?: string | null,
>     id_at_gateway?: string | null,
>     customer_handle?: string | null,
>     invoice_handle?: string | null,
>     transaction_handle?: string | null,
>     payment_method_handle?: string | null,
>     gateway_credential_handle?: string | null,
>     payment_attempt_handle?: string | null,
>     payment_intent_handle?: string | null,
>     payment_method_name?: string | null,
>     request_body?: string | null,
>     response_body?: string | null,
>     request_headers?: string | null,
>     response_headers?: string | null,
>     received_at?: number | null,
>     response_time?: number | null
>   } | null
> }[] | null
> ```

***

## Gifts

### cancel

`gifts.cancel`

Cancel a gift. This API allows to cancel gifts. Only gift in 'scheduled' and 'unclaimed' states can be cancelled.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.gifts.cancel({ giftId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `giftId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `gift` | `object \| null` | No | Gift represents a subscription of a customer(**recipient** ) to a 'gift plan' which has been gifted by another customer(**gifter**). It may also have addons and coupons. Gift will be created only on immediate successful payment collection from the gifter's payment method. Gift is initially created in '**scheduled** ' state. The gift can be scheduled to be notified on a particular date to the recipient by passing 'scheduled\_at'. If not, the recipient is notified immediately. Gift will be moved to '**unclaimed** ' state on the date of notification. If you pass auto\_claim as true, gift status will be moved to '**claimed**' immediately, otherwise, the gift will remain 'unclaimed' till the recipient claims the gift. If the gift is not claimed before the claim\_expiry\_date, it will be moved to the '**expired**' state. #### GIFT SUBSCRIPTION Gift subscriptions will be created in '**future** ' state. Once the gift is claimed, the subscription will be moved to '**non-renewing**' state. #### INVOICE Gift subscriptions will be invoiced immediately. The invoice created has **is\_gifted** as 'true' and **term\_finalized** as 'false'. This is because initially the invoice term\_start and term\_end are set as the subscription's start\_date till the end of the plan period. Once the gift is claimed, the invoice's term\_finalized will be marked as 'true'. The term\_start will be changed to the actual invoice's term, which is the gift-claim date and the term\_end will be changed till plan's period. |
| `subscription` | `object \| null` | No | A Chargebee subscription connects a customer record to products/services. It describes what the customer has signed up for and how often they're charged for it. The essential components of a subscription are: \* A [plan-item price](https://docs.corsair.dev/docs/api/item_prices). \* Any addon- and charge-item prices applied to the subscription. \* Any [coupons](https://docs.corsair.dev/docs/api/coupons) applied. \* Any [discounts](https://docs.corsair.dev/docs/api/discounts) applied. The charges in a subscription are billed via invoices. **Note:** The maximum number of subscriptions for any given [customer](https://docs.corsair.dev/docs/api/customers) ([active](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#status) or not) is 900. #### Subscription billing frequencies Chargebee offers two billing frequency options for subscriptions: \* **Plan-based billing** (`default`): Subscriptions are billed based on the billing period defined for the item price of the `item_type` `plan`. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/subscriptions#plan-based-billing). \* **Multi-frequency billing** : Subscriptions are billed according to the billing period of each recurring item price within the subscription. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing). **Important** [Limitations](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing#limitations) of Multi-frequency billing. The selection of the billing frequency preference is configured at the site level. #### Item price compatibility in a subscription When creating or updating a subscription, one of the item prices specified under subscription\_items must be a plan-item price. The remaining must be compatible addon- or charge-item prices. An item price is compatible with a plan-item price if their currencies are the same. Additionally, an addon-item price is compatible with a plan-item price only if their billing frequencies meet the following conditions: \| `period_unit` for plan-item price \| Compatible `period_unit` for addon-item price \| Compatible period for addon-item price \| \|-----------------------------------\|-----------------------------------------------\|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `day` \| `day` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `10`, then the period of the addon-item price can be `10`, `5`, `2`, or `1`. \| \| `week` \| `week` or `day` \| The `period` (in days) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the period of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `week`, `period` can be `2` or `1`. \* for `period_unit` as `day`, `period` can be `14`, `7`, `2`, or `1`. \| \| `month` \| `month` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `6`, then the `period` of the addon-item price can be `6`, `3`, `2`, or `1`. \| \| `year` \| `year` or `month` \| The `period` (in months) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the `period` of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `year`, `period` can be `2` or `1`. \* for `period_unit` as `month`, `period` can be `24`, `12`, `8`, `6`, `4`, `3`, `2`, or `1`. \| #### Tax provider fields **Avalara** : Merchants using **Avalara Sales Tax** can optionally associate each item price with a locationCode (from their Avalara company locations), so tax can be resolved correctly at the line item level. \| Field ID \| Field Value \| APIs \| \|--------------------------------------------------------------------------------\|----------------------------------------------------------------------\|--------------------------------------------------------------------------------\| \| `locationCode` \| Merchant to configure it on Avalara Platform under company locations \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| **Anrok**: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation \| Field ID \| Field Value \| APIs \| \|---------------------------------------------------------------------------------------------------------------------------------------\|---------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------\| \| `additionalTaxRegistrationNumber` \| Canadian tax registration numbers in comma separated fashion. \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| **Vertex**: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration **Note:** Field Id like `customerCode` , `customerClass` , and`taxExempted` belong to the customer object. Field Id like `productCode` , `productClass` , `productTaxCode` , and `productClass` belong to the product object. \| Field ID \| Field Value \| APIs \| \|-----------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productCode` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `customerCode` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `customerClass` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **Taxamo:** Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration \| Field Id \| Field Value \| APIs \| \|------------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productTaxCode` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `taxExempted` \| Merchant to configure it on Taxamo Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **cbtaxes**: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India. \| Field ID \| Field Value \| APIs \| \|---------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `indiaSez` \| `SEZ_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaSez` \| `SEZ_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **All**: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level \| Field ID \| Field Value \| APIs \| \|-------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `priceType` \| `TAX_INCLUSIVE` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| \| `TAX_EXCLUSIVE` \| \| \| \| `SITE_DEFAULT` or blank \| Removes price type override, and allows site level configuration to be used for tax calculation. \| #### Ramps API compatibility mode If you want to schedule changes on a subscription, use the [Ramps API](https://docs.corsair.dev/docs/api/ramps). If you are currently scheduling changes through the [Update subscription API](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items), migrate to the Ramps API. To get started, [request access for Subscription Ramps](https://app.chargebee.com/login?forward=https://app.chargebee.com/request_access/subscription-ramps\&ref=feature). Chargebee will enable Ramps compatibility mode for your site. Once enabled, you can test the Ramps API without impacting your existing integrations. The following parts of the Billing API have subtle differences in behavior when the Ramps feature is disabled versus when it is enabled with compatibility mode. (Follow the links to learn more.) \* The value of the [`subscription.has_scheduled_changes`](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#has_scheduled_changes) attribute. \* [Update subscription](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#impact-scheduled-changes) \* [Create Checkout for updating a subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription#impact-scheduled-changes) \* [Remove scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/remove-scheduled-changes) \* [Retrieve with scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/retrieve-with-scheduled-changes) \* [Create a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/create-a-quote-for-update-subscription-items) \* [Edit a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/edit-update-subscription-quote-for-items) \* [Portal sessions](https://docs.corsair.dev/docs/api/portal_sessions#scheduled-subscription-changes) |

> [accordion] gift full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   status?: string | null,
>   scheduled_at?: number | null,
>   auto_claim?: boolean | null,
>   no_expiry?: boolean | null,
>   claim_expiry_date?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   gifter?: {
>     customer_id?: string | null,
>     invoice_id?: string | null,
>     signature?: string | null,
>     note?: string | null
>   } | null,
>   gift_receiver?: {
>     customer_id?: string | null,
>     subscription_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null
>   } | null,
>   gift_timelines?: {
>     status?: string | null,
>     occurred_at?: number | null
>   }[] | null
> } | null
> ```

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   currency_code?: string | null,
>   billing_period?: number | null,
>   billing_period_unit?: string | null,
>   start_date?: number | null,
>   trial_end?: number | null,
>   remaining_billing_cycles?: number | null,
>   po_number?: string | null,
>   auto_collection?: string | null,
>   plan_quantity_in_decimal?: string | null,
>   plan_unit_price_in_decimal?: string | null,
>   customer_id?: string | null,
>   status?: string | null,
>   trial_start?: number | null,
>   trial_end_action?: string | null,
>   current_term_start?: number | null,
>   current_term_end?: number | null,
>   next_billing_at?: number | null,
>   created_at?: number | null,
>   started_at?: number | null,
>   activated_at?: number | null,
>   contract_term_billing_cycle_on_renewal?: number | null,
>   override_relationship?: boolean | null,
>   pause_date?: number | null,
>   resume_date?: number | null,
>   cancelled_at?: number | null,
>   cancel_reason?: string | null,
>   created_from_ip?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   has_scheduled_advance_invoices?: boolean | null,
>   has_scheduled_changes?: boolean | null,
>   payment_source_id?: string | null,
>   plan_free_quantity_in_decimal?: string | null,
>   plan_amount_in_decimal?: string | null,
>   cancel_schedule_created_at?: number | null,
>   offline_payment_method?: string | null,
>   channel?: string | null,
>   net_term_days?: number | null,
>   active_id?: string | null,
>   due_invoices_count?: number | null,
>   due_since?: number | null,
>   total_dues?: number | null,
>   mrr?: number | null,
>   exchange_rate?: number | null,
>   base_currency_code?: string | null,
>   invoice_notes?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   changes_scheduled_at?: number | null,
>   cancel_reason_code?: string | null,
>   free_period?: number | null,
>   free_period_unit?: string | null,
>   create_pending_invoices?: boolean | null,
>   auto_close_invoices?: boolean | null,
>   business_entity_id?: string | null,
>   decommissioned?: boolean | null,
>   brand_id?: string | null,
>   subscription_items?: {
>     item_price_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     amount?: number | null,
>     current_term_start?: number | null,
>     current_term_end?: number | null,
>     next_billing_at?: number | null,
>     amount_in_decimal?: string | null,
>     billing_period?: number | null,
>     billing_period_unit?: string | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     trial_end?: number | null,
>     billing_cycles?: number | null,
>     service_period_days?: number | null,
>     charge_on_event?: string | null,
>     charge_once?: boolean | null,
>     charge_on_option?: string | null,
>     proration_type?: string | null,
>     usage_accumulation_reset_frequency?: string | null,
>     description?: string | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null,
>     index?: number | null
>   }[] | null,
>   charged_items?: {
>     item_price_id?: string | null,
>     last_charged_at?: number | null
>   }[] | null,
>   coupons?: {
>     coupon_id?: string | null,
>     apply_till?: number | null,
>     applied_count?: number | null,
>     coupon_code?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_info?: {
>     referral_code?: string | null,
>     coupon_code?: string | null,
>     referrer_id?: string | null,
>     external_reference_id?: string | null,
>     reward_status?: string | null,
>     referral_system?: string | null,
>     account_id?: string | null,
>     campaign_id?: string | null,
>     external_campaign_id?: string | null,
>     friend_offer_type?: string | null,
>     referrer_reward_type?: string | null,
>     notify_referral_system?: string | null,
>     destination_url?: string | null,
>     post_purchase_widget_enabled?: boolean | null
>   } | null,
>   billing_override?: {
>     max_excess_payment_usage?: number | null,
>     max_refundable_credits_usage?: number | null
>   } | null,
>   contract_term?: {
>     id?: string | null,
>     status?: string | null,
>     contract_start?: number | null,
>     contract_end?: number | null,
>     billing_cycle?: number | null,
>     action_at_term_end?: string | null,
>     total_contract_value?: number | null,
>     total_contract_value_before_tax?: number | null,
>     cancellation_cutoff_period?: number | null,
>     created_at?: number | null,
>     subscription_id?: string | null,
>     remaining_billing_cycles?: number | null
>   } | null,
>   discounts?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     description?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     quantity?: number | null,
>     currency_code?: string | null,
>     duration_type?: string | null,
>     period?: number | null,
>     period_unit?: string | null,
>     included_in_mrr?: boolean | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null,
>     apply_till?: number | null,
>     applied_count?: number | null,
>     coupon_id?: string | null,
>     index?: number | null
>   }[] | null
> } | null
> ```

***

### claim

`gifts.claim`

Claim a gift. Claiming a gift will move the status to 'claimed'. Only gifts in 'unclaimed' state can be claimed.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.gifts.claim({ giftId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `giftId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `gift` | `object \| null` | No | Gift represents a subscription of a customer(**recipient** ) to a 'gift plan' which has been gifted by another customer(**gifter**). It may also have addons and coupons. Gift will be created only on immediate successful payment collection from the gifter's payment method. Gift is initially created in '**scheduled** ' state. The gift can be scheduled to be notified on a particular date to the recipient by passing 'scheduled\_at'. If not, the recipient is notified immediately. Gift will be moved to '**unclaimed** ' state on the date of notification. If you pass auto\_claim as true, gift status will be moved to '**claimed**' immediately, otherwise, the gift will remain 'unclaimed' till the recipient claims the gift. If the gift is not claimed before the claim\_expiry\_date, it will be moved to the '**expired**' state. #### GIFT SUBSCRIPTION Gift subscriptions will be created in '**future** ' state. Once the gift is claimed, the subscription will be moved to '**non-renewing**' state. #### INVOICE Gift subscriptions will be invoiced immediately. The invoice created has **is\_gifted** as 'true' and **term\_finalized** as 'false'. This is because initially the invoice term\_start and term\_end are set as the subscription's start\_date till the end of the plan period. Once the gift is claimed, the invoice's term\_finalized will be marked as 'true'. The term\_start will be changed to the actual invoice's term, which is the gift-claim date and the term\_end will be changed till plan's period. |
| `subscription` | `object \| null` | No | A Chargebee subscription connects a customer record to products/services. It describes what the customer has signed up for and how often they're charged for it. The essential components of a subscription are: \* A [plan-item price](https://docs.corsair.dev/docs/api/item_prices). \* Any addon- and charge-item prices applied to the subscription. \* Any [coupons](https://docs.corsair.dev/docs/api/coupons) applied. \* Any [discounts](https://docs.corsair.dev/docs/api/discounts) applied. The charges in a subscription are billed via invoices. **Note:** The maximum number of subscriptions for any given [customer](https://docs.corsair.dev/docs/api/customers) ([active](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#status) or not) is 900. #### Subscription billing frequencies Chargebee offers two billing frequency options for subscriptions: \* **Plan-based billing** (`default`): Subscriptions are billed based on the billing period defined for the item price of the `item_type` `plan`. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/subscriptions#plan-based-billing). \* **Multi-frequency billing** : Subscriptions are billed according to the billing period of each recurring item price within the subscription. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing). **Important** [Limitations](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing#limitations) of Multi-frequency billing. The selection of the billing frequency preference is configured at the site level. #### Item price compatibility in a subscription When creating or updating a subscription, one of the item prices specified under subscription\_items must be a plan-item price. The remaining must be compatible addon- or charge-item prices. An item price is compatible with a plan-item price if their currencies are the same. Additionally, an addon-item price is compatible with a plan-item price only if their billing frequencies meet the following conditions: \| `period_unit` for plan-item price \| Compatible `period_unit` for addon-item price \| Compatible period for addon-item price \| \|-----------------------------------\|-----------------------------------------------\|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `day` \| `day` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `10`, then the period of the addon-item price can be `10`, `5`, `2`, or `1`. \| \| `week` \| `week` or `day` \| The `period` (in days) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the period of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `week`, `period` can be `2` or `1`. \* for `period_unit` as `day`, `period` can be `14`, `7`, `2`, or `1`. \| \| `month` \| `month` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `6`, then the `period` of the addon-item price can be `6`, `3`, `2`, or `1`. \| \| `year` \| `year` or `month` \| The `period` (in months) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the `period` of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `year`, `period` can be `2` or `1`. \* for `period_unit` as `month`, `period` can be `24`, `12`, `8`, `6`, `4`, `3`, `2`, or `1`. \| #### Tax provider fields **Avalara** : Merchants using **Avalara Sales Tax** can optionally associate each item price with a locationCode (from their Avalara company locations), so tax can be resolved correctly at the line item level. \| Field ID \| Field Value \| APIs \| \|--------------------------------------------------------------------------------\|----------------------------------------------------------------------\|--------------------------------------------------------------------------------\| \| `locationCode` \| Merchant to configure it on Avalara Platform under company locations \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| **Anrok**: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation \| Field ID \| Field Value \| APIs \| \|---------------------------------------------------------------------------------------------------------------------------------------\|---------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------\| \| `additionalTaxRegistrationNumber` \| Canadian tax registration numbers in comma separated fashion. \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| **Vertex**: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration **Note:** Field Id like `customerCode` , `customerClass` , and`taxExempted` belong to the customer object. Field Id like `productCode` , `productClass` , `productTaxCode` , and `productClass` belong to the product object. \| Field ID \| Field Value \| APIs \| \|-----------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productCode` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `customerCode` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `customerClass` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **Taxamo:** Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration \| Field Id \| Field Value \| APIs \| \|------------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productTaxCode` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `taxExempted` \| Merchant to configure it on Taxamo Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **cbtaxes**: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India. \| Field ID \| Field Value \| APIs \| \|---------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `indiaSez` \| `SEZ_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaSez` \| `SEZ_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **All**: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level \| Field ID \| Field Value \| APIs \| \|-------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `priceType` \| `TAX_INCLUSIVE` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| \| `TAX_EXCLUSIVE` \| \| \| \| `SITE_DEFAULT` or blank \| Removes price type override, and allows site level configuration to be used for tax calculation. \| #### Ramps API compatibility mode If you want to schedule changes on a subscription, use the [Ramps API](https://docs.corsair.dev/docs/api/ramps). If you are currently scheduling changes through the [Update subscription API](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items), migrate to the Ramps API. To get started, [request access for Subscription Ramps](https://app.chargebee.com/login?forward=https://app.chargebee.com/request_access/subscription-ramps\&ref=feature). Chargebee will enable Ramps compatibility mode for your site. Once enabled, you can test the Ramps API without impacting your existing integrations. The following parts of the Billing API have subtle differences in behavior when the Ramps feature is disabled versus when it is enabled with compatibility mode. (Follow the links to learn more.) \* The value of the [`subscription.has_scheduled_changes`](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#has_scheduled_changes) attribute. \* [Update subscription](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#impact-scheduled-changes) \* [Create Checkout for updating a subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription#impact-scheduled-changes) \* [Remove scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/remove-scheduled-changes) \* [Retrieve with scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/retrieve-with-scheduled-changes) \* [Create a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/create-a-quote-for-update-subscription-items) \* [Edit a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/edit-update-subscription-quote-for-items) \* [Portal sessions](https://docs.corsair.dev/docs/api/portal_sessions#scheduled-subscription-changes) |

> [accordion] gift full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   status?: string | null,
>   scheduled_at?: number | null,
>   auto_claim?: boolean | null,
>   no_expiry?: boolean | null,
>   claim_expiry_date?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   gifter?: {
>     customer_id?: string | null,
>     invoice_id?: string | null,
>     signature?: string | null,
>     note?: string | null
>   } | null,
>   gift_receiver?: {
>     customer_id?: string | null,
>     subscription_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null
>   } | null,
>   gift_timelines?: {
>     status?: string | null,
>     occurred_at?: number | null
>   }[] | null
> } | null
> ```

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   currency_code?: string | null,
>   billing_period?: number | null,
>   billing_period_unit?: string | null,
>   start_date?: number | null,
>   trial_end?: number | null,
>   remaining_billing_cycles?: number | null,
>   po_number?: string | null,
>   auto_collection?: string | null,
>   plan_quantity_in_decimal?: string | null,
>   plan_unit_price_in_decimal?: string | null,
>   customer_id?: string | null,
>   status?: string | null,
>   trial_start?: number | null,
>   trial_end_action?: string | null,
>   current_term_start?: number | null,
>   current_term_end?: number | null,
>   next_billing_at?: number | null,
>   created_at?: number | null,
>   started_at?: number | null,
>   activated_at?: number | null,
>   contract_term_billing_cycle_on_renewal?: number | null,
>   override_relationship?: boolean | null,
>   pause_date?: number | null,
>   resume_date?: number | null,
>   cancelled_at?: number | null,
>   cancel_reason?: string | null,
>   created_from_ip?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   has_scheduled_advance_invoices?: boolean | null,
>   has_scheduled_changes?: boolean | null,
>   payment_source_id?: string | null,
>   plan_free_quantity_in_decimal?: string | null,
>   plan_amount_in_decimal?: string | null,
>   cancel_schedule_created_at?: number | null,
>   offline_payment_method?: string | null,
>   channel?: string | null,
>   net_term_days?: number | null,
>   active_id?: string | null,
>   due_invoices_count?: number | null,
>   due_since?: number | null,
>   total_dues?: number | null,
>   mrr?: number | null,
>   exchange_rate?: number | null,
>   base_currency_code?: string | null,
>   invoice_notes?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   changes_scheduled_at?: number | null,
>   cancel_reason_code?: string | null,
>   free_period?: number | null,
>   free_period_unit?: string | null,
>   create_pending_invoices?: boolean | null,
>   auto_close_invoices?: boolean | null,
>   business_entity_id?: string | null,
>   decommissioned?: boolean | null,
>   brand_id?: string | null,
>   subscription_items?: {
>     item_price_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     amount?: number | null,
>     current_term_start?: number | null,
>     current_term_end?: number | null,
>     next_billing_at?: number | null,
>     amount_in_decimal?: string | null,
>     billing_period?: number | null,
>     billing_period_unit?: string | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     trial_end?: number | null,
>     billing_cycles?: number | null,
>     service_period_days?: number | null,
>     charge_on_event?: string | null,
>     charge_once?: boolean | null,
>     charge_on_option?: string | null,
>     proration_type?: string | null,
>     usage_accumulation_reset_frequency?: string | null,
>     description?: string | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null,
>     index?: number | null
>   }[] | null,
>   charged_items?: {
>     item_price_id?: string | null,
>     last_charged_at?: number | null
>   }[] | null,
>   coupons?: {
>     coupon_id?: string | null,
>     apply_till?: number | null,
>     applied_count?: number | null,
>     coupon_code?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_info?: {
>     referral_code?: string | null,
>     coupon_code?: string | null,
>     referrer_id?: string | null,
>     external_reference_id?: string | null,
>     reward_status?: string | null,
>     referral_system?: string | null,
>     account_id?: string | null,
>     campaign_id?: string | null,
>     external_campaign_id?: string | null,
>     friend_offer_type?: string | null,
>     referrer_reward_type?: string | null,
>     notify_referral_system?: string | null,
>     destination_url?: string | null,
>     post_purchase_widget_enabled?: boolean | null
>   } | null,
>   billing_override?: {
>     max_excess_payment_usage?: number | null,
>     max_refundable_credits_usage?: number | null
>   } | null,
>   contract_term?: {
>     id?: string | null,
>     status?: string | null,
>     contract_start?: number | null,
>     contract_end?: number | null,
>     billing_cycle?: number | null,
>     action_at_term_end?: string | null,
>     total_contract_value?: number | null,
>     total_contract_value_before_tax?: number | null,
>     cancellation_cutoff_period?: number | null,
>     created_at?: number | null,
>     subscription_id?: string | null,
>     remaining_billing_cycles?: number | null
>   } | null,
>   discounts?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     description?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     quantity?: number | null,
>     currency_code?: string | null,
>     duration_type?: string | null,
>     period?: number | null,
>     period_unit?: string | null,
>     included_in_mrr?: boolean | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null,
>     apply_till?: number | null,
>     applied_count?: number | null,
>     coupon_id?: string | null,
>     index?: number | null
>   }[] | null
> } | null
> ```

***

### create

`gifts.create`

Create a gift. Note: This operation optionally supports 3DS verification flow. To achieve the same, create the Payment Intent and pass it as input parameter to this API. Creates a gift subscription with the gifter and receiver. Only plans marked as gift plans can be used to create gift subscription. Product Catalog 1.0 sites only.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.gifts.create({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `scheduled_at` | `number` | No | Indicates the date on which the gift notification is sent to the receiver. If not passed, the receiver is notified immediately. |
| `auto_claim` | `boolean` | No | When `true` , the claim happens automatically. When not passed, the default value in the site settings is used. |
| `no_expiry` | `boolean` | No | When `true` , indicates that the gift does not expire. Do not pass or pass as `false` when `auto_claim` is set. . |
| `claim_expiry_date` | `number` | No | The date until which the gift can be claimed. Must be set to a value after `scheduled_at`. If the gift is not claimed within `claim_expiry_date` , it will expire and the subscription will move to `cancelled` state. When not passed, the value specified in the site settings will be used. Pass as `NULL` or do not pass when `auto_claim` or `no_expiry` are set. |
| `coupon_ids` | `string[]` | No | List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes. |
| `gifter` | `object` | No | Parameters for gifter |
| `gift_receiver` | `object` | No | Parameters for gift\_receiver |
| `payment_intent` | `object` | No | Parameters for payment\_intent |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `subscription` | `object` | No | Parameters for subscription |
| `addons` | `object` | No | Parameters for addons |

> [accordion] gifter full type
>
> ```ts theme={null}
> {
>   customer_id: string,
>   signature: string,
>   note?: string,
>   payment_src_id?: string
> }
> ```

> [accordion] gift\_receiver full type
>
> ```ts theme={null}
> {
>   customer_id: string,
>   first_name: string,
>   last_name: string,
>   email: string
> }
> ```

> [accordion] payment\_intent full type
>
> ```ts theme={null}
> {
>   id?: string,
>   gateway_account_id?: string,
>   gw_token?: string,
>   payment_method_type?: card | ideal | sofort | bancontact | google_pay | dotpay | giropay | apple_pay | upi | netbanking_emandates | paypal_express_checkout | direct_debit | boleto | venmo | amazon_payments | pay_to | faster_payments | sepa_instant_transfer | klarna_pay_now | online_banking_poland | payconiq_by_bancontact | electronic_payment_standard | kbc_payment_button | pay_by_bank | trustly | stablecoin | kakao_pay | naver_pay | revolut_pay | cash_app_pay | wechat_pay | alipay | twint | go_pay | grab_pay | pay_co | after_pay | swish | payme | pix | klarna | alipay_hk | paypay | gcash | south_korean_cards | paynow | bizum | promptpay | dana | touch_n_go | tamara | qpay | ovo | momo | mercado_pago | nequi | nupay | picpay | thai_qr | blik | fpx | wero | p24 | affirm_pay | rakuten_pay,
>   reference_id?: string,
>   additional_information?: {
>   }
> }
> ```

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   plan_id: string,
>   plan_quantity?: number,
>   plan_quantity_in_decimal?: string
> }
> ```

> [accordion] addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `gift` | `object \| null` | No | Gift represents a subscription of a customer(**recipient** ) to a 'gift plan' which has been gifted by another customer(**gifter**). It may also have addons and coupons. Gift will be created only on immediate successful payment collection from the gifter's payment method. Gift is initially created in '**scheduled** ' state. The gift can be scheduled to be notified on a particular date to the recipient by passing 'scheduled\_at'. If not, the recipient is notified immediately. Gift will be moved to '**unclaimed** ' state on the date of notification. If you pass auto\_claim as true, gift status will be moved to '**claimed**' immediately, otherwise, the gift will remain 'unclaimed' till the recipient claims the gift. If the gift is not claimed before the claim\_expiry\_date, it will be moved to the '**expired**' state. #### GIFT SUBSCRIPTION Gift subscriptions will be created in '**future** ' state. Once the gift is claimed, the subscription will be moved to '**non-renewing**' state. #### INVOICE Gift subscriptions will be invoiced immediately. The invoice created has **is\_gifted** as 'true' and **term\_finalized** as 'false'. This is because initially the invoice term\_start and term\_end are set as the subscription's start\_date till the end of the plan period. Once the gift is claimed, the invoice's term\_finalized will be marked as 'true'. The term\_start will be changed to the actual invoice's term, which is the gift-claim date and the term\_end will be changed till plan's period. |
| `subscription` | `object \| null` | No | Subscription represents the recurring items a customer has subscribed to. The recurring items can be - plan, addons. It may also contain the discount items like coupons. Subscriptions are invoiced at the start of every term based on the recurring items and charged immediately against the customer's credit card if 'auto\_collection' is turned 'on', otherwise the resulting invoice will be created as 'Payment Due'. **Note:** The maximum number of subscriptions for any given [customer](https://docs.corsair.dev/docs/api/customers) ([active](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#status) or not) is 900. Tax provider fields **Avalara** : Merchants using **Avalara Sales Tax** can optionally associate each item price with a locationCode (from their Avalara company locations), so tax can be resolved correctly at the line item level. \| Field ID \| Field Value \| APIs \| \|--------------------------------------------------------------------------------\|----------------------------------------------------------------------\|--------------------------------------------------------------------------------\| \| `locationCode` \| Merchant to configure it on Avalara Platform under company locations \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| **Anrok**: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation \| Field ID \| Field Value \| APIs \| \|---------------------------------------------------------------------------------------------------------------------------------------\|---------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------\| \| `additionalTaxRegistrationNumber` \| Canadian tax registration numbers in comma separated fashion. \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| **Vertex**: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration **Note:** Field Id like `customerCode` , `customerClass` , and`taxExempted` belong to the customer object. Field Id like `productCode` , `productClass` , `productTaxCode` , and `productClass` belong to the product object. \| Field ID \| Field Value \| APIs \| \|-----------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productCode` \| Merchant to configure it on Vertex Platform \| APIs having [Plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object)(PC1), [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object)(PC1) and [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object)(PC2) attributes. \| \| `productClass` \| Merchant to configure it on Vertex Platform \| APIs having [Plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object)(PC1), [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object)(PC1) and [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object)(PC2) attributes. \| \| `customerCode` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `customerClass` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **Taxamo:** Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration \| Field Id \| Field Value \| APIs \| \|------------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productTaxCode` \| Merchant to configure it on Taxamo Platform \| APIs having [Plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object)(PC1), [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object)(PC1) and Item Prices (PC2) attributes. \| \| `productClass` \| Merchant to configure it on Taxamo Platform \| APIs having [Plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object)(PC1), [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object)(PC1) and Item Prices (PC2) attributes. \| \| `taxExempted` \| Merchant to configure it on Taxamo Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **cbtaxes**: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India. \| Field ID \| Field Value \| APIs \| \|---------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `indiaSez` \| `SEZ_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaSez` \| `SEZ_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **All**: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level \| Field ID \| Field Value \| APIs \| \|-------------\|-----------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `priceType` \| `TAX_INCLUSIVE` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| \| `TAX_EXCLUSIVE` \| \| \| \| `SITE_DEFAULT` \| Removes price type override, and allows site level configuration to be used for tax calculation. \| **Note:** Make sure you choose the correct **Field ID** and **Available APIs** combination from the table above. All Product Catalog APIs include [Plans](https://docs.corsair.dev/docs/api/v2/pcv-1/plans) , [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons) , [Coupons](https://docs.corsair.dev/docs/api/v2/pcv-1/coupons) , [Coupon Sets](https://docs.corsair.dev/docs/api/v2/pcv-1/coupon_sets) , [Coupon Codes](https://docs.corsair.dev/docs/api/v2/pcv-1/coupon_codes) . |
| `invoice` | `object \| null` | No | Invoices are statements containing charges, adjustments and any discounts for a subscription specific to a term. For every subscription a draft invoice (upcoming invoice) is used to track all the charges, credits and adjustments for the current term. Generally, an invoice is closed at start of the next term. However, cancellation and other such operations on subscription may trigger premature closing. While closing the invoice, in addition to recurring charges, credits and coupons are applied to calculate the final amount that is due. When invoice is closed, an attempt to charge the credit card is made. If the payment succeeds, it is marked as **paid** . If the payment fails, the invoice is marked as **payment\_due** and retry settings are taken into account. If no retry attempts are configured, the invoice is marked as **not\_paid** . If the amount due is zero or negative, the invoice is immediately marked as **paid** and the balance if any is carried forward to the next term of the invoice. **Note:** If *consolidated invoicing* is enabled, the attribute *invoice.subscription\_id* should **not** be used (as it will not be present if the invoice has lines from multiple subscriptions). Instead to know the related subscriptions, their [line\_items](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) *subscription\_id* attribute should be referred. |

> [accordion] gift full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   status?: string | null,
>   scheduled_at?: number | null,
>   auto_claim?: boolean | null,
>   no_expiry?: boolean | null,
>   claim_expiry_date?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   gifter?: {
>     customer_id?: string | null,
>     invoice_id?: string | null,
>     signature?: string | null,
>     note?: string | null
>   } | null,
>   gift_receiver?: {
>     customer_id?: string | null,
>     subscription_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null
>   } | null,
>   gift_timelines?: {
>     status?: string | null,
>     occurred_at?: number | null
>   }[] | null
> } | null
> ```

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   currency_code?: string | null,
>   plan_id?: string | null,
>   plan_quantity?: number | null,
>   plan_unit_price?: number | null,
>   setup_fee?: number | null,
>   billing_period?: number | null,
>   billing_period_unit?: string | null,
>   start_date?: number | null,
>   trial_end?: number | null,
>   remaining_billing_cycles?: number | null,
>   po_number?: string | null,
>   auto_collection?: string | null,
>   plan_quantity_in_decimal?: string | null,
>   plan_unit_price_in_decimal?: string | null,
>   customer_id?: string | null,
>   plan_amount?: number | null,
>   plan_free_quantity?: number | null,
>   status?: string | null,
>   trial_start?: number | null,
>   trial_end_action?: string | null,
>   current_term_start?: number | null,
>   current_term_end?: number | null,
>   next_billing_at?: number | null,
>   created_at?: number | null,
>   started_at?: number | null,
>   activated_at?: number | null,
>   gift_id?: string | null,
>   contract_term_billing_cycle_on_renewal?: number | null,
>   override_relationship?: boolean | null,
>   pause_date?: number | null,
>   resume_date?: number | null,
>   cancelled_at?: number | null,
>   cancel_reason?: string | null,
>   affiliate_token?: string | null,
>   created_from_ip?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   has_scheduled_advance_invoices?: boolean | null,
>   has_scheduled_changes?: boolean | null,
>   payment_source_id?: string | null,
>   plan_free_quantity_in_decimal?: string | null,
>   plan_amount_in_decimal?: string | null,
>   cancel_schedule_created_at?: number | null,
>   offline_payment_method?: string | null,
>   channel?: string | null,
>   active_id?: string | null,
>   due_invoices_count?: number | null,
>   due_since?: number | null,
>   total_dues?: number | null,
>   mrr?: number | null,
>   exchange_rate?: number | null,
>   base_currency_code?: string | null,
>   invoice_notes?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   changes_scheduled_at?: number | null,
>   cancel_reason_code?: string | null,
>   free_period?: number | null,
>   free_period_unit?: string | null,
>   create_pending_invoices?: boolean | null,
>   auto_close_invoices?: boolean | null,
>   business_entity_id?: string | null,
>   decommissioned?: boolean | null,
>   brand_id?: string | null,
>   addons?: {
>     id?: string | null,
>     quantity?: number | null,
>     unit_price?: number | null,
>     amount?: number | null,
>     trial_end?: number | null,
>     remaining_billing_cycles?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     proration_type?: string | null
>   }[] | null,
>   event_based_addons?: {
>     id?: string | null,
>     quantity?: number | null,
>     unit_price?: number | null,
>     on_event?: string | null,
>     charge_once?: boolean | null,
>     quantity_in_decimal?: string | null,
>     unit_price_in_decimal?: string | null
>   }[] | null,
>   charged_event_based_addons?: {
>     id?: string | null,
>     last_charged_at?: number | null
>   }[] | null,
>   coupons?: {
>     coupon_id?: string | null,
>     apply_till?: number | null,
>     applied_count?: number | null,
>     coupon_code?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_info?: {
>     referral_code?: string | null,
>     coupon_code?: string | null,
>     referrer_id?: string | null,
>     external_reference_id?: string | null,
>     reward_status?: string | null,
>     referral_system?: string | null,
>     account_id?: string | null,
>     campaign_id?: string | null,
>     external_campaign_id?: string | null,
>     friend_offer_type?: string | null,
>     referrer_reward_type?: string | null,
>     notify_referral_system?: string | null,
>     destination_url?: string | null,
>     post_purchase_widget_enabled?: boolean | null
>   } | null,
>   contract_term?: {
>     id?: string | null,
>     status?: string | null,
>     contract_start?: number | null,
>     contract_end?: number | null,
>     billing_cycle?: number | null,
>     action_at_term_end?: string | null,
>     total_contract_value?: number | null,
>     total_contract_value_before_tax?: number | null,
>     cancellation_cutoff_period?: number | null,
>     created_at?: number | null,
>     subscription_id?: string | null,
>     remaining_billing_cycles?: number | null
>   } | null
> } | null
> ```

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### createForItems

`gifts.createForItems`

Create a gift subscription for items. Create a gift subscription with items like plans, addons, or charges and gift it to an existing customer.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.gifts.createForItems({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `scheduled_at` | `number` | No | Indicates the date on which the gift notification is sent to the receiver. If not passed, the receiver is notified immediately. |
| `auto_claim` | `boolean` | No | When `true` , the claim happens automatically. When not passed, the default value in the site settings is used. |
| `no_expiry` | `boolean` | No | When `true` , indicates that the gift does not expire. Do not pass or pass as `false` when `auto_claim` is set. . |
| `claim_expiry_date` | `number` | No | The date until which the gift can be claimed. Must be set to a value after `scheduled_at`. If the gift is not claimed within `claim_expiry_date` , it will expire and the subscription will move to `cancelled` state. When not passed, the value specified in the site settings will be used. Pass as `NULL` or do not pass when `auto_claim` or `no_expiry` are set. |
| `coupon_ids` | `string[]` | No | List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes. |
| `meta_data` | `object` | No | A [collection of key-value pairs](https://docs.corsair.dev/docs/api/advanced-features) that provides extra information about the subscription. **Constraints** \* Character limit: 65,535. |
| `gifter` | `object` | No | Parameters for gifter |
| `gift_receiver` | `object` | No | Parameters for gift\_receiver |
| `payment_intent` | `object` | No | Parameters for payment\_intent |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `subscription_items` | `object` | No | Parameters for subscription\_items |
| `item_tiers` | `object` | No | Parameters for item\_tiers |

> [accordion] meta\_data full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] gifter full type
>
> ```ts theme={null}
> {
>   customer_id: string,
>   signature: string,
>   note?: string,
>   payment_src_id?: string
> }
> ```

> [accordion] gift\_receiver full type
>
> ```ts theme={null}
> {
>   customer_id: string,
>   first_name: string,
>   last_name: string,
>   email: string
> }
> ```

> [accordion] payment\_intent full type
>
> ```ts theme={null}
> {
>   id?: string,
>   gateway_account_id?: string,
>   gw_token?: string,
>   payment_method_type?: card | ideal | sofort | bancontact | google_pay | dotpay | giropay | apple_pay | upi | netbanking_emandates | paypal_express_checkout | direct_debit | boleto | venmo | amazon_payments | pay_to | faster_payments | sepa_instant_transfer | klarna_pay_now | online_banking_poland | payconiq_by_bancontact | electronic_payment_standard | kbc_payment_button | pay_by_bank | trustly | stablecoin | kakao_pay | naver_pay | revolut_pay | cash_app_pay | wechat_pay | alipay | twint | go_pay | grab_pay | pay_co | after_pay | swish | payme | pix | klarna | alipay_hk | paypay | gcash | south_korean_cards | paynow | bizum | promptpay | dana | touch_n_go | tamara | qpay | ovo | momo | mercado_pago | nequi | nupay | picpay | thai_qr | blik | fpx | wero | p24 | affirm_pay | rakuten_pay,
>   reference_id?: string,
>   additional_information?: {
>   }
> }
> ```

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] subscription\_items full type
>
> ```ts theme={null}
> {
>   item_price_id?: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   unit_price?: number[],
>   unit_price_in_decimal?: string[]
> }
> ```

> [accordion] item\_tiers full type
>
> ```ts theme={null}
> {
>   item_price_id?: string[],
>   starting_unit?: number[],
>   ending_unit?: number[],
>   price?: number[],
>   starting_unit_in_decimal?: string[],
>   ending_unit_in_decimal?: string[],
>   price_in_decimal?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `gift` | `object \| null` | No | Gift represents a subscription of a customer(**recipient** ) to a 'gift plan' which has been gifted by another customer(**gifter**). It may also have addons and coupons. Gift will be created only on immediate successful payment collection from the gifter's payment method. Gift is initially created in '**scheduled** ' state. The gift can be scheduled to be notified on a particular date to the recipient by passing 'scheduled\_at'. If not, the recipient is notified immediately. Gift will be moved to '**unclaimed** ' state on the date of notification. If you pass auto\_claim as true, gift status will be moved to '**claimed**' immediately, otherwise, the gift will remain 'unclaimed' till the recipient claims the gift. If the gift is not claimed before the claim\_expiry\_date, it will be moved to the '**expired**' state. #### GIFT SUBSCRIPTION Gift subscriptions will be created in '**future** ' state. Once the gift is claimed, the subscription will be moved to '**non-renewing**' state. #### INVOICE Gift subscriptions will be invoiced immediately. The invoice created has **is\_gifted** as 'true' and **term\_finalized** as 'false'. This is because initially the invoice term\_start and term\_end are set as the subscription's start\_date till the end of the plan period. Once the gift is claimed, the invoice's term\_finalized will be marked as 'true'. The term\_start will be changed to the actual invoice's term, which is the gift-claim date and the term\_end will be changed till plan's period. |
| `subscription` | `object \| null` | No | A Chargebee subscription connects a customer record to products/services. It describes what the customer has signed up for and how often they're charged for it. The essential components of a subscription are: \* A [plan-item price](https://docs.corsair.dev/docs/api/item_prices). \* Any addon- and charge-item prices applied to the subscription. \* Any [coupons](https://docs.corsair.dev/docs/api/coupons) applied. \* Any [discounts](https://docs.corsair.dev/docs/api/discounts) applied. The charges in a subscription are billed via invoices. **Note:** The maximum number of subscriptions for any given [customer](https://docs.corsair.dev/docs/api/customers) ([active](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#status) or not) is 900. #### Subscription billing frequencies Chargebee offers two billing frequency options for subscriptions: \* **Plan-based billing** (`default`): Subscriptions are billed based on the billing period defined for the item price of the `item_type` `plan`. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/subscriptions#plan-based-billing). \* **Multi-frequency billing** : Subscriptions are billed according to the billing period of each recurring item price within the subscription. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing). **Important** [Limitations](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing#limitations) of Multi-frequency billing. The selection of the billing frequency preference is configured at the site level. #### Item price compatibility in a subscription When creating or updating a subscription, one of the item prices specified under subscription\_items must be a plan-item price. The remaining must be compatible addon- or charge-item prices. An item price is compatible with a plan-item price if their currencies are the same. Additionally, an addon-item price is compatible with a plan-item price only if their billing frequencies meet the following conditions: \| `period_unit` for plan-item price \| Compatible `period_unit` for addon-item price \| Compatible period for addon-item price \| \|-----------------------------------\|-----------------------------------------------\|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `day` \| `day` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `10`, then the period of the addon-item price can be `10`, `5`, `2`, or `1`. \| \| `week` \| `week` or `day` \| The `period` (in days) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the period of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `week`, `period` can be `2` or `1`. \* for `period_unit` as `day`, `period` can be `14`, `7`, `2`, or `1`. \| \| `month` \| `month` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `6`, then the `period` of the addon-item price can be `6`, `3`, `2`, or `1`. \| \| `year` \| `year` or `month` \| The `period` (in months) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the `period` of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `year`, `period` can be `2` or `1`. \* for `period_unit` as `month`, `period` can be `24`, `12`, `8`, `6`, `4`, `3`, `2`, or `1`. \| #### Tax provider fields **Avalara** : Merchants using **Avalara Sales Tax** can optionally associate each item price with a locationCode (from their Avalara company locations), so tax can be resolved correctly at the line item level. \| Field ID \| Field Value \| APIs \| \|--------------------------------------------------------------------------------\|----------------------------------------------------------------------\|--------------------------------------------------------------------------------\| \| `locationCode` \| Merchant to configure it on Avalara Platform under company locations \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| **Anrok**: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation \| Field ID \| Field Value \| APIs \| \|---------------------------------------------------------------------------------------------------------------------------------------\|---------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------\| \| `additionalTaxRegistrationNumber` \| Canadian tax registration numbers in comma separated fashion. \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| **Vertex**: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration **Note:** Field Id like `customerCode` , `customerClass` , and`taxExempted` belong to the customer object. Field Id like `productCode` , `productClass` , `productTaxCode` , and `productClass` belong to the product object. \| Field ID \| Field Value \| APIs \| \|-----------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productCode` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `customerCode` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `customerClass` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **Taxamo:** Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration \| Field Id \| Field Value \| APIs \| \|------------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productTaxCode` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `taxExempted` \| Merchant to configure it on Taxamo Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **cbtaxes**: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India. \| Field ID \| Field Value \| APIs \| \|---------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `indiaSez` \| `SEZ_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaSez` \| `SEZ_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **All**: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level \| Field ID \| Field Value \| APIs \| \|-------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `priceType` \| `TAX_INCLUSIVE` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| \| `TAX_EXCLUSIVE` \| \| \| \| `SITE_DEFAULT` or blank \| Removes price type override, and allows site level configuration to be used for tax calculation. \| #### Ramps API compatibility mode If you want to schedule changes on a subscription, use the [Ramps API](https://docs.corsair.dev/docs/api/ramps). If you are currently scheduling changes through the [Update subscription API](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items), migrate to the Ramps API. To get started, [request access for Subscription Ramps](https://app.chargebee.com/login?forward=https://app.chargebee.com/request_access/subscription-ramps\&ref=feature). Chargebee will enable Ramps compatibility mode for your site. Once enabled, you can test the Ramps API without impacting your existing integrations. The following parts of the Billing API have subtle differences in behavior when the Ramps feature is disabled versus when it is enabled with compatibility mode. (Follow the links to learn more.) \* The value of the [`subscription.has_scheduled_changes`](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#has_scheduled_changes) attribute. \* [Update subscription](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#impact-scheduled-changes) \* [Create Checkout for updating a subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription#impact-scheduled-changes) \* [Remove scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/remove-scheduled-changes) \* [Retrieve with scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/retrieve-with-scheduled-changes) \* [Create a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/create-a-quote-for-update-subscription-items) \* [Edit a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/edit-update-subscription-quote-for-items) \* [Portal sessions](https://docs.corsair.dev/docs/api/portal_sessions#scheduled-subscription-changes) |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |

> [accordion] gift full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   status?: string | null,
>   scheduled_at?: number | null,
>   auto_claim?: boolean | null,
>   no_expiry?: boolean | null,
>   claim_expiry_date?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   gifter?: {
>     customer_id?: string | null,
>     invoice_id?: string | null,
>     signature?: string | null,
>     note?: string | null
>   } | null,
>   gift_receiver?: {
>     customer_id?: string | null,
>     subscription_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null
>   } | null,
>   gift_timelines?: {
>     status?: string | null,
>     occurred_at?: number | null
>   }[] | null
> } | null
> ```

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   currency_code?: string | null,
>   billing_period?: number | null,
>   billing_period_unit?: string | null,
>   start_date?: number | null,
>   trial_end?: number | null,
>   remaining_billing_cycles?: number | null,
>   po_number?: string | null,
>   auto_collection?: string | null,
>   plan_quantity_in_decimal?: string | null,
>   plan_unit_price_in_decimal?: string | null,
>   customer_id?: string | null,
>   status?: string | null,
>   trial_start?: number | null,
>   trial_end_action?: string | null,
>   current_term_start?: number | null,
>   current_term_end?: number | null,
>   next_billing_at?: number | null,
>   created_at?: number | null,
>   started_at?: number | null,
>   activated_at?: number | null,
>   contract_term_billing_cycle_on_renewal?: number | null,
>   override_relationship?: boolean | null,
>   pause_date?: number | null,
>   resume_date?: number | null,
>   cancelled_at?: number | null,
>   cancel_reason?: string | null,
>   created_from_ip?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   has_scheduled_advance_invoices?: boolean | null,
>   has_scheduled_changes?: boolean | null,
>   payment_source_id?: string | null,
>   plan_free_quantity_in_decimal?: string | null,
>   plan_amount_in_decimal?: string | null,
>   cancel_schedule_created_at?: number | null,
>   offline_payment_method?: string | null,
>   channel?: string | null,
>   net_term_days?: number | null,
>   active_id?: string | null,
>   due_invoices_count?: number | null,
>   due_since?: number | null,
>   total_dues?: number | null,
>   mrr?: number | null,
>   exchange_rate?: number | null,
>   base_currency_code?: string | null,
>   invoice_notes?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   changes_scheduled_at?: number | null,
>   cancel_reason_code?: string | null,
>   free_period?: number | null,
>   free_period_unit?: string | null,
>   create_pending_invoices?: boolean | null,
>   auto_close_invoices?: boolean | null,
>   business_entity_id?: string | null,
>   decommissioned?: boolean | null,
>   brand_id?: string | null,
>   subscription_items?: {
>     item_price_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     amount?: number | null,
>     current_term_start?: number | null,
>     current_term_end?: number | null,
>     next_billing_at?: number | null,
>     amount_in_decimal?: string | null,
>     billing_period?: number | null,
>     billing_period_unit?: string | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     trial_end?: number | null,
>     billing_cycles?: number | null,
>     service_period_days?: number | null,
>     charge_on_event?: string | null,
>     charge_once?: boolean | null,
>     charge_on_option?: string | null,
>     proration_type?: string | null,
>     usage_accumulation_reset_frequency?: string | null,
>     description?: string | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null,
>     index?: number | null
>   }[] | null,
>   charged_items?: {
>     item_price_id?: string | null,
>     last_charged_at?: number | null
>   }[] | null,
>   coupons?: {
>     coupon_id?: string | null,
>     apply_till?: number | null,
>     applied_count?: number | null,
>     coupon_code?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_info?: {
>     referral_code?: string | null,
>     coupon_code?: string | null,
>     referrer_id?: string | null,
>     external_reference_id?: string | null,
>     reward_status?: string | null,
>     referral_system?: string | null,
>     account_id?: string | null,
>     campaign_id?: string | null,
>     external_campaign_id?: string | null,
>     friend_offer_type?: string | null,
>     referrer_reward_type?: string | null,
>     notify_referral_system?: string | null,
>     destination_url?: string | null,
>     post_purchase_widget_enabled?: boolean | null
>   } | null,
>   billing_override?: {
>     max_excess_payment_usage?: number | null,
>     max_refundable_credits_usage?: number | null
>   } | null,
>   contract_term?: {
>     id?: string | null,
>     status?: string | null,
>     contract_start?: number | null,
>     contract_end?: number | null,
>     billing_cycle?: number | null,
>     action_at_term_end?: string | null,
>     total_contract_value?: number | null,
>     total_contract_value_before_tax?: number | null,
>     cancellation_cutoff_period?: number | null,
>     created_at?: number | null,
>     subscription_id?: string | null,
>     remaining_billing_cycles?: number | null
>   } | null,
>   discounts?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     description?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     quantity?: number | null,
>     currency_code?: string | null,
>     duration_type?: string | null,
>     period?: number | null,
>     period_unit?: string | null,
>     included_in_mrr?: boolean | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null,
>     apply_till?: number | null,
>     applied_count?: number | null,
>     coupon_id?: string | null,
>     index?: number | null
>   }[] | null
> } | null
> ```

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### get

`gifts.get`

Retrieve a gift. Retrieves a gift subscription. This API accepts the gift 'id' and returns the gift along with the subscription.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.gifts.get({ giftId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `giftId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `gift` | `object \| null` | No | Gift represents a subscription of a customer(**recipient** ) to a 'gift plan' which has been gifted by another customer(**gifter**). It may also have addons and coupons. Gift will be created only on immediate successful payment collection from the gifter's payment method. Gift is initially created in '**scheduled** ' state. The gift can be scheduled to be notified on a particular date to the recipient by passing 'scheduled\_at'. If not, the recipient is notified immediately. Gift will be moved to '**unclaimed** ' state on the date of notification. If you pass auto\_claim as true, gift status will be moved to '**claimed**' immediately, otherwise, the gift will remain 'unclaimed' till the recipient claims the gift. If the gift is not claimed before the claim\_expiry\_date, it will be moved to the '**expired**' state. #### GIFT SUBSCRIPTION Gift subscriptions will be created in '**future** ' state. Once the gift is claimed, the subscription will be moved to '**non-renewing**' state. #### INVOICE Gift subscriptions will be invoiced immediately. The invoice created has **is\_gifted** as 'true' and **term\_finalized** as 'false'. This is because initially the invoice term\_start and term\_end are set as the subscription's start\_date till the end of the plan period. Once the gift is claimed, the invoice's term\_finalized will be marked as 'true'. The term\_start will be changed to the actual invoice's term, which is the gift-claim date and the term\_end will be changed till plan's period. |
| `subscription` | `object \| null` | No | A Chargebee subscription connects a customer record to products/services. It describes what the customer has signed up for and how often they're charged for it. The essential components of a subscription are: \* A [plan-item price](https://docs.corsair.dev/docs/api/item_prices). \* Any addon- and charge-item prices applied to the subscription. \* Any [coupons](https://docs.corsair.dev/docs/api/coupons) applied. \* Any [discounts](https://docs.corsair.dev/docs/api/discounts) applied. The charges in a subscription are billed via invoices. **Note:** The maximum number of subscriptions for any given [customer](https://docs.corsair.dev/docs/api/customers) ([active](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#status) or not) is 900. #### Subscription billing frequencies Chargebee offers two billing frequency options for subscriptions: \* **Plan-based billing** (`default`): Subscriptions are billed based on the billing period defined for the item price of the `item_type` `plan`. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/subscriptions#plan-based-billing). \* **Multi-frequency billing** : Subscriptions are billed according to the billing period of each recurring item price within the subscription. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing). **Important** [Limitations](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing#limitations) of Multi-frequency billing. The selection of the billing frequency preference is configured at the site level. #### Item price compatibility in a subscription When creating or updating a subscription, one of the item prices specified under subscription\_items must be a plan-item price. The remaining must be compatible addon- or charge-item prices. An item price is compatible with a plan-item price if their currencies are the same. Additionally, an addon-item price is compatible with a plan-item price only if their billing frequencies meet the following conditions: \| `period_unit` for plan-item price \| Compatible `period_unit` for addon-item price \| Compatible period for addon-item price \| \|-----------------------------------\|-----------------------------------------------\|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `day` \| `day` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `10`, then the period of the addon-item price can be `10`, `5`, `2`, or `1`. \| \| `week` \| `week` or `day` \| The `period` (in days) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the period of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `week`, `period` can be `2` or `1`. \* for `period_unit` as `day`, `period` can be `14`, `7`, `2`, or `1`. \| \| `month` \| `month` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `6`, then the `period` of the addon-item price can be `6`, `3`, `2`, or `1`. \| \| `year` \| `year` or `month` \| The `period` (in months) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the `period` of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `year`, `period` can be `2` or `1`. \* for `period_unit` as `month`, `period` can be `24`, `12`, `8`, `6`, `4`, `3`, `2`, or `1`. \| #### Tax provider fields **Avalara** : Merchants using **Avalara Sales Tax** can optionally associate each item price with a locationCode (from their Avalara company locations), so tax can be resolved correctly at the line item level. \| Field ID \| Field Value \| APIs \| \|--------------------------------------------------------------------------------\|----------------------------------------------------------------------\|--------------------------------------------------------------------------------\| \| `locationCode` \| Merchant to configure it on Avalara Platform under company locations \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| **Anrok**: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation \| Field ID \| Field Value \| APIs \| \|---------------------------------------------------------------------------------------------------------------------------------------\|---------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------\| \| `additionalTaxRegistrationNumber` \| Canadian tax registration numbers in comma separated fashion. \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| **Vertex**: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration **Note:** Field Id like `customerCode` , `customerClass` , and`taxExempted` belong to the customer object. Field Id like `productCode` , `productClass` , `productTaxCode` , and `productClass` belong to the product object. \| Field ID \| Field Value \| APIs \| \|-----------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productCode` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `customerCode` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `customerClass` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **Taxamo:** Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration \| Field Id \| Field Value \| APIs \| \|------------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productTaxCode` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `taxExempted` \| Merchant to configure it on Taxamo Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **cbtaxes**: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India. \| Field ID \| Field Value \| APIs \| \|---------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `indiaSez` \| `SEZ_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaSez` \| `SEZ_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **All**: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level \| Field ID \| Field Value \| APIs \| \|-------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `priceType` \| `TAX_INCLUSIVE` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| \| `TAX_EXCLUSIVE` \| \| \| \| `SITE_DEFAULT` or blank \| Removes price type override, and allows site level configuration to be used for tax calculation. \| #### Ramps API compatibility mode If you want to schedule changes on a subscription, use the [Ramps API](https://docs.corsair.dev/docs/api/ramps). If you are currently scheduling changes through the [Update subscription API](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items), migrate to the Ramps API. To get started, [request access for Subscription Ramps](https://app.chargebee.com/login?forward=https://app.chargebee.com/request_access/subscription-ramps\&ref=feature). Chargebee will enable Ramps compatibility mode for your site. Once enabled, you can test the Ramps API without impacting your existing integrations. The following parts of the Billing API have subtle differences in behavior when the Ramps feature is disabled versus when it is enabled with compatibility mode. (Follow the links to learn more.) \* The value of the [`subscription.has_scheduled_changes`](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#has_scheduled_changes) attribute. \* [Update subscription](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#impact-scheduled-changes) \* [Create Checkout for updating a subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription#impact-scheduled-changes) \* [Remove scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/remove-scheduled-changes) \* [Retrieve with scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/retrieve-with-scheduled-changes) \* [Create a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/create-a-quote-for-update-subscription-items) \* [Edit a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/edit-update-subscription-quote-for-items) \* [Portal sessions](https://docs.corsair.dev/docs/api/portal_sessions#scheduled-subscription-changes) |

> [accordion] gift full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   status?: string | null,
>   scheduled_at?: number | null,
>   auto_claim?: boolean | null,
>   no_expiry?: boolean | null,
>   claim_expiry_date?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   gifter?: {
>     customer_id?: string | null,
>     invoice_id?: string | null,
>     signature?: string | null,
>     note?: string | null
>   } | null,
>   gift_receiver?: {
>     customer_id?: string | null,
>     subscription_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null
>   } | null,
>   gift_timelines?: {
>     status?: string | null,
>     occurred_at?: number | null
>   }[] | null
> } | null
> ```

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   currency_code?: string | null,
>   billing_period?: number | null,
>   billing_period_unit?: string | null,
>   start_date?: number | null,
>   trial_end?: number | null,
>   remaining_billing_cycles?: number | null,
>   po_number?: string | null,
>   auto_collection?: string | null,
>   plan_quantity_in_decimal?: string | null,
>   plan_unit_price_in_decimal?: string | null,
>   customer_id?: string | null,
>   status?: string | null,
>   trial_start?: number | null,
>   trial_end_action?: string | null,
>   current_term_start?: number | null,
>   current_term_end?: number | null,
>   next_billing_at?: number | null,
>   created_at?: number | null,
>   started_at?: number | null,
>   activated_at?: number | null,
>   contract_term_billing_cycle_on_renewal?: number | null,
>   override_relationship?: boolean | null,
>   pause_date?: number | null,
>   resume_date?: number | null,
>   cancelled_at?: number | null,
>   cancel_reason?: string | null,
>   created_from_ip?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   has_scheduled_advance_invoices?: boolean | null,
>   has_scheduled_changes?: boolean | null,
>   payment_source_id?: string | null,
>   plan_free_quantity_in_decimal?: string | null,
>   plan_amount_in_decimal?: string | null,
>   cancel_schedule_created_at?: number | null,
>   offline_payment_method?: string | null,
>   channel?: string | null,
>   net_term_days?: number | null,
>   active_id?: string | null,
>   due_invoices_count?: number | null,
>   due_since?: number | null,
>   total_dues?: number | null,
>   mrr?: number | null,
>   exchange_rate?: number | null,
>   base_currency_code?: string | null,
>   invoice_notes?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   changes_scheduled_at?: number | null,
>   cancel_reason_code?: string | null,
>   free_period?: number | null,
>   free_period_unit?: string | null,
>   create_pending_invoices?: boolean | null,
>   auto_close_invoices?: boolean | null,
>   business_entity_id?: string | null,
>   decommissioned?: boolean | null,
>   brand_id?: string | null,
>   subscription_items?: {
>     item_price_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     amount?: number | null,
>     current_term_start?: number | null,
>     current_term_end?: number | null,
>     next_billing_at?: number | null,
>     amount_in_decimal?: string | null,
>     billing_period?: number | null,
>     billing_period_unit?: string | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     trial_end?: number | null,
>     billing_cycles?: number | null,
>     service_period_days?: number | null,
>     charge_on_event?: string | null,
>     charge_once?: boolean | null,
>     charge_on_option?: string | null,
>     proration_type?: string | null,
>     usage_accumulation_reset_frequency?: string | null,
>     description?: string | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null,
>     index?: number | null
>   }[] | null,
>   charged_items?: {
>     item_price_id?: string | null,
>     last_charged_at?: number | null
>   }[] | null,
>   coupons?: {
>     coupon_id?: string | null,
>     apply_till?: number | null,
>     applied_count?: number | null,
>     coupon_code?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_info?: {
>     referral_code?: string | null,
>     coupon_code?: string | null,
>     referrer_id?: string | null,
>     external_reference_id?: string | null,
>     reward_status?: string | null,
>     referral_system?: string | null,
>     account_id?: string | null,
>     campaign_id?: string | null,
>     external_campaign_id?: string | null,
>     friend_offer_type?: string | null,
>     referrer_reward_type?: string | null,
>     notify_referral_system?: string | null,
>     destination_url?: string | null,
>     post_purchase_widget_enabled?: boolean | null
>   } | null,
>   billing_override?: {
>     max_excess_payment_usage?: number | null,
>     max_refundable_credits_usage?: number | null
>   } | null,
>   contract_term?: {
>     id?: string | null,
>     status?: string | null,
>     contract_start?: number | null,
>     contract_end?: number | null,
>     billing_cycle?: number | null,
>     action_at_term_end?: string | null,
>     total_contract_value?: number | null,
>     total_contract_value_before_tax?: number | null,
>     cancellation_cutoff_period?: number | null,
>     created_at?: number | null,
>     subscription_id?: string | null,
>     remaining_billing_cycles?: number | null
>   } | null,
>   discounts?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     description?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     quantity?: number | null,
>     currency_code?: string | null,
>     duration_type?: string | null,
>     period?: number | null,
>     period_unit?: string | null,
>     included_in_mrr?: boolean | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null,
>     apply_till?: number | null,
>     applied_count?: number | null,
>     coupon_id?: string | null,
>     index?: number | null
>   }[] | null
> } | null
> ```

***

### list

`gifts.list`

List gifts. Retrieves the list of gifts.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.gifts.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `status` | `object` | No | optional, enumerated string filter Status of the gift. Possible values are : scheduled, unclaimed, claimed, cancelled, expired. **Supported operators :** is, is\_not, in, not\_in **Example →** *status\\\[is\\] = "claimed"* |
| `gift_receiver` | `object` | No | Parameters for gift\_receiver |
| `gifter` | `object` | No | Parameters for gifter |

> [accordion] status full type
>
> ```ts theme={null}
> {
>   is?: scheduled | unclaimed | claimed | cancelled | expired,
>   is_not?: scheduled | unclaimed | claimed | cancelled | expired,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] gift\_receiver full type
>
> ```ts theme={null}
> {
>   email?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string
>   },
>   customer_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string
>   }
> }
> ```

> [accordion] gifter full type
>
> ```ts theme={null}
> {
>   customer_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   gift?: {
>     id?: string | null,
>     status?: string | null,
>     scheduled_at?: number | null,
>     auto_claim?: boolean | null,
>     no_expiry?: boolean | null,
>     claim_expiry_date?: number | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     gifter?: {
>       customer_id?: string | null,
>       invoice_id?: string | null,
>       signature?: string | null,
>       note?: string | null
>     } | null,
>     gift_receiver?: {
>       customer_id?: string | null,
>       subscription_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null
>     } | null,
>     gift_timelines?: {
>       status?: string | null,
>       occurred_at?: number | null
>     }[] | null
>   } | null,
>   subscription?: {
>     id?: string | null,
>     currency_code?: string | null,
>     billing_period?: number | null,
>     billing_period_unit?: string | null,
>     start_date?: number | null,
>     trial_end?: number | null,
>     remaining_billing_cycles?: number | null,
>     po_number?: string | null,
>     auto_collection?: string | null,
>     plan_quantity_in_decimal?: string | null,
>     plan_unit_price_in_decimal?: string | null,
>     customer_id?: string | null,
>     status?: string | null,
>     trial_start?: number | null,
>     trial_end_action?: string | null,
>     current_term_start?: number | null,
>     current_term_end?: number | null,
>     next_billing_at?: number | null,
>     created_at?: number | null,
>     started_at?: number | null,
>     activated_at?: number | null,
>     contract_term_billing_cycle_on_renewal?: number | null,
>     override_relationship?: boolean | null,
>     pause_date?: number | null,
>     resume_date?: number | null,
>     cancelled_at?: number | null,
>     cancel_reason?: string | null,
>     created_from_ip?: string | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     has_scheduled_advance_invoices?: boolean | null,
>     has_scheduled_changes?: boolean | null,
>     payment_source_id?: string | null,
>     plan_free_quantity_in_decimal?: string | null,
>     plan_amount_in_decimal?: string | null,
>     cancel_schedule_created_at?: number | null,
>     offline_payment_method?: string | null,
>     channel?: string | null,
>     net_term_days?: number | null,
>     active_id?: string | null,
>     due_invoices_count?: number | null,
>     due_since?: number | null,
>     total_dues?: number | null,
>     mrr?: number | null,
>     exchange_rate?: number | null,
>     base_currency_code?: string | null,
>     invoice_notes?: string | null,
>     meta_data?: {
>     } | null,
>     deleted?: boolean | null,
>     changes_scheduled_at?: number | null,
>     cancel_reason_code?: string | null,
>     free_period?: number | null,
>     free_period_unit?: string | null,
>     create_pending_invoices?: boolean | null,
>     auto_close_invoices?: boolean | null,
>     business_entity_id?: string | null,
>     decommissioned?: boolean | null,
>     brand_id?: string | null,
>     subscription_items?: {
>       item_price_id?: string | null,
>       item_type?: string | null,
>       quantity?: number | null,
>       quantity_in_decimal?: string | null,
>       unit_price?: number | null,
>       unit_price_in_decimal?: string | null,
>       amount?: number | null,
>       current_term_start?: number | null,
>       current_term_end?: number | null,
>       next_billing_at?: number | null,
>       amount_in_decimal?: string | null,
>       billing_period?: number | null,
>       billing_period_unit?: string | null,
>       free_quantity?: number | null,
>       free_quantity_in_decimal?: string | null,
>       trial_end?: number | null,
>       billing_cycles?: number | null,
>       service_period_days?: number | null,
>       charge_on_event?: string | null,
>       charge_once?: boolean | null,
>       charge_on_option?: string | null,
>       proration_type?: string | null,
>       usage_accumulation_reset_frequency?: string | null,
>       description?: string | null
>     }[] | null,
>     item_tiers?: {
>       item_price_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       price?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       price_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null,
>       index?: number | null
>     }[] | null,
>     charged_items?: {
>       item_price_id?: string | null,
>       last_charged_at?: number | null
>     }[] | null,
>     coupons?: {
>       coupon_id?: string | null,
>       apply_till?: number | null,
>       applied_count?: number | null,
>       coupon_code?: string | null
>     }[] | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     referral_info?: {
>       referral_code?: string | null,
>       coupon_code?: string | null,
>       referrer_id?: string | null,
>       external_reference_id?: string | null,
>       reward_status?: string | null,
>       referral_system?: string | null,
>       account_id?: string | null,
>       campaign_id?: string | null,
>       external_campaign_id?: string | null,
>       friend_offer_type?: string | null,
>       referrer_reward_type?: string | null,
>       notify_referral_system?: string | null,
>       destination_url?: string | null,
>       post_purchase_widget_enabled?: boolean | null
>     } | null,
>     billing_override?: {
>       max_excess_payment_usage?: number | null,
>       max_refundable_credits_usage?: number | null
>     } | null,
>     contract_term?: {
>       id?: string | null,
>       status?: string | null,
>       contract_start?: number | null,
>       contract_end?: number | null,
>       billing_cycle?: number | null,
>       action_at_term_end?: string | null,
>       total_contract_value?: number | null,
>       total_contract_value_before_tax?: number | null,
>       cancellation_cutoff_period?: number | null,
>       created_at?: number | null,
>       subscription_id?: string | null,
>       remaining_billing_cycles?: number | null
>     } | null,
>     discounts?: {
>       id?: string | null,
>       invoice_name?: string | null,
>       description?: string | null,
>       type?: string | null,
>       percentage?: number | null,
>       amount?: number | null,
>       quantity?: number | null,
>       currency_code?: string | null,
>       duration_type?: string | null,
>       period?: number | null,
>       period_unit?: string | null,
>       included_in_mrr?: boolean | null,
>       apply_on?: string | null,
>       item_price_id?: string | null,
>       created_at?: number | null,
>       apply_till?: number | null,
>       applied_count?: number | null,
>       coupon_id?: string | null,
>       index?: number | null
>     }[] | null
>   } | null
> }[] | null
> ```

***

### update

`gifts.update`

Update a gift. Updates the attributes of a gift. ### Prerequisites & Constraints \* The gift must be in the scheduled status.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.gifts.update({ giftId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `giftId` | `string` | Yes | — |
| `scheduled_at` | `number` | No | The new date/time at which the gift notification email is to be sent. The value must be greater than the current time. If [`no_expiry`](https://docs.corsair.dev/docs/api/gifts/gift-object#no_expiry) is false, the value must also be less than [`claim_expiry_date`](https://docs.corsair.dev/docs/api/gifts/gift-object#claim_expiry_date). |
| `comment` | `string` | No | An internal comment. The comments are not retrievable via API and are only available on request via [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). |
| `gift_receiver` | `object` | No | Parameters for gift\_receiver. |

> [accordion] gift\_receiver full type
>
> ```ts theme={null}
> {
>   email?: string,
>   first_name?: string,
>   last_name?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `gift` | `object \| null` | No | Gift represents a subscription of a customer(**recipient** ) to a 'gift plan' which has been gifted by another customer(**gifter**). It may also have addons and coupons. Gift will be created only on immediate successful payment collection from the gifter's payment method. Gift is initially created in '**scheduled** ' state. The gift can be scheduled to be notified on a particular date to the recipient by passing 'scheduled\_at'. If not, the recipient is notified immediately. Gift will be moved to '**unclaimed** ' state on the date of notification. If you pass auto\_claim as true, gift status will be moved to '**claimed**' immediately, otherwise, the gift will remain 'unclaimed' till the recipient claims the gift. If the gift is not claimed before the claim\_expiry\_date, it will be moved to the '**expired**' state. #### GIFT SUBSCRIPTION Gift subscriptions will be created in '**future** ' state. Once the gift is claimed, the subscription will be moved to '**non-renewing**' state. #### INVOICE Gift subscriptions will be invoiced immediately. The invoice created has **is\_gifted** as 'true' and **term\_finalized** as 'false'. This is because initially the invoice term\_start and term\_end are set as the subscription's start\_date till the end of the plan period. Once the gift is claimed, the invoice's term\_finalized will be marked as 'true'. The term\_start will be changed to the actual invoice's term, which is the gift-claim date and the term\_end will be changed till plan's period. |
| `subscription` | `object \| null` | No | A Chargebee subscription connects a customer record to products/services. It describes what the customer has signed up for and how often they're charged for it. The essential components of a subscription are: \* A [plan-item price](https://docs.corsair.dev/docs/api/item_prices). \* Any addon- and charge-item prices applied to the subscription. \* Any [coupons](https://docs.corsair.dev/docs/api/coupons) applied. \* Any [discounts](https://docs.corsair.dev/docs/api/discounts) applied. The charges in a subscription are billed via invoices. **Note:** The maximum number of subscriptions for any given [customer](https://docs.corsair.dev/docs/api/customers) ([active](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#status) or not) is 900. #### Subscription billing frequencies Chargebee offers two billing frequency options for subscriptions: \* **Plan-based billing** (`default`): Subscriptions are billed based on the billing period defined for the item price of the `item_type` `plan`. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/subscriptions#plan-based-billing). \* **Multi-frequency billing** : Subscriptions are billed according to the billing period of each recurring item price within the subscription. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing). **Important** [Limitations](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing#limitations) of Multi-frequency billing. The selection of the billing frequency preference is configured at the site level. #### Item price compatibility in a subscription When creating or updating a subscription, one of the item prices specified under subscription\_items must be a plan-item price. The remaining must be compatible addon- or charge-item prices. An item price is compatible with a plan-item price if their currencies are the same. Additionally, an addon-item price is compatible with a plan-item price only if their billing frequencies meet the following conditions: \| `period_unit` for plan-item price \| Compatible `period_unit` for addon-item price \| Compatible period for addon-item price \| \|-----------------------------------\|-----------------------------------------------\|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `day` \| `day` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `10`, then the period of the addon-item price can be `10`, `5`, `2`, or `1`. \| \| `week` \| `week` or `day` \| The `period` (in days) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the period of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `week`, `period` can be `2` or `1`. \* for `period_unit` as `day`, `period` can be `14`, `7`, `2`, or `1`. \| \| `month` \| `month` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `6`, then the `period` of the addon-item price can be `6`, `3`, `2`, or `1`. \| \| `year` \| `year` or `month` \| The `period` (in months) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the `period` of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `year`, `period` can be `2` or `1`. \* for `period_unit` as `month`, `period` can be `24`, `12`, `8`, `6`, `4`, `3`, `2`, or `1`. \| #### Tax provider fields **Avalara** : Merchants using **Avalara Sales Tax** can optionally associate each item price with a locationCode (from their Avalara company locations), so tax can be resolved correctly at the line item level. \| Field ID \| Field Value \| APIs \| \|--------------------------------------------------------------------------------\|----------------------------------------------------------------------\|--------------------------------------------------------------------------------\| \| `locationCode` \| Merchant to configure it on Avalara Platform under company locations \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| **Anrok**: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation \| Field ID \| Field Value \| APIs \| \|---------------------------------------------------------------------------------------------------------------------------------------\|---------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------\| \| `additionalTaxRegistrationNumber` \| Canadian tax registration numbers in comma separated fashion. \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| **Vertex**: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration **Note:** Field Id like `customerCode` , `customerClass` , and`taxExempted` belong to the customer object. Field Id like `productCode` , `productClass` , `productTaxCode` , and `productClass` belong to the product object. \| Field ID \| Field Value \| APIs \| \|-----------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productCode` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `customerCode` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `customerClass` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **Taxamo:** Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration \| Field Id \| Field Value \| APIs \| \|------------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productTaxCode` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `taxExempted` \| Merchant to configure it on Taxamo Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **cbtaxes**: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India. \| Field ID \| Field Value \| APIs \| \|---------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `indiaSez` \| `SEZ_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaSez` \| `SEZ_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **All**: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level \| Field ID \| Field Value \| APIs \| \|-------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `priceType` \| `TAX_INCLUSIVE` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| \| `TAX_EXCLUSIVE` \| \| \| \| `SITE_DEFAULT` or blank \| Removes price type override, and allows site level configuration to be used for tax calculation. \| #### Ramps API compatibility mode If you want to schedule changes on a subscription, use the [Ramps API](https://docs.corsair.dev/docs/api/ramps). If you are currently scheduling changes through the [Update subscription API](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items), migrate to the Ramps API. To get started, [request access for Subscription Ramps](https://app.chargebee.com/login?forward=https://app.chargebee.com/request_access/subscription-ramps\&ref=feature). Chargebee will enable Ramps compatibility mode for your site. Once enabled, you can test the Ramps API without impacting your existing integrations. The following parts of the Billing API have subtle differences in behavior when the Ramps feature is disabled versus when it is enabled with compatibility mode. (Follow the links to learn more.) \* The value of the [`subscription.has_scheduled_changes`](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#has_scheduled_changes) attribute. \* [Update subscription](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#impact-scheduled-changes) \* [Create Checkout for updating a subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription#impact-scheduled-changes) \* [Remove scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/remove-scheduled-changes) \* [Retrieve with scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/retrieve-with-scheduled-changes) \* [Create a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/create-a-quote-for-update-subscription-items) \* [Edit a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/edit-update-subscription-quote-for-items) \* [Portal sessions](https://docs.corsair.dev/docs/api/portal_sessions#scheduled-subscription-changes) |

> [accordion] gift full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   status?: string | null,
>   scheduled_at?: number | null,
>   auto_claim?: boolean | null,
>   no_expiry?: boolean | null,
>   claim_expiry_date?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   gifter?: {
>     customer_id?: string | null,
>     invoice_id?: string | null,
>     signature?: string | null,
>     note?: string | null
>   } | null,
>   gift_receiver?: {
>     customer_id?: string | null,
>     subscription_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null
>   } | null,
>   gift_timelines?: {
>     status?: string | null,
>     occurred_at?: number | null
>   }[] | null
> } | null
> ```

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   currency_code?: string | null,
>   billing_period?: number | null,
>   billing_period_unit?: string | null,
>   start_date?: number | null,
>   trial_end?: number | null,
>   remaining_billing_cycles?: number | null,
>   po_number?: string | null,
>   auto_collection?: string | null,
>   plan_quantity_in_decimal?: string | null,
>   plan_unit_price_in_decimal?: string | null,
>   customer_id?: string | null,
>   status?: string | null,
>   trial_start?: number | null,
>   trial_end_action?: string | null,
>   current_term_start?: number | null,
>   current_term_end?: number | null,
>   next_billing_at?: number | null,
>   created_at?: number | null,
>   started_at?: number | null,
>   activated_at?: number | null,
>   contract_term_billing_cycle_on_renewal?: number | null,
>   override_relationship?: boolean | null,
>   pause_date?: number | null,
>   resume_date?: number | null,
>   cancelled_at?: number | null,
>   cancel_reason?: string | null,
>   created_from_ip?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   has_scheduled_advance_invoices?: boolean | null,
>   has_scheduled_changes?: boolean | null,
>   payment_source_id?: string | null,
>   plan_free_quantity_in_decimal?: string | null,
>   plan_amount_in_decimal?: string | null,
>   cancel_schedule_created_at?: number | null,
>   offline_payment_method?: string | null,
>   channel?: string | null,
>   net_term_days?: number | null,
>   active_id?: string | null,
>   due_invoices_count?: number | null,
>   due_since?: number | null,
>   total_dues?: number | null,
>   mrr?: number | null,
>   exchange_rate?: number | null,
>   base_currency_code?: string | null,
>   invoice_notes?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   changes_scheduled_at?: number | null,
>   cancel_reason_code?: string | null,
>   free_period?: number | null,
>   free_period_unit?: string | null,
>   create_pending_invoices?: boolean | null,
>   auto_close_invoices?: boolean | null,
>   business_entity_id?: string | null,
>   decommissioned?: boolean | null,
>   brand_id?: string | null,
>   subscription_items?: {
>     item_price_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     amount?: number | null,
>     current_term_start?: number | null,
>     current_term_end?: number | null,
>     next_billing_at?: number | null,
>     amount_in_decimal?: string | null,
>     billing_period?: number | null,
>     billing_period_unit?: string | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     trial_end?: number | null,
>     billing_cycles?: number | null,
>     service_period_days?: number | null,
>     charge_on_event?: string | null,
>     charge_once?: boolean | null,
>     charge_on_option?: string | null,
>     proration_type?: string | null,
>     usage_accumulation_reset_frequency?: string | null,
>     description?: string | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null,
>     index?: number | null
>   }[] | null,
>   charged_items?: {
>     item_price_id?: string | null,
>     last_charged_at?: number | null
>   }[] | null,
>   coupons?: {
>     coupon_id?: string | null,
>     apply_till?: number | null,
>     applied_count?: number | null,
>     coupon_code?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_info?: {
>     referral_code?: string | null,
>     coupon_code?: string | null,
>     referrer_id?: string | null,
>     external_reference_id?: string | null,
>     reward_status?: string | null,
>     referral_system?: string | null,
>     account_id?: string | null,
>     campaign_id?: string | null,
>     external_campaign_id?: string | null,
>     friend_offer_type?: string | null,
>     referrer_reward_type?: string | null,
>     notify_referral_system?: string | null,
>     destination_url?: string | null,
>     post_purchase_widget_enabled?: boolean | null
>   } | null,
>   billing_override?: {
>     max_excess_payment_usage?: number | null,
>     max_refundable_credits_usage?: number | null
>   } | null,
>   contract_term?: {
>     id?: string | null,
>     status?: string | null,
>     contract_start?: number | null,
>     contract_end?: number | null,
>     billing_cycle?: number | null,
>     action_at_term_end?: string | null,
>     total_contract_value?: number | null,
>     total_contract_value_before_tax?: number | null,
>     cancellation_cutoff_period?: number | null,
>     created_at?: number | null,
>     subscription_id?: string | null,
>     remaining_billing_cycles?: number | null
>   } | null,
>   discounts?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     description?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     quantity?: number | null,
>     currency_code?: string | null,
>     duration_type?: string | null,
>     period?: number | null,
>     period_unit?: string | null,
>     included_in_mrr?: boolean | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null,
>     apply_till?: number | null,
>     applied_count?: number | null,
>     coupon_id?: string | null,
>     index?: number | null
>   }[] | null
> } | null
> ```

***

## Grant Blocks

### list

`grantBlocks.list`

List grant blocks. Returns a list of grant blocks meeting all the conditions specified in the filter parameters below.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.grantBlocks.list({
	subscription_id: {},
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | Specifies the maximum number of resources to return per page. **Default and Hard Cap** \* Optional parameter; if omitted, a server-defined default is applied. \* Values exceeding the server's maximum limit are capped (clamped) to the allowed maximum. **Example →** *limit = "50"* |
| `offset` | `string` | No | Opaque cursor indicating the current position in the result set for pagination. **Behavior** \* To fetch the next page, pass the next\_offset value returned in the previous response. \* The value is opaque and must not be parsed, modified, or constructed manually. **Example →** *offset = "\\\["1771176208000","96000000006"\\]"* |
| `subscription_id` | `object` | Yes | required, string filter Filters results by subscription identifier. This is the subscription whose grant blocks you are listing. **Supported operators :** is **Example →** *subscription\_id\\\[is\\] = "1mGETgZVF2umUZq"* |
| `unit_id` | `object` | No | optional, string filter Filters results by unit identifier. For example, a credit unit id such as `ai_credits`. **Supported operators :** is **Example →** *unit\_id\\\[is\\] = "ai\_credits"* |
| `account_type` | `object` | No | optional, enum filter Filters results by the account the grant block belongs to: **provisioned** (plan-issued credits) or **overdraft** (consumption beyond configured grants). **Supported operators :** is **Example →** *account\_type\\\[is\\] = "provisioned"* |
| `effective_from` | `object` | No | optional, timestamp(UTC) in seconds filter Filter by when blocks become effective (`effective_from`). **Supported operators :** after, before, on, between (per [List operations](https://docs.corsair.dev/docs/api/list-ops)). **Example →** *effective\_from\\\[after\\] = "1765283483"* |
| `expires_at` | `object` | No | optional, timestamp(UTC) in seconds filter Filter by grant expiry (`expires_at`). **Supported operators :** after, before, on, between (per [List operations](https://docs.corsair.dev/docs/api/list-ops)). **Example →** *expires\_at\\\[before\\] = "2863729974"* |
| `created_at` | `object` | No | optional, timestamp(UTC) in seconds filter Filter by when the grant block was persisted (`created_at`). **Supported operators :** after, before, on, between. **Example →** *created\_at\\\[between\\] = "\\\[1771175750, 1771175800\\]"* |
| `sort_by` | `object` | No | optional, string filter Specifies the field used to sort the result set. **Supported attributes** \* `created_at` \* `effective_from` \* `expires_at` **Sort Order** \* `asc` (ascending order) \* `desc` (descending order) **Example →** *sort\_by\\\[desc\\] = "effective\_from"* This sorts grant blocks by `effective_from` in descending order (latest effective time first). |

> [accordion] subscription\_id full type
>
> ```ts theme={null}
> {
>   is?: string
> }
> ```

> [accordion] unit\_id full type
>
> ```ts theme={null}
> {
>   is?: string
> }
> ```

> [accordion] account\_type full type
>
> ```ts theme={null}
> {
>   is?: provisioned | overdraft
> }
> ```

> [accordion] effective\_from full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] expires\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] created\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] sort\_by full type
>
> ```ts theme={null}
> {
>   asc?: effective_from | expires_at | created_at,
>   desc?: effective_from | expires_at | created_at
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   grant_block?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     unit_id?: string | null,
>     unit_type?: string | null,
>     account_type?: string | null,
>     effective_from?: number | null,
>     expires_at?: number | null,
>     origin_grant_block_id?: string | null,
>     status?: string | null,
>     grant_source?: string | null,
>     created_at?: number | null,
>     modified_at?: number | null,
>     resource_version?: number | null,
>     metadata?: {
>     } | null,
>     provisioned_block_balance?: {
>       granted_amount?: string | null,
>       total_balance?: string | null,
>       usable_balance?: string | null,
>       hold_amount?: string | null,
>       used_amount?: string | null,
>       expired_amount?: string | null,
>       rolled_over_amount?: string | null,
>       voided_amount?: string | null
>     } | null,
>     overdraft_block_balance?: {
>       is_unlimited?: boolean | null,
>       limit?: string | null,
>       total_balance?: string | null,
>       usable_balance?: string | null,
>       used_amount?: string | null
>     } | null,
>     billing_metadata?: {
>       item_price_id?: string | null,
>       line_items?: {
>         id?: string | null,
>         invoice_number?: string | null,
>         quantity?: number | null
>       }[] | null
>     } | null
>   } | null
> }[] | null
> ```

***

## Hosted Pages

### acceptQuote

`hostedPages.acceptQuote`

Accept a quote. This API generates a hosted page URL for the customer to accept a quote. If the hosted page URL has expired, a new URL will be generated automatically. \* Customers with existing subscriptions can generate a quote for new subscriptions.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.hostedPages.acceptQuote({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `brand_id` | `string` | No | The unique ID of the [brand](https://docs.corsair.dev/docs/api/brands) this hosted page should be linked to. Applicable only when multiple brands have been created for the site. This need not match the brand of the customer or subscription in the request; when the two differ, the value provided here is used for the hosted page. An alternative way of passing this parameter is by means of the `chargebee-brand-id` custom HTTP header; when both are provided, they must specify the same brand. **Default behavior** \* When not provided, the hosted page is linked to the brand of the customer or subscription in the request. |
| `redirect_url` | `string` | No | The customers will be redirected to this URL upon successful checkout. The hosted page id and state will be passed as parameters to this URL. **Note** : \* Although the customer will be redirected to the `redirect_url` after successful checkout, we do not recommend relying on it for completing critical post-checkout actions. This is because redirection may not happen due to unforeseen reasons such as user closing the tab, or exiting the browser, and so on. If there is any synchronization that you are doing after the redirection, you will have to have a backup. Chargebee recommends listening to appropriate webhooks such as [`subscription_created`](https://docs.corsair.dev/docs/api/events) or [`invoice_generated`](https://docs.corsair.dev/docs/api/events) to verify a successful checkout. \* Redirect URL configured in Settings \\> Hosted Pages Settings would be overriden by this redirect URL. \* *Eg :* *[http://yoursite.com?id=\\\\\*\\\\\*\\\\\&state=succeeded](http://yoursite.com?id=\\\\*\\\\*\\\\\&state=succeeded)* \* This parameter is not applicable for iframe messaging. |
| `layout` | `in_app \| full_page` | No | Specifies the UI layout for the hosted page. This overrides [the layout](https://www.chargebee.com/docs/billing/2.0/hosted-capabilities/hosted-checkout#ui-layout-options) configured in Chargebee Billing. \* full\_page - Renders the hosted page in a full-page layout. \* in\_app - Renders the hosted page in an in-app layout. |
| `quote` | `object` | No | Parameters for quote |

> [accordion] quote full type
>
> ```ts theme={null}
> {
>   id: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `hosted_page` | `object \| null` | No | Hosted pages are the easiest way to integrate Chargebee with your website. For card payment methods, they help meet most of your PCI DSS compliance requirements. Chargebee offers hosted pages where your customers can perform the following actions: \* [Checkout a new subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription) \* [Checkout changes to an existing subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription) \* [Manage payment sources](https://docs.corsair.dev/docs/api/hosted_pages/manage-payment-sources) \* [Make payments for all due invoices](https://docs.corsair.dev/docs/api/hosted_pages/collect-now) \* [Extending a subscription](https://docs.corsair.dev/docs/api/hosted_pages/extend-subscription) When you create a hosted page, it is available at a secure and unique URL. This URL can then be provided to your customer on your website or by other means such as email. On successful completion of the hosted page workflow by the customer, they are redirected to the `redirect_url` with the hosted page `id` and `state` passed as query string parameters. As soon as the redirection happens, [retrieve the hosted page](https://docs.corsair.dev/docs/api/hosted_pages/retrieve-a-hosted-page) to get details of the customer, subscription, invoice etc. #### Embedding a hosted page Only the [Checkout](https://docs.corsair.dev/docs/api/hosted_pages/hosted-page-object#type) hosted page with the full-page [layout](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription#layout) supports embedding. To embed checkout in your website or application, use [embedded checkout](https://www.chargebee.com/docs/billing/2.0/hosted-capabilities/embedded-checkout.html) with Chargebee.js to mount checkout in a container on your page. Do not place hosted page URLs in your own [iframe](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe) elements---Chargebee.js creates and manages the iframe for you. |

> [accordion] hosted\_page full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   type?: string | null,
>   url?: string | null,
>   state?: string | null,
>   pass_thru_content?: string | null,
>   created_at?: number | null,
>   expires_at?: number | null,
>   layout?: string | null,
>   content?: {
>   } | null,
>   updated_at?: number | null,
>   resource_version?: number | null,
>   checkout_info?: {
>   } | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null
> } | null
> ```

***

### acknowledge

`hostedPages.acknowledge`

Acknowledge a hosted page. When a hosted page is successfully completed by the user and processed by Chargebee, its state is automatically changed to succeeded . Acknowledging a hosted page confirms that you have moved the customer details from Chargebee into your system and are ready to fulfill it.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.hostedPages.acknowledge({ hostedPageId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `hostedPageId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `hosted_page` | `object \| null` | No | Hosted pages are the easiest way to integrate Chargebee with your website. For card payment methods, they help meet most of your PCI DSS compliance requirements. Chargebee offers hosted pages where your customers can perform the following actions: \* [Checkout a new subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription) \* [Checkout changes to an existing subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription) \* [Manage payment sources](https://docs.corsair.dev/docs/api/hosted_pages/manage-payment-sources) \* [Make payments for all due invoices](https://docs.corsair.dev/docs/api/hosted_pages/collect-now) \* [Extending a subscription](https://docs.corsair.dev/docs/api/hosted_pages/extend-subscription) When you create a hosted page, it is available at a secure and unique URL. This URL can then be provided to your customer on your website or by other means such as email. On successful completion of the hosted page workflow by the customer, they are redirected to the `redirect_url` with the hosted page `id` and `state` passed as query string parameters. As soon as the redirection happens, [retrieve the hosted page](https://docs.corsair.dev/docs/api/hosted_pages/retrieve-a-hosted-page) to get details of the customer, subscription, invoice etc. #### Embedding a hosted page Only the [Checkout](https://docs.corsair.dev/docs/api/hosted_pages/hosted-page-object#type) hosted page with the full-page [layout](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription#layout) supports embedding. To embed checkout in your website or application, use [embedded checkout](https://www.chargebee.com/docs/billing/2.0/hosted-capabilities/embedded-checkout.html) with Chargebee.js to mount checkout in a container on your page. Do not place hosted page URLs in your own [iframe](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe) elements---Chargebee.js creates and manages the iframe for you. |

> [accordion] hosted\_page full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   type?: string | null,
>   url?: string | null,
>   state?: string | null,
>   pass_thru_content?: string | null,
>   created_at?: number | null,
>   expires_at?: number | null,
>   layout?: string | null,
>   content?: {
>   } | null,
>   updated_at?: number | null,
>   resource_version?: number | null,
>   checkout_info?: {
>   } | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null
> } | null
> ```

***

### checkoutExisting

`hostedPages.checkoutExisting`

Checkout existing subscription. You can checkout an existing subscription(typically in the trial state) by passing in the plan, quantity and addon details(like Update a Subscription) When the redirect URL is notified of the result, we would advise you to retrieve the subscription and verify the details. Product Catalog 1.0 sites only.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.hostedPages.checkoutExisting({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `replace_addon_list` | `boolean` | No | Should be true if the existing addons should be replaced with the ones that are being passed. |
| `mandatory_addons_to_remove` | `string[]` | No | List of addons IDs that are mandatory to the plan and has to be removed from the subscription. |
| `invoice_date` | `number` | No | 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` | `number` | No | 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` | `number` | No | 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` | `number` | No | 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` | `immediate \| delayed` | No | 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. \* delayed - Subscription period will be aligned with the configured billing date at the next renewal. \* immediate - Subscription period will be aligned with the configured billing date immediately, with credits or charges raised accordingly.. |
| `coupon_ids` | `string[]` | No | List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes. |
| `replace_coupon_list` | `boolean` | No | If `true` then the existing `coupon_ids` list for the subscription is replaced by the one provided. If `false` then the provided `coupon_ids` list gets added to the existing list. |
| `reactivate` | `boolean` | No | Applicable only for cancelled subscriptions. Once this is passed as true, cancelled subscription will become active; otherwise subscription changes will be made but the subscription state will remain cancelled. If not passed, subscription will be activated only if there is any change in subscription data. |
| `force_term_reset` | `boolean` | No | **Note** : This parameter is relevant only for subscriptions with `status` of `active`, `non_renewing`, or `cancelled`. When you set this parameter to `true`, the subscription term resets to the date of the subscription change. By default, if you change the plan to another with the same billing period, the subscription term remains unchanged. For example, if the subscription renews on the 28th of every month, it will continue to renew on the 28th after the change. **Note** : If the new plan has a different billing period from the current plan, the subscription term resets automatically, regardless of the value of `force_term_reset`. |
| `redirect_url` | `string` | No | The customers will be redirected to this URL upon successful checkout. The hosted page id and state will be passed as parameters to this URL. **Note** : \* Although the customer will be redirected to the `redirect_url` after successful checkout, we do not recommend relying on it for completing critical post-checkout actions. This is because redirection may not happen due to unforeseen reasons such as user closing the tab, or exiting the browser, and so on. If there is any synchronization that you are doing after the redirection, you will have to have a backup. Chargebee recommends listening to appropriate webhooks such as [`subscription_created`](https://docs.corsair.dev/docs/api/events) or [`invoice_generated`](https://docs.corsair.dev/docs/api/events) to verify a successful checkout. \* Redirect URL configured in Settings \\> Hosted Pages Settings would be overriden by this redirect URL. \* *Eg :* *[http://yoursite.com?id=\\\\\*\\\\\*\\\\\&state=succeeded](http://yoursite.com?id=\\\\*\\\\*\\\\\&state=succeeded)* \* This parameter is not applicable for iframe messaging. |
| `cancel_url` | `string` | No | The customers will be redirected to this URL upon canceling checkout. The hosted page id and state will be passed as parameters to this URL. **Note** : - Cancel URL configured in Settings \\> Hosted Pages Settings would be overriden by this cancel URL. *Eg : [http://yoursite.com?id=\\\\\&state=cancelled](http://yoursite.com?id=\\\\\&state=cancelled)* \* This parameter is not applicable for iframe messaging and [in-app](https://www.chargebee.com/docs/2.0/checkout.html) checkout. |
| `pass_thru_content` | `string` | No | This attribute allows you to store custom information with the `hosted_page` object. You can use it to associate specific data with a hosted page session. For example, you can store the ID of the marketing campaign that initiated the user session. After a successful checkout, when the customer is redirected, you can retrieve the hosted page ID from the [redirect URL](https://docs.corsair.dev/docs/api/v2/pcv-1/hosted_pages/checkout-existing-subscription#redirect_url)'s query parameters. Using this ID, you can fetch the hosted page and perform actions related to the success of the marketing campaign. |
| `embed` | `boolean` | No | If true then hosted page formatted to be shown in iframe. If false, it is formatted to be shown as a separate page. **Note** : For [in-app](https://www.chargebee.com/docs/checkout-v3.html) checkout, default is false. |
| `iframe_messaging` | `boolean` | No | If true then iframe will communicate with the parent window. Applicable only for embedded(iframe) hosted pages. If you're using iframe\_messaging you need to implement onSuccess \\& onCancel callbacks. **Note** : This parameter is not applicable for [in-app](https://www.chargebee.com/docs/checkout-v3.html) checkout. |
| `allow_offline_payment_methods` | `boolean` | No | Allow the customer to select an offline payment method during checkout. The choice of payment methods can be configured via the Chargebee UI. |
| `subscription` | `object` | No | Parameters for subscription |
| `customer` | `object` | No | Parameters for customer |
| `card` | `object` | No | Parameters for card |
| `contract_term` | `object` | No | Parameters for contract\_term |
| `addons` | `object` | No | Parameters for addons |
| `event_based_addons` | `object` | No | Parameters for event\_based\_addons |

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id: string,
>   plan_id?: string,
>   plan_quantity?: number,
>   plan_unit_price?: number,
>   setup_fee?: number,
>   plan_quantity_in_decimal?: string,
>   plan_unit_price_in_decimal?: string,
>   start_date?: number,
>   trial_end?: number,
>   auto_collection?: on | off,
>   offline_payment_method?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
>   invoice_notes?: string,
>   contract_term_billing_cycle_on_renewal?: number
> }
> ```

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   vat_number?: string,
>   vat_number_prefix?: string
> }
> ```

> [accordion] card full type
>
> ```ts theme={null}
> {
>   gateway_account_id?: string
> }
> ```

> [accordion] contract\_term full type
>
> ```ts theme={null}
> {
>   action_at_term_end?: renew | evergreen | cancel,
>   cancellation_cutoff_period?: number
> }
> ```

> [accordion] addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   unit_price?: number[],
>   billing_cycles?: number[],
>   quantity_in_decimal?: string[],
>   unit_price_in_decimal?: string[]
> }
> ```

> [accordion] event\_based\_addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   unit_price?: number[],
>   service_period_in_days?: number[],
>   charge_on?: (immediately | on_event)[],
>   on_event?: (subscription_creation | subscription_trial_start | plan_activation | subscription_activation | contract_termination)[],
>   charge_once?: boolean[],
>   quantity_in_decimal?: string[],
>   unit_price_in_decimal?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `hosted_page` | `object \| null` | No | Hosted pages are the easiest and most secure way to integrate chargebee with your website. By using hosted pages, you can avoid the sensitive card information passing through your server and be compliant with most of the PCI DSS requirements. When you request for a hosted page, a **secure** and **unique URL** will be returned which you could either embed or redirect depending upon the embed parameter value that you had passed. Specifying **"embed"** parameter as **true** allows you to embed the "hosted page" in an iframe in your own website. This helps you provide the best experience to your user as they do not have to leave your website to provide card information. There are a few limitations: \* Your site URL must be embedded with HTTPS. \* Set the appropriate height and width for the iframe to avoid scrolling. To use the hosted pages, you must configure **Redirect URL** in the Chargebee web interface under **Hosted Pages Settings** \\> **Configuration**. The configured redirect URL will be called with the following parameters after user had submitted the page. \* **id** - unique identifier of the hosted page resource \* **state** - succeeded, failed or cancelled After the **Redirect URL** is called by Chargebee with the above parameters, the details of the hosted page can be fetched using [Retrieve a hosted page](https://docs.corsair.dev/docs/api/v2/pcv-1/hosted_pages/retrieve-a-hosted-page) API. The **content** attribute will have the details about the customer, subscription, card and invoice based on the type of the hosted page. [Checkout New Subscription](https://docs.corsair.dev/docs/api/v2/pcv-1/hosted_pages/checkout-new-subscription): \* [Customer](https://docs.corsair.dev/docs/api/customers/customer-object) - The details about the new customer created. \* [Subscription](https://docs.corsair.dev/docs/api/subscriptions/subscription-object) - The details about the new subscription created. \* [Card](https://docs.corsair.dev/docs/api/cards/card-object) - The details about the card provided while subscribing. \* [Invoice](https://docs.corsair.dev/docs/api/invoices/invoice-object) - The details about the invoice, if one is generated. [Checkout Existing Subscription](https://docs.corsair.dev/docs/api/v2/pcv-1/hosted_pages/checkout-existing-subscription): \* [Customer](https://docs.corsair.dev/docs/api/customers/customer-object) - The updated details of the customer. \* [Subscription](https://docs.corsair.dev/docs/api/subscriptions/subscription-object) - The updated details of the subscription. \* [Card](https://docs.corsair.dev/docs/api/cards/card-object) - The details about the card provided while subscribing. \* [Invoice](https://docs.corsair.dev/docs/api/invoices/invoice-object) - The details about the invoice, if one is generated. [Manage Payment Sources](https://docs.corsair.dev/docs/api/v2/pcv-1/hosted_pages/manage-payment-sources): \* [Customer](https://docs.corsair.dev/docs/api/customers/customer-object) - The details about the customer for whom the card was updated. \* [Card](https://docs.corsair.dev/docs/api/cards/card-object) - The details about the updated card. It will be present only if the type of payment method is card. When an embedded hosted page is cancelled by your end user, the **content** attribute will have the unmodified details of customer, subscription and card resources. |

> [accordion] hosted\_page full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   type?: string | null,
>   url?: string | null,
>   state?: string | null,
>   pass_thru_content?: string | null,
>   embed?: boolean | null,
>   created_at?: number | null,
>   expires_at?: number | null,
>   layout?: string | null,
>   content?: {
>   } | null,
>   updated_at?: number | null,
>   resource_version?: number | null,
>   checkout_info?: {
>   } | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null
> } | null
> ```

***

### checkoutExistingForItems

`hostedPages.checkoutExistingForItems`

Create checkout to update a subscription. Create a Chargebee hosted page to accept payment details from a customer and checkout to update the subscription.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.hostedPages.checkoutExistingForItems({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `layout` | `in_app \| full_page` | No | Specifies the UI layout for the hosted page. This overrides [the layout](https://www.chargebee.com/docs/billing/2.0/hosted-capabilities/hosted-checkout#ui-layout-options) configured in Chargebee Billing. \* in\_app - Renders the hosted page in an in-app layout. \* full\_page - Renders the hosted page in a full-page layout. |
| `brand_id` | `string` | No | The unique ID of the [brand](https://docs.corsair.dev/docs/api/brands) this hosted page should be linked to. Applicable only when multiple brands have been created for the site. This need not match the brand of the customer or subscription in the request; when the two differ, the value provided here is used for the hosted page. An alternative way of passing this parameter is by means of the `chargebee-brand-id` custom HTTP header; when both are provided, they must specify the same brand. **Default behavior** \* When not provided, the hosted page is linked to the brand of the customer or subscription in the request. |
| `mandatory_items_to_remove` | `string[]` | No | Item ids of [mandatorily attached addons](https://docs.corsair.dev/docs/api/attached_items) that are to be removed from the subscription. |
| `replace_items_list` | `boolean` | No | If `true` then the existing `subscription_items` list for the subscription is replaced by the one provided. If `false` then the provided `subscription_items` list gets added to the existing list. |
| `invoice_date` | `number` | No | 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` | `number` | No | Billing cycles set for plan-item price is used by default. |
| `terms_to_charge` | `number` | No | 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` | `number` | No | 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` | `immediate \| delayed` | No | 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. \* 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` | `string[]` | No | List of coupons to be applied to this subscription. You can provide coupon ids or [coupon codes](https://docs.corsair.dev/docs/api/coupon_codes) . |
| `replace_coupon_list` | `boolean` | No | If `true` then the existing `coupon_ids` list for the subscription is replaced by the one provided. If `false` then the provided `coupon_ids` list gets added to the existing list. |
| `reactivate` | `boolean` | No | This parameter is only relevant for `cancelled` subscriptions. When set to `true` , it activates the canceled subscription; otherwise, subscription changes are applied without altering its `status`. Additionally, if not explicitly set and the `subscription_items` provided in the API differ from the existing items, the subscription will still be reactivated. |
| `force_term_reset` | `boolean` | No | **Note** : This parameter is relevant only for subscriptions with `status` of `active`, `non_renewing`, or `cancelled`. When you set this parameter to `true`, the subscription term resets to the date of the subscription change. By default, if you change the plan-item price to another with the same billing period, the subscription term remains unchanged. For example, if the subscription renews on the 28th of every month, it will continue to renew on the 28th after the change. **Note** : If the new plan-item price has a different billing period from the current plan-item price, the subscription term resets automatically, regardless of the value of `force_term_reset`. **Constraints** If you pass `force_term_reset`, you must also pass `invoice_usages` with the same value when **all** of the following site configuration settings are enabled: \* [Usage-based billing](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/setting-up-usage-based-billing) \* Mid-term changes for usage-based items \* [Invoice and charge for usage-based items when a subscription is changing](https://www.chargebee.com/docs/billing/2.0/subscriptions/metered_billing#configuring-metered-billing) |
| `change_option` | `immediately \| end_of_term \| specific_date` | No | Specifies when the subscription change takes effect. **See also** \* [Impacts on existing scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#impact-scheduled-changes). \* end\_of\_term - **Deprecated** This option is deprecated; use the [Create a ramp API](https://docs.corsair.dev/docs/api/ramps/create-a-ramp) instead. The change is carried out at the end of the current billing cycle of the subscription. \* specific\_date - **Deprecated for scheduling changes** This option is deprecated for scheduling changes to occur at a future date-time, use the [Create a ramp API](https://docs.corsair.dev/docs/api/ramps/create-a-ramp) instead. Executes the change on a specified date. The change occurs as of the date-time defined in `changes_scheduled_at`. \* immediately - The subscription change takes effect immediately. |
| `changes_scheduled_at` | `number` | No | The date-time at which the subscription change is to happen or has happened. **Required if** \* `change_option` is set to `specific_date`. **Deprecated for scheduling changes** \* Setting this parameter to a future date-time for scheduling changes is deprecated. Use the [Create a ramp API](https://docs.corsair.dev/docs/api/ramps/create-a-ramp) instead. **Constraints** \* Do not pass this parameter along with `reactivate_from`. **Backdated changes** `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](https://www.chargebee.com/docs/billing/2.0/subscriptions/backdating#configuring-backdated-subscription-actions-and-invoicing) 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. |
| `invoice_usages` | `boolean` | No | Setting this attribute to `true` will invoice the overages for the metered items during the subscription change. **Constraints** If you pass `invoice_usages`, you must also pass `force_term_reset` with the same value when **all** of the following site configuration settings are enabled: \* [Usage-based billing](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/setting-up-usage-based-billing) \* Mid-term changes for usage-based items \* [Invoice and charge for usage-based items when a subscription is changing](https://www.chargebee.com/docs/billing/2.0/subscriptions/metered_billing#configuring-metered-billing) |
| `redirect_url` | `string` | No | The customers will be redirected to this URL upon successful checkout. The hosted page id and state will be passed as parameters to this URL. **Note** : \* Although the customer will be redirected to the `redirect_url` after successful checkout, we do not recommend relying on it for completing critical post-checkout actions. This is because redirection may not happen due to unforeseen reasons such as user closing the tab, or exiting the browser, and so on. If there is any synchronization that you are doing after the redirection, you will have to have a backup. Chargebee recommends listening to appropriate webhooks such as [`subscription_created`](https://docs.corsair.dev/docs/api/events) or [`invoice_generated`](https://docs.corsair.dev/docs/api/events) to verify a successful checkout. \* Redirect URL configured in Settings \\> Hosted Pages Settings would be overriden by this redirect URL. \* *Eg :* *[http://yoursite.com?id=\\\\\*\\\\\*\\\\\&state=succeeded](http://yoursite.com?id=\\\\*\\\\*\\\\\&state=succeeded)* \* This parameter is not applicable for iframe messaging. |
| `cancel_url` | `string` | No | The customers will be redirected to this URL upon canceling checkout. The hosted page id and state will be passed as parameters to this URL. **Note** : - Cancel URL configured in Settings \\> Hosted Pages Settings would be overriden by this cancel URL. *Eg : [http://yoursite.com?id=\\\\\&state=cancelled](http://yoursite.com?id=\\\\\&state=cancelled)* \* This parameter is not applicable for iframe messaging and [in-app](https://www.chargebee.com/docs/2.0/checkout.html) checkout. |
| `pass_thru_content` | `string` | No | This attribute allows you to store custom information with the `hosted_page` object. You can use it to associate specific data with a hosted page session. For example, you can store the ID of the marketing campaign that initiated the user session. After a successful checkout, when the customer is redirected, you can retrieve the hosted page ID from the [redirect URL](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription#redirect_url)'s query parameters. Using this ID, you can fetch the hosted page and perform actions related to the success of the marketing campaign. |
| `show_billing_frequency_selector` | `boolean` | No | — |
| `allow_offline_payment_methods` | `boolean` | No | Allow the customer to select an offline payment method during checkout. The choice of payment methods can be configured via the Chargebee UI. |
| `subscription` | `object` | No | Parameters for subscription |
| `customer` | `object` | No | Parameters for customer |
| `card` | `object` | No | Parameters for card |
| `contract_term` | `object` | No | Parameters for contract\_term |
| `subscription_items` | `object` | No | Parameters for subscription\_items |
| `discounts` | `object` | No | Parameters for discounts |
| `item_tiers` | `object` | No | Parameters for item\_tiers |
| `entity_identifiers` | `object` | No | Parameters for entity\_identifiers |
| `allowed_billing_frequencies` | `object` | No | — |

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id: string,
>   start_date?: number,
>   trial_end?: number,
>   auto_collection?: on | off,
>   offline_payment_method?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
>   invoice_notes?: string,
>   contract_term_billing_cycle_on_renewal?: number
> }
> ```

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   vat_number?: string,
>   vat_number_prefix?: string,
>   is_einvoice_enabled?: boolean,
>   entity_identifier_scheme?: string,
>   entity_identifier_standard?: string
> }
> ```

> [accordion] card full type
>
> ```ts theme={null}
> {
>   gateway_account_id?: string
> }
> ```

> [accordion] contract\_term full type
>
> ```ts theme={null}
> {
>   action_at_term_end?: renew | evergreen | cancel,
>   cancellation_cutoff_period?: number
> }
> ```

> [accordion] subscription\_items full type
>
> ```ts theme={null}
> {
>   item_price_id: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   unit_price?: number[],
>   unit_price_in_decimal?: string[],
>   billing_cycles?: number[],
>   trial_end?: number[],
>   service_period_days?: number[],
>   charge_on_event?: (subscription_creation | subscription_trial_start | plan_activation | subscription_activation | contract_termination)[],
>   charge_once?: boolean[],
>   charge_on_option?: (immediately | on_event)[]
> }
> ```

> [accordion] discounts full type
>
> ```ts theme={null}
> {
>   apply_on?: (invoice_amount | specific_item_price)[],
>   duration_type: (one_time | forever | limited_period)[],
>   percentage?: number[],
>   amount?: number[],
>   period?: number[],
>   period_unit?: (day | week | month | year)[],
>   included_in_mrr?: boolean[],
>   item_price_id?: string[],
>   quantity?: number[],
>   operation_type: (add | remove)[],
>   id?: string[]
> }
> ```

> [accordion] item\_tiers full type
>
> ```ts theme={null}
> {
>   item_price_id?: string[],
>   starting_unit?: number[],
>   ending_unit?: number[],
>   price?: number[],
>   starting_unit_in_decimal?: string[],
>   ending_unit_in_decimal?: string[],
>   price_in_decimal?: string[],
>   pricing_type?: (per_unit | flat_fee | package)[],
>   package_size?: number[]
> }
> ```

> [accordion] entity\_identifiers full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   scheme?: string[],
>   value?: string[],
>   operation?: (create | update | delete)[],
>   standard?: string[]
> }
> ```

> [accordion] allowed\_billing\_frequencies full type
>
> ```ts theme={null}
> {
>   period?: number[],
>   period_unit?: (day | week | month | year)[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `hosted_page` | `object \| null` | No | Hosted pages are the easiest way to integrate Chargebee with your website. For card payment methods, they help meet most of your PCI DSS compliance requirements. Chargebee offers hosted pages where your customers can perform the following actions: \* [Checkout a new subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription) \* [Checkout changes to an existing subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription) \* [Manage payment sources](https://docs.corsair.dev/docs/api/hosted_pages/manage-payment-sources) \* [Make payments for all due invoices](https://docs.corsair.dev/docs/api/hosted_pages/collect-now) \* [Extending a subscription](https://docs.corsair.dev/docs/api/hosted_pages/extend-subscription) When you create a hosted page, it is available at a secure and unique URL. This URL can then be provided to your customer on your website or by other means such as email. On successful completion of the hosted page workflow by the customer, they are redirected to the `redirect_url` with the hosted page `id` and `state` passed as query string parameters. As soon as the redirection happens, [retrieve the hosted page](https://docs.corsair.dev/docs/api/hosted_pages/retrieve-a-hosted-page) to get details of the customer, subscription, invoice etc. #### Embedding a hosted page Only the [Checkout](https://docs.corsair.dev/docs/api/hosted_pages/hosted-page-object#type) hosted page with the full-page [layout](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription#layout) supports embedding. To embed checkout in your website or application, use [embedded checkout](https://www.chargebee.com/docs/billing/2.0/hosted-capabilities/embedded-checkout.html) with Chargebee.js to mount checkout in a container on your page. Do not place hosted page URLs in your own [iframe](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe) elements---Chargebee.js creates and manages the iframe for you. |

> [accordion] hosted\_page full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   type?: string | null,
>   url?: string | null,
>   state?: string | null,
>   pass_thru_content?: string | null,
>   created_at?: number | null,
>   expires_at?: number | null,
>   layout?: string | null,
>   content?: {
>   } | null,
>   updated_at?: number | null,
>   resource_version?: number | null,
>   checkout_info?: {
>   } | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null
> } | null
> ```

***

### checkoutGift

`hostedPages.checkoutGift`

Checkout gift subscription. Creates a hosted page for a customer (called the gifter) to gift a subscription to another customer (called the receiver). Product Catalog 1.0 sites only.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.hostedPages.checkoutGift({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `redirect_url` | `string` | No | The customers will be redirected to this URL upon successful checkout. The hosted page id and state will be passed as parameters to this URL. **Note** : \* Although the customer will be redirected to the `redirect_url` after successful checkout, we do not recommend relying on it for completing critical post-checkout actions. This is because redirection may not happen due to unforeseen reasons such as user closing the tab, or exiting the browser, and so on. If there is any synchronization that you are doing after the redirection, you will have to have a backup. Chargebee recommends listening to appropriate webhooks such as [`subscription_created`](https://docs.corsair.dev/docs/api/events) or [`invoice_generated`](https://docs.corsair.dev/docs/api/events) to verify a successful checkout. \* Redirect URL configured in Settings \\> Hosted Pages Settings would be overriden by this redirect URL. \* *Eg :* *[http://yoursite.com?id=\\\\\*\\\\\*\\\\\&state=succeeded](http://yoursite.com?id=\\\\*\\\\*\\\\\&state=succeeded)* \* This parameter is not applicable for iframe messaging. |
| `coupon_ids` | `string[]` | No | List of coupons to be applied to this subscription. You can provide coupon ids or [coupon codes](https://docs.corsair.dev/docs/api/coupon_codes) . |
| `gifter` | `object` | No | Parameters for gifter |
| `subscription` | `object` | No | Parameters for subscription |
| `addons` | `object` | No | Parameters for addons |

> [accordion] gifter full type
>
> ```ts theme={null}
> {
>   customer_id?: string,
>   locale?: string
> }
> ```

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   plan_id: string,
>   plan_quantity?: number,
>   plan_quantity_in_decimal?: string
> }
> ```

> [accordion] addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `hosted_page` | `object \| null` | No | Hosted pages are the easiest and most secure way to integrate chargebee with your website. By using hosted pages, you can avoid the sensitive card information passing through your server and be compliant with most of the PCI DSS requirements. When you request for a hosted page, a **secure** and **unique URL** will be returned which you could either embed or redirect depending upon the embed parameter value that you had passed. Specifying **"embed"** parameter as **true** allows you to embed the "hosted page" in an iframe in your own website. This helps you provide the best experience to your user as they do not have to leave your website to provide card information. There are a few limitations: \* Your site URL must be embedded with HTTPS. \* Set the appropriate height and width for the iframe to avoid scrolling. To use the hosted pages, you must configure **Redirect URL** in the Chargebee web interface under **Hosted Pages Settings** \\> **Configuration**. The configured redirect URL will be called with the following parameters after user had submitted the page. \* **id** - unique identifier of the hosted page resource \* **state** - succeeded, failed or cancelled After the **Redirect URL** is called by Chargebee with the above parameters, the details of the hosted page can be fetched using [Retrieve a hosted page](https://docs.corsair.dev/docs/api/v2/pcv-1/hosted_pages/retrieve-a-hosted-page) API. The **content** attribute will have the details about the customer, subscription, card and invoice based on the type of the hosted page. [Checkout New Subscription](https://docs.corsair.dev/docs/api/v2/pcv-1/hosted_pages/checkout-new-subscription): \* [Customer](https://docs.corsair.dev/docs/api/customers/customer-object) - The details about the new customer created. \* [Subscription](https://docs.corsair.dev/docs/api/subscriptions/subscription-object) - The details about the new subscription created. \* [Card](https://docs.corsair.dev/docs/api/cards/card-object) - The details about the card provided while subscribing. \* [Invoice](https://docs.corsair.dev/docs/api/invoices/invoice-object) - The details about the invoice, if one is generated. [Checkout Existing Subscription](https://docs.corsair.dev/docs/api/v2/pcv-1/hosted_pages/checkout-existing-subscription): \* [Customer](https://docs.corsair.dev/docs/api/customers/customer-object) - The updated details of the customer. \* [Subscription](https://docs.corsair.dev/docs/api/subscriptions/subscription-object) - The updated details of the subscription. \* [Card](https://docs.corsair.dev/docs/api/cards/card-object) - The details about the card provided while subscribing. \* [Invoice](https://docs.corsair.dev/docs/api/invoices/invoice-object) - The details about the invoice, if one is generated. [Manage Payment Sources](https://docs.corsair.dev/docs/api/v2/pcv-1/hosted_pages/manage-payment-sources): \* [Customer](https://docs.corsair.dev/docs/api/customers/customer-object) - The details about the customer for whom the card was updated. \* [Card](https://docs.corsair.dev/docs/api/cards/card-object) - The details about the updated card. It will be present only if the type of payment method is card. When an embedded hosted page is cancelled by your end user, the **content** attribute will have the unmodified details of customer, subscription and card resources. |

> [accordion] hosted\_page full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   type?: string | null,
>   url?: string | null,
>   state?: string | null,
>   pass_thru_content?: string | null,
>   embed?: boolean | null,
>   created_at?: number | null,
>   expires_at?: number | null,
>   layout?: string | null,
>   content?: {
>   } | null,
>   updated_at?: number | null,
>   resource_version?: number | null,
>   checkout_info?: {
>   } | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null
> } | null
> ```

***

### checkoutGiftForItems

`hostedPages.checkoutGiftForItems`

Checkout gift subscription for items. Creates a hosted page for a customer (called the gifter) to gift a subscription to another customer (called the receiver).

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.hostedPages.checkoutGiftForItems({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `layout` | `in_app \| full_page` | No | Specifies the UI layout for the hosted page. This overrides [the layout](https://www.chargebee.com/docs/billing/2.0/hosted-capabilities/hosted-checkout#ui-layout-options) configured in Chargebee Billing. \* in\_app - Renders the hosted page in an in-app layout. \* full\_page - Renders the hosted page in a full-page layout. |
| `business_entity_id` | `string` | No | Sets the [context]() for this operation to the [business entity](https://docs.corsair.dev/docs/api/advanced-features) specified. Applicable only when multiple business entities have been created for the site. When this parameter is provided, the operation is able to read/write data associated only to the business entity specified. When not provided, the operation can read/write data for the entire site. **Note** An alternative way of passing this parameter is by means of a [custom HTTP header](https://docs.corsair.dev/docs/api/advanced-features). **See also** Gifter customer resource lookup and creation. |
| `brand_id` | `string` | No | The unique ID of the [brand](https://docs.corsair.dev/docs/api/brands) this hosted page should be linked to. Applicable only when multiple brands have been created for the site. Resources created through the hosted page, such as the customer and the subscription, are linked to the same brand. An alternative way of passing this parameter is by means of the `chargebee-brand-id` custom HTTP header; when both are provided, they must specify the same brand. **Default behavior** \* When not provided, the brand of the customer or subscription referenced in the request is used, or the default brand defined for the site when the request references neither. |
| `redirect_url` | `string` | No | The customers will be redirected to this URL upon successful checkout. The hosted page id and state will be passed as parameters to this URL. **Note** : \* Although the customer will be redirected to the `redirect_url` after successful checkout, we do not recommend relying on it for completing critical post-checkout actions. This is because redirection may not happen due to unforeseen reasons such as user closing the tab, or exiting the browser, and so on. If there is any synchronization that you are doing after the redirection, you will have to have a backup. Chargebee recommends listening to appropriate webhooks such as [`subscription_created`](https://docs.corsair.dev/docs/api/events) or [`invoice_generated`](https://docs.corsair.dev/docs/api/events) to verify a successful checkout. \* Redirect URL configured in Settings \\> Hosted Pages Settings would be overriden by this redirect URL. \* *Eg :* *[http://yoursite.com?id=\\\\\*\\\\\*\\\\\&state=succeeded](http://yoursite.com?id=\\\\*\\\\*\\\\\&state=succeeded)* \* This parameter is not applicable for iframe messaging. |
| `coupon_ids` | `string[]` | No | List of coupons to be applied to this subscription. You can provide coupon ids or [coupon codes](https://docs.corsair.dev/docs/api/coupon_codes) . |
| `show_billing_frequency_selector` | `boolean` | No | — |
| `gifter` | `object` | No | Parameters for gifter |
| `subscription_items` | `object` | No | Parameters for subscription\_items |
| `item_tiers` | `object` | No | Parameters for item\_tiers |
| `allowed_billing_frequencies` | `object` | No | — |

> [accordion] gifter full type
>
> ```ts theme={null}
> {
>   customer_id?: string,
>   locale?: string
> }
> ```

> [accordion] subscription\_items full type
>
> ```ts theme={null}
> {
>   item_price_id?: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   unit_price?: number[],
>   unit_price_in_decimal?: string[]
> }
> ```

> [accordion] item\_tiers full type
>
> ```ts theme={null}
> {
>   item_price_id?: string[],
>   starting_unit?: number[],
>   ending_unit?: number[],
>   price?: number[],
>   starting_unit_in_decimal?: string[],
>   ending_unit_in_decimal?: string[],
>   price_in_decimal?: string[]
> }
> ```

> [accordion] allowed\_billing\_frequencies full type
>
> ```ts theme={null}
> {
>   period?: number[],
>   period_unit?: (day | week | month | year)[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `hosted_page` | `object \| null` | No | Hosted pages are the easiest way to integrate Chargebee with your website. For card payment methods, they help meet most of your PCI DSS compliance requirements. Chargebee offers hosted pages where your customers can perform the following actions: \* [Checkout a new subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription) \* [Checkout changes to an existing subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription) \* [Manage payment sources](https://docs.corsair.dev/docs/api/hosted_pages/manage-payment-sources) \* [Make payments for all due invoices](https://docs.corsair.dev/docs/api/hosted_pages/collect-now) \* [Extending a subscription](https://docs.corsair.dev/docs/api/hosted_pages/extend-subscription) When you create a hosted page, it is available at a secure and unique URL. This URL can then be provided to your customer on your website or by other means such as email. On successful completion of the hosted page workflow by the customer, they are redirected to the `redirect_url` with the hosted page `id` and `state` passed as query string parameters. As soon as the redirection happens, [retrieve the hosted page](https://docs.corsair.dev/docs/api/hosted_pages/retrieve-a-hosted-page) to get details of the customer, subscription, invoice etc. #### Embedding a hosted page Only the [Checkout](https://docs.corsair.dev/docs/api/hosted_pages/hosted-page-object#type) hosted page with the full-page [layout](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription#layout) supports embedding. To embed checkout in your website or application, use [embedded checkout](https://www.chargebee.com/docs/billing/2.0/hosted-capabilities/embedded-checkout.html) with Chargebee.js to mount checkout in a container on your page. Do not place hosted page URLs in your own [iframe](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe) elements---Chargebee.js creates and manages the iframe for you. |

> [accordion] hosted\_page full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   type?: string | null,
>   url?: string | null,
>   state?: string | null,
>   pass_thru_content?: string | null,
>   created_at?: number | null,
>   expires_at?: number | null,
>   layout?: string | null,
>   content?: {
>   } | null,
>   updated_at?: number | null,
>   resource_version?: number | null,
>   checkout_info?: {
>   } | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null
> } | null
> ```

***

### checkoutNew

`hostedPages.checkoutNew`

Checkout new subscription. Hosted page to accept card details from the subscriber and create a new subscription. This is similar to our server to server API Create a Subscription. When the redirect URL is notified of the result, we would advise you to retrieve the subscription and verify the details. Product Catalog 1.0 sites only.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.hostedPages.checkoutNew({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `billing_cycles` | `number` | No | Number of cycles(plan interval) this subscription should be charged. After the billing cycles exhausted, the subscription will be cancelled. |
| `mandatory_addons_to_remove` | `string[]` | No | List of addons IDs that are mandatory to the plan and has to be removed from the subscription. |
| `terms_to_charge` | `number` | No | 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` | `immediate \| delayed` | No | 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. \* 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` | `string[]` | No | List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes. |
| `redirect_url` | `string` | No | The customers will be redirected to this URL upon successful checkout. The hosted page id and state will be passed as parameters to this URL. **Note** : \* Although the customer will be redirected to the `redirect_url` after successful checkout, we do not recommend relying on it for completing critical post-checkout actions. This is because redirection may not happen due to unforeseen reasons such as user closing the tab, or exiting the browser, and so on. If there is any synchronization that you are doing after the redirection, you will have to have a backup. Chargebee recommends listening to appropriate webhooks such as [`subscription_created`](https://docs.corsair.dev/docs/api/events) or [`invoice_generated`](https://docs.corsair.dev/docs/api/events) to verify a successful checkout. \* Redirect URL configured in Settings \\> Hosted Pages Settings would be overriden by this redirect URL. \* *Eg :* *[http://yoursite.com?id=\\\\\*\\\\\*\\\\\&state=succeeded](http://yoursite.com?id=\\\\*\\\\*\\\\\&state=succeeded)* \* This parameter is not applicable for iframe messaging. |
| `cancel_url` | `string` | No | The customers will be redirected to this URL upon canceling checkout. The hosted page id and state will be passed as parameters to this URL. **Note** : - Cancel URL configured in Settings \\> Hosted Pages Settings would be overriden by this cancel URL. *Eg : [http://yoursite.com?id=\\\\\&state=cancelled](http://yoursite.com?id=\\\\\&state=cancelled)* \* This parameter is not applicable for iframe messaging and [in-app](https://www.chargebee.com/docs/2.0/checkout.html) checkout. |
| `pass_thru_content` | `string` | No | This attribute allows you to store custom information with the `hosted_page` object. You can use it to associate specific data with a hosted page session. For example, you can store the ID of the marketing campaign that initiated the user session. After a successful checkout, when the customer is redirected, you can retrieve the hosted page ID from the [redirect URL](https://docs.corsair.dev/docs/api/v2/pcv-1/hosted_pages/checkout-new-subscription#redirect_url)'s query parameters. Using this ID, you can fetch the hosted page and perform actions related to the success of the marketing campaign. |
| `embed` | `boolean` | No | If true then hosted page formatted to be shown in iframe. If false, it is formatted to be shown as a separate page. **Note** : For [in-app](https://www.chargebee.com/docs/checkout-v3.html) checkout, default is false. |
| `iframe_messaging` | `boolean` | No | If true then iframe will communicate with the parent window. Applicable only for embedded(iframe) hosted pages. If you're using iframe\_messaging you need to implement onSuccess \\& onCancel callbacks. **Note** : This parameter is not applicable for [in-app](https://www.chargebee.com/docs/checkout-v3.html) checkout. |
| `allow_offline_payment_methods` | `boolean` | No | Allow the customer to select an offline payment method during checkout. The choice of payment methods can be configured via the Chargebee UI. |
| `subscription` | `object` | No | Parameters for subscription |
| `customer` | `object` | No | Parameters for customer |
| `card` | `object` | No | Parameters for card |
| `billing_address` | `object` | No | Parameters for billing\_address |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `contract_term` | `object` | No | Parameters for contract\_term |
| `addons` | `object` | No | Parameters for addons |
| `event_based_addons` | `object` | No | Parameters for event\_based\_addons |

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id?: string,
>   plan_id: string,
>   plan_quantity?: number,
>   plan_quantity_in_decimal?: string,
>   plan_unit_price?: number,
>   plan_unit_price_in_decimal?: string,
>   setup_fee?: number,
>   trial_end?: number,
>   start_date?: number,
>   auto_collection?: on | off,
>   offline_payment_method?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
>   invoice_notes?: string,
>   affiliate_token?: string,
>   contract_term_billing_cycle_on_renewal?: number
> }
> ```

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string,
>   email?: string,
>   first_name?: string,
>   last_name?: string,
>   company?: string,
>   phone?: string,
>   locale?: string,
>   taxability?: taxable | exempt | zero_rated,
>   vat_number?: string,
>   vat_number_prefix?: string,
>   consolidated_invoicing?: boolean
> }
> ```

> [accordion] card full type
>
> ```ts theme={null}
> {
>   gateway_account_id?: string
> }
> ```

> [accordion] billing\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] contract\_term full type
>
> ```ts theme={null}
> {
>   action_at_term_end?: renew | evergreen | cancel,
>   cancellation_cutoff_period?: number
> }
> ```

> [accordion] addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   unit_price?: number[],
>   unit_price_in_decimal?: string[],
>   billing_cycles?: number[]
> }
> ```

> [accordion] event\_based\_addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   unit_price?: number[],
>   quantity_in_decimal?: string[],
>   unit_price_in_decimal?: string[],
>   service_period_in_days?: number[],
>   on_event?: (subscription_creation | subscription_trial_start | plan_activation | subscription_activation | contract_termination)[],
>   charge_once?: boolean[],
>   charge_on?: (immediately | on_event)[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `hosted_page` | `object \| null` | No | Hosted pages are the easiest and most secure way to integrate chargebee with your website. By using hosted pages, you can avoid the sensitive card information passing through your server and be compliant with most of the PCI DSS requirements. When you request for a hosted page, a **secure** and **unique URL** will be returned which you could either embed or redirect depending upon the embed parameter value that you had passed. Specifying **"embed"** parameter as **true** allows you to embed the "hosted page" in an iframe in your own website. This helps you provide the best experience to your user as they do not have to leave your website to provide card information. There are a few limitations: \* Your site URL must be embedded with HTTPS. \* Set the appropriate height and width for the iframe to avoid scrolling. To use the hosted pages, you must configure **Redirect URL** in the Chargebee web interface under **Hosted Pages Settings** \\> **Configuration**. The configured redirect URL will be called with the following parameters after user had submitted the page. \* **id** - unique identifier of the hosted page resource \* **state** - succeeded, failed or cancelled After the **Redirect URL** is called by Chargebee with the above parameters, the details of the hosted page can be fetched using [Retrieve a hosted page](https://docs.corsair.dev/docs/api/v2/pcv-1/hosted_pages/retrieve-a-hosted-page) API. The **content** attribute will have the details about the customer, subscription, card and invoice based on the type of the hosted page. [Checkout New Subscription](https://docs.corsair.dev/docs/api/v2/pcv-1/hosted_pages/checkout-new-subscription): \* [Customer](https://docs.corsair.dev/docs/api/customers/customer-object) - The details about the new customer created. \* [Subscription](https://docs.corsair.dev/docs/api/subscriptions/subscription-object) - The details about the new subscription created. \* [Card](https://docs.corsair.dev/docs/api/cards/card-object) - The details about the card provided while subscribing. \* [Invoice](https://docs.corsair.dev/docs/api/invoices/invoice-object) - The details about the invoice, if one is generated. [Checkout Existing Subscription](https://docs.corsair.dev/docs/api/v2/pcv-1/hosted_pages/checkout-existing-subscription): \* [Customer](https://docs.corsair.dev/docs/api/customers/customer-object) - The updated details of the customer. \* [Subscription](https://docs.corsair.dev/docs/api/subscriptions/subscription-object) - The updated details of the subscription. \* [Card](https://docs.corsair.dev/docs/api/cards/card-object) - The details about the card provided while subscribing. \* [Invoice](https://docs.corsair.dev/docs/api/invoices/invoice-object) - The details about the invoice, if one is generated. [Manage Payment Sources](https://docs.corsair.dev/docs/api/v2/pcv-1/hosted_pages/manage-payment-sources): \* [Customer](https://docs.corsair.dev/docs/api/customers/customer-object) - The details about the customer for whom the card was updated. \* [Card](https://docs.corsair.dev/docs/api/cards/card-object) - The details about the updated card. It will be present only if the type of payment method is card. When an embedded hosted page is cancelled by your end user, the **content** attribute will have the unmodified details of customer, subscription and card resources. |

> [accordion] hosted\_page full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   type?: string | null,
>   url?: string | null,
>   state?: string | null,
>   pass_thru_content?: string | null,
>   embed?: boolean | null,
>   created_at?: number | null,
>   expires_at?: number | null,
>   layout?: string | null,
>   content?: {
>   } | null,
>   updated_at?: number | null,
>   resource_version?: number | null,
>   checkout_info?: {
>   } | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null
> } | null
> ```

***

### checkoutNewForItems

`hostedPages.checkoutNewForItems`

Create checkout for a new subscription. Create a Chargebee hosted page to accept payment details from a customer and checkout a new subscription.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.hostedPages.checkoutNewForItems({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `layout` | `in_app \| full_page` | No | Specifies the UI layout for the hosted page. This overrides [the layout](https://www.chargebee.com/docs/billing/2.0/hosted-capabilities/hosted-checkout#ui-layout-options) configured in Chargebee Billing. \* in\_app - Renders the hosted page in an in-app layout. \* full\_page - Renders the hosted page in a full-page layout. |
| `business_entity_id` | `string` | No | Sets the [context]() for this operation to the [business entity](https://docs.corsair.dev/docs/api/advanced-features) specified. Applicable only when multiple business entities have been created for the site. When this parameter is provided, the operation is able to read/write data associated only to the business entity specified. When not provided, the operation can read/write data for the entire site. **Note** An alternative way of passing this parameter is by means of a [custom HTTP header](https://docs.corsair.dev/docs/api/advanced-features). **See also** [Customer resource lookup and creation.](https://docs.corsair.dev/docs/api/hosted_pages) |
| `brand_id` | `string` | No | The unique ID of the [brand](https://docs.corsair.dev/docs/api/brands) this hosted page should be linked to. Applicable only when multiple brands have been created for the site. Resources created through the hosted page, such as the customer and the subscription, are linked to the same brand. An alternative way of passing this parameter is by means of the `chargebee-brand-id` custom HTTP header; when both are provided, they must specify the same brand. **Default behavior** \* When not provided, the brand of the customer or subscription referenced in the request is used, or the default brand defined for the site when the request references neither. |
| `billing_cycles` | `number` | No | The number of billing cycles the subscription runs before canceling. If not provided, then the billing cycles [set for the plan-item price](https://docs.corsair.dev/docs/api/item_prices/item_price-object#billing_cycles) is used. |
| `mandatory_items_to_remove` | `string[]` | No | Item ids of [mandatorily attached addons](https://docs.corsair.dev/docs/api/attached_items) that are to be removed from the subscription. |
| `terms_to_charge` | `number` | No | 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` | `immediate \| delayed` | No | 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. \* 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` | `string[]` | No | List of coupons to be applied to this subscription. You can provide coupon ids or [coupon codes](https://docs.corsair.dev/docs/api/coupon_codes) . |
| `redirect_url` | `string` | No | The customers will be redirected to this URL upon successful checkout. The hosted page id and state will be passed as parameters to this URL. **Note** : \* Although the customer will be redirected to the `redirect_url` after successful checkout, we do not recommend relying on it for completing critical post-checkout actions. This is because redirection may not happen due to unforeseen reasons such as user closing the tab, or exiting the browser, and so on. If there is any synchronization that you are doing after the redirection, you will have to have a backup. Chargebee recommends listening to appropriate webhooks such as [`subscription_created`](https://docs.corsair.dev/docs/api/events) or [`invoice_generated`](https://docs.corsair.dev/docs/api/events) to verify a successful checkout. \* Redirect URL configured in Settings \\> Hosted Pages Settings would be overriden by this redirect URL. \* *Eg :* *[http://yoursite.com?id=\\\\\*\\\\\*\\\\\&state=succeeded](http://yoursite.com?id=\\\\*\\\\*\\\\\&state=succeeded)* \* This parameter is not applicable for iframe messaging. |
| `cancel_url` | `string` | No | The customers will be redirected to this URL upon canceling checkout. The hosted page id and state will be passed as parameters to this URL. **Note** : - Cancel URL configured in Settings \\> Hosted Pages Settings would be overriden by this cancel URL. *Eg : [http://yoursite.com?id=\\\\\&state=cancelled](http://yoursite.com?id=\\\\\&state=cancelled)* \* This parameter is not applicable for iframe messaging and [in-app](https://www.chargebee.com/docs/2.0/checkout.html) checkout. |
| `pass_thru_content` | `string` | No | This attribute allows you to store custom information with the `hosted_page` object. You can use it to associate specific data with a hosted page session. For example, you can store the ID of the marketing campaign that initiated the user session. After a successful checkout, when the customer is redirected, you can retrieve the hosted page ID from the [redirect URL](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription#redirect_url)'s query parameters. Using this ID, you can fetch the hosted page and perform actions related to the success of the marketing campaign. |
| `show_billing_frequency_selector` | `boolean` | No | — |
| `allow_offline_payment_methods` | `boolean` | No | Allow the customer to select an offline payment method during checkout. The choice of payment methods can be configured via the Chargebee UI. |
| `subscription` | `object` | No | Parameters for subscription |
| `customer` | `object` | No | Parameters for customer |
| `card` | `object` | No | Parameters for card |
| `billing_address` | `object` | No | Parameters for billing\_address |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `contract_term` | `object` | No | Parameters for contract\_term |
| `subscription_items` | `object` | No | Parameters for subscription\_items |
| `discounts` | `object` | No | Parameters for discounts |
| `item_tiers` | `object` | No | Parameters for item\_tiers |
| `entity_identifiers` | `object` | No | Parameters for entity\_identifiers |
| `allowed_billing_frequencies` | `object` | No | — |

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id?: string,
>   trial_end?: number,
>   start_date?: number,
>   coupon?: string,
>   auto_collection?: on | off,
>   offline_payment_method?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
>   invoice_notes?: string,
>   po_number?: string,
>   contract_term_billing_cycle_on_renewal?: number
> }
> ```

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string,
>   email?: string,
>   first_name?: string,
>   last_name?: string,
>   company?: string,
>   phone?: string,
>   locale?: string,
>   taxability?: taxable | exempt | zero_rated,
>   vat_number?: string,
>   vat_number_prefix?: string,
>   is_einvoice_enabled?: boolean,
>   entity_identifier_scheme?: string,
>   entity_identifier_standard?: string,
>   einvoicing_method?: automatic | manual | site_default
> }
> ```

> [accordion] card full type
>
> ```ts theme={null}
> {
>   gateway_account_id?: string
> }
> ```

> [accordion] billing\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] contract\_term full type
>
> ```ts theme={null}
> {
>   action_at_term_end?: renew | evergreen | cancel,
>   cancellation_cutoff_period?: number
> }
> ```

> [accordion] subscription\_items full type
>
> ```ts theme={null}
> {
>   item_price_id: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   unit_price?: number[],
>   unit_price_in_decimal?: string[],
>   billing_cycles?: number[],
>   trial_end?: number[],
>   service_period_days?: number[],
>   charge_on_event?: (subscription_creation | subscription_trial_start | plan_activation | subscription_activation | contract_termination)[],
>   charge_once?: boolean[],
>   charge_on_option?: (immediately | on_event)[]
> }
> ```

> [accordion] discounts full type
>
> ```ts theme={null}
> {
>   apply_on?: (invoice_amount | specific_item_price)[],
>   duration_type: (one_time | forever | limited_period)[],
>   percentage?: number[],
>   amount?: number[],
>   period?: number[],
>   period_unit?: (day | week | month | year)[],
>   included_in_mrr?: boolean[],
>   item_price_id?: string[],
>   quantity?: number[]
> }
> ```

> [accordion] item\_tiers full type
>
> ```ts theme={null}
> {
>   item_price_id?: string[],
>   starting_unit?: number[],
>   ending_unit?: number[],
>   price?: number[],
>   starting_unit_in_decimal?: string[],
>   ending_unit_in_decimal?: string[],
>   price_in_decimal?: string[],
>   pricing_type?: (per_unit | flat_fee | package)[],
>   package_size?: number[]
> }
> ```

> [accordion] entity\_identifiers full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   scheme?: string[],
>   value?: string[],
>   operation?: (create | update | delete)[],
>   standard?: string[]
> }
> ```

> [accordion] allowed\_billing\_frequencies full type
>
> ```ts theme={null}
> {
>   period?: number[],
>   period_unit?: (day | week | month | year)[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `hosted_page` | `object \| null` | No | Hosted pages are the easiest way to integrate Chargebee with your website. For card payment methods, they help meet most of your PCI DSS compliance requirements. Chargebee offers hosted pages where your customers can perform the following actions: \* [Checkout a new subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription) \* [Checkout changes to an existing subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription) \* [Manage payment sources](https://docs.corsair.dev/docs/api/hosted_pages/manage-payment-sources) \* [Make payments for all due invoices](https://docs.corsair.dev/docs/api/hosted_pages/collect-now) \* [Extending a subscription](https://docs.corsair.dev/docs/api/hosted_pages/extend-subscription) When you create a hosted page, it is available at a secure and unique URL. This URL can then be provided to your customer on your website or by other means such as email. On successful completion of the hosted page workflow by the customer, they are redirected to the `redirect_url` with the hosted page `id` and `state` passed as query string parameters. As soon as the redirection happens, [retrieve the hosted page](https://docs.corsair.dev/docs/api/hosted_pages/retrieve-a-hosted-page) to get details of the customer, subscription, invoice etc. #### Embedding a hosted page Only the [Checkout](https://docs.corsair.dev/docs/api/hosted_pages/hosted-page-object#type) hosted page with the full-page [layout](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription#layout) supports embedding. To embed checkout in your website or application, use [embedded checkout](https://www.chargebee.com/docs/billing/2.0/hosted-capabilities/embedded-checkout.html) with Chargebee.js to mount checkout in a container on your page. Do not place hosted page URLs in your own [iframe](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe) elements---Chargebee.js creates and manages the iframe for you. |

> [accordion] hosted\_page full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   type?: string | null,
>   url?: string | null,
>   state?: string | null,
>   pass_thru_content?: string | null,
>   created_at?: number | null,
>   expires_at?: number | null,
>   layout?: string | null,
>   content?: {
>   } | null,
>   updated_at?: number | null,
>   resource_version?: number | null,
>   checkout_info?: {
>   } | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null
> } | null
> ```

***

### checkoutOneTime

`hostedPages.checkoutOneTime`

Checkout one-time payments. Create a Chargebee hosted page to accept payment from a customer and checkout non-recurring addons and one-time charges. The following steps describe how best to use this API: 1. Product Catalog 1.0 sites only.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.hostedPages.checkoutOneTime({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `currency_code` | `string` | No | The currency code (ISO 4217 format) of the invoice amount. |
| `invoice_note` | `string` | No | A note for this particular invoice. This, and [all other notes](https://docs.corsair.dev/docs/api/invoices/invoice-object#notes) for the invoice are displayed on the PDF invoice sent to the customer. |
| `coupon_ids` | `string[]` | No | Identifier of the coupon as a List. Coupon Codes can also be passed. |
| `redirect_url` | `string` | No | The customers will be redirected to this URL upon successful checkout. The hosted page id and state will be passed as parameters to this URL. **Note** : \* Although the customer will be redirected to the `redirect_url` after successful checkout, we do not recommend relying on it for completing critical post-checkout actions. This is because redirection may not happen due to unforeseen reasons such as user closing the tab, or exiting the browser, and so on. If there is any synchronization that you are doing after the redirection, you will have to have a backup. Chargebee recommends listening to appropriate webhooks such as [`subscription_created`](https://docs.corsair.dev/docs/api/events) or [`invoice_generated`](https://docs.corsair.dev/docs/api/events) to verify a successful checkout. \* Redirect URL configured in Settings \\> Hosted Pages Settings would be overriden by this redirect URL. \* *Eg :* *[http://yoursite.com?id=\\\\\*\\\\\*\\\\\&state=succeeded](http://yoursite.com?id=\\\\*\\\\*\\\\\&state=succeeded)* \* This parameter is not applicable for iframe messaging. |
| `cancel_url` | `string` | No | The customers will be redirected to this URL upon canceling checkout. The hosted page id and state will be passed as parameters to this URL. **Note** : - Cancel URL configured in Settings \\> Hosted Pages Settings would be overriden by this cancel URL. *Eg : [http://yoursite.com?id=\\\\\&state=cancelled](http://yoursite.com?id=\\\\\&state=cancelled)* \* This parameter is not applicable for iframe messaging and [in-app](https://www.chargebee.com/docs/2.0/checkout.html) checkout. |
| `pass_thru_content` | `string` | No | This attribute allows you to store custom information with the `hosted_page` object. You can use it to associate specific data with a hosted page session. For example, you can store the ID of the marketing campaign that initiated the user session. After a successful checkout, when the customer is redirected, you can retrieve the hosted page ID from the [redirect URL](https://docs.corsair.dev/docs/api/v2/pcv-1/hosted_pages/checkout-one-time-payments)'s query parameters. Using this ID, you can fetch the hosted page and perform actions related to the success of the marketing campaign. |
| `embed` | `boolean` | No | If true then hosted page formatted to be shown in iframe. If false, it is formatted to be shown as a separate page. **Note** : For [in-app](https://www.chargebee.com/docs/checkout-v3.html) checkout, default is false. |
| `iframe_messaging` | `boolean` | No | If true then iframe will communicate with the parent window. Applicable only for embedded(iframe) hosted pages. If you're using iframe\_messaging you need to implement onSuccess \\& onCancel callbacks. **Note** : This parameter is not applicable for [in-app](https://www.chargebee.com/docs/checkout-v3.html) checkout. |
| `customer` | `object` | No | Parameters for customer |
| `invoice` | `object` | No | Parameters for invoice |
| `card` | `object` | No | Parameters for card |
| `billing_address` | `object` | No | Parameters for billing\_address |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `addons` | `object` | No | Parameters for addons |
| `charges` | `object` | No | Parameters for charges |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string,
>   email?: string,
>   first_name?: string,
>   last_name?: string,
>   company?: string,
>   phone?: string,
>   locale?: string,
>   taxability?: taxable | exempt | zero_rated,
>   vat_number?: string,
>   vat_number_prefix?: string,
>   consolidated_invoicing?: boolean
> }
> ```

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   po_number?: string
> }
> ```

> [accordion] card full type
>
> ```ts theme={null}
> {
>   gateway_account_id?: string
> }
> ```

> [accordion] billing\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   unit_price?: number[],
>   quantity_in_decimal?: string[],
>   unit_price_in_decimal?: string[],
>   date_from?: number[],
>   date_to?: number[]
> }
> ```

> [accordion] charges full type
>
> ```ts theme={null}
> {
>   amount?: number[],
>   amount_in_decimal?: string[],
>   description?: string[],
>   taxable?: boolean[],
>   tax_profile_id?: string[],
>   avalara_tax_code?: string[],
>   hsn_code?: string[],
>   taxjar_product_code?: string[],
>   avalara_sale_type?: (wholesale | retail | consumed | vendor_use)[],
>   avalara_transaction_type?: number[],
>   avalara_service_type?: number[],
>   date_from?: number[],
>   date_to?: number[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `hosted_page` | `object \| null` | No | Hosted pages are the easiest and most secure way to integrate chargebee with your website. By using hosted pages, you can avoid the sensitive card information passing through your server and be compliant with most of the PCI DSS requirements. When you request for a hosted page, a **secure** and **unique URL** will be returned which you could either embed or redirect depending upon the embed parameter value that you had passed. Specifying **"embed"** parameter as **true** allows you to embed the "hosted page" in an iframe in your own website. This helps you provide the best experience to your user as they do not have to leave your website to provide card information. There are a few limitations: \* Your site URL must be embedded with HTTPS. \* Set the appropriate height and width for the iframe to avoid scrolling. To use the hosted pages, you must configure **Redirect URL** in the Chargebee web interface under **Hosted Pages Settings** \\> **Configuration**. The configured redirect URL will be called with the following parameters after user had submitted the page. \* **id** - unique identifier of the hosted page resource \* **state** - succeeded, failed or cancelled After the **Redirect URL** is called by Chargebee with the above parameters, the details of the hosted page can be fetched using [Retrieve a hosted page](https://docs.corsair.dev/docs/api/v2/pcv-1/hosted_pages/retrieve-a-hosted-page) API. The **content** attribute will have the details about the customer, subscription, card and invoice based on the type of the hosted page. [Checkout New Subscription](https://docs.corsair.dev/docs/api/v2/pcv-1/hosted_pages/checkout-new-subscription): \* [Customer](https://docs.corsair.dev/docs/api/customers/customer-object) - The details about the new customer created. \* [Subscription](https://docs.corsair.dev/docs/api/subscriptions/subscription-object) - The details about the new subscription created. \* [Card](https://docs.corsair.dev/docs/api/cards/card-object) - The details about the card provided while subscribing. \* [Invoice](https://docs.corsair.dev/docs/api/invoices/invoice-object) - The details about the invoice, if one is generated. [Checkout Existing Subscription](https://docs.corsair.dev/docs/api/v2/pcv-1/hosted_pages/checkout-existing-subscription): \* [Customer](https://docs.corsair.dev/docs/api/customers/customer-object) - The updated details of the customer. \* [Subscription](https://docs.corsair.dev/docs/api/subscriptions/subscription-object) - The updated details of the subscription. \* [Card](https://docs.corsair.dev/docs/api/cards/card-object) - The details about the card provided while subscribing. \* [Invoice](https://docs.corsair.dev/docs/api/invoices/invoice-object) - The details about the invoice, if one is generated. [Manage Payment Sources](https://docs.corsair.dev/docs/api/v2/pcv-1/hosted_pages/manage-payment-sources): \* [Customer](https://docs.corsair.dev/docs/api/customers/customer-object) - The details about the customer for whom the card was updated. \* [Card](https://docs.corsair.dev/docs/api/cards/card-object) - The details about the updated card. It will be present only if the type of payment method is card. When an embedded hosted page is cancelled by your end user, the **content** attribute will have the unmodified details of customer, subscription and card resources. |

> [accordion] hosted\_page full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   type?: string | null,
>   url?: string | null,
>   state?: string | null,
>   pass_thru_content?: string | null,
>   embed?: boolean | null,
>   created_at?: number | null,
>   expires_at?: number | null,
>   layout?: string | null,
>   content?: {
>   } | null,
>   updated_at?: number | null,
>   resource_version?: number | null,
>   checkout_info?: {
>   } | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null
> } | null
> ```

***

### checkoutOneTimeForItems

`hostedPages.checkoutOneTimeForItems`

Checkout charge-items and one-time charges. Create a Chargebee hosted page to accept payment details from a customer and checkout charge-items and one-time charges. The following steps describe how best to use this API: 1.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.hostedPages.checkoutOneTimeForItems({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `business_entity_id` | `string` | No | Sets the [context]() for this operation to the [business entity](https://docs.corsair.dev/docs/api/advanced-features) specified. Applicable only when multiple business entities have been created for the site. When this parameter is provided, the operation is able to read/write data associated only to the business entity specified. When not provided, the operation can read/write data for the entire site. **Note** An alternative way of passing this parameter is by means of a [custom HTTP header](https://docs.corsair.dev/docs/api/advanced-features). **See also** [Customer resource lookup and creation.](https://docs.corsair.dev/docs/api/hosted_pages) |
| `brand_id` | `string` | No | The unique ID of the [brand](https://docs.corsair.dev/docs/api/brands) this hosted page should be linked to. Applicable only when multiple brands have been created for the site. Resources created through the hosted page, such as the customer and the subscription, are linked to the same brand. An alternative way of passing this parameter is by means of the `chargebee-brand-id` custom HTTP header; when both are provided, they must specify the same brand. **Default behavior** \* When not provided, the brand of the customer or subscription referenced in the request is used, or the default brand defined for the site when the request references neither. |
| `layout` | `in_app \| full_page` | No | Specifies the UI layout for the hosted page. This overrides [the layout](https://www.chargebee.com/docs/billing/2.0/hosted-capabilities/hosted-checkout#ui-layout-options) configured in Chargebee Billing. \* in\_app - Renders the hosted page in an in-app layout. \* full\_page - Renders the hosted page in a full-page layout. |
| `invoice_note` | `string` | No | A note for this particular invoice. This, and [all other notes](https://docs.corsair.dev/docs/api/invoices/invoice-object#notes) for the invoice are displayed on the PDF invoice sent to the customer. |
| `coupon_ids` | `string[]` | No | List of Coupons to be added. |
| `currency_code` | `string` | No | The currency code (ISO 4217 format) of the invoice amount. |
| `redirect_url` | `string` | No | The customers will be redirected to this URL upon successful checkout. The hosted page id and state will be passed as parameters to this URL. **Note** : \* Although the customer will be redirected to the `redirect_url` after successful checkout, we do not recommend relying on it for completing critical post-checkout actions. This is because redirection may not happen due to unforeseen reasons such as user closing the tab, or exiting the browser, and so on. If there is any synchronization that you are doing after the redirection, you will have to have a backup. Chargebee recommends listening to appropriate webhooks such as [`subscription_created`](https://docs.corsair.dev/docs/api/events) or [`invoice_generated`](https://docs.corsair.dev/docs/api/events) to verify a successful checkout. \* Redirect URL configured in Settings \\> Hosted Pages Settings would be overriden by this redirect URL. \* *Eg :* *[http://yoursite.com?id=\\\\\*\\\\\*\\\\\&state=succeeded](http://yoursite.com?id=\\\\*\\\\*\\\\\&state=succeeded)* \* This parameter is not applicable for iframe messaging. |
| `cancel_url` | `string` | No | The customers will be redirected to this URL upon canceling checkout. The hosted page id and state will be passed as parameters to this URL. **Note** : - Cancel URL configured in Settings \\> Hosted Pages Settings would be overriden by this cancel URL. *Eg : [http://yoursite.com?id=\\\\\&state=cancelled](http://yoursite.com?id=\\\\\&state=cancelled)* \* This parameter is not applicable for iframe messaging and [in-app](https://www.chargebee.com/docs/2.0/checkout.html) checkout. |
| `pass_thru_content` | `string` | No | This attribute allows you to store custom information with the `hosted_page` object. You can use it to associate specific data with a hosted page session. For example, you can store the ID of the marketing campaign that initiated the user session. After a successful checkout, when the customer is redirected, you can retrieve the hosted page ID from the [redirect URL](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges)'s query parameters. Using this ID, you can fetch the hosted page and perform actions related to the success of the marketing campaign. |
| `customer` | `object` | No | Parameters for customer |
| `invoice` | `object` | No | Parameters for invoice |
| `card` | `object` | No | Parameters for card |
| `billing_address` | `object` | No | Parameters for billing\_address |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `item_prices` | `object` | No | Parameters for item\_prices |
| `item_tiers` | `object` | No | Parameters for item\_tiers |
| `charges` | `object` | No | Parameters for charges |
| `discounts` | `object` | No | Parameters for discounts |
| `entity_identifiers` | `object` | No | Parameters for entity\_identifiers |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string,
>   email?: string,
>   first_name?: string,
>   last_name?: string,
>   company?: string,
>   phone?: string,
>   locale?: string,
>   taxability?: taxable | exempt | zero_rated,
>   vat_number?: string,
>   vat_number_prefix?: string,
>   einvoicing_method?: automatic | manual | site_default,
>   is_einvoice_enabled?: boolean,
>   entity_identifier_scheme?: string,
>   entity_identifier_standard?: string,
>   consolidated_invoicing?: boolean
> }
> ```

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   po_number?: string
> }
> ```

> [accordion] card full type
>
> ```ts theme={null}
> {
>   gateway_account_id?: string
> }
> ```

> [accordion] billing\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] item\_prices full type
>
> ```ts theme={null}
> {
>   item_price_id?: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   unit_price?: number[],
>   unit_price_in_decimal?: string[],
>   date_from?: number[],
>   date_to?: number[]
> }
> ```

> [accordion] item\_tiers full type
>
> ```ts theme={null}
> {
>   item_price_id?: string[],
>   starting_unit?: number[],
>   ending_unit?: number[],
>   price?: number[],
>   starting_unit_in_decimal?: string[],
>   ending_unit_in_decimal?: string[],
>   price_in_decimal?: string[],
>   pricing_type?: (per_unit | flat_fee | package)[],
>   package_size?: number[]
> }
> ```

> [accordion] charges full type
>
> ```ts theme={null}
> {
>   amount?: number[],
>   amount_in_decimal?: string[],
>   description?: string[],
>   taxable?: boolean[],
>   tax_profile_id?: string[],
>   avalara_tax_code?: string[],
>   hsn_code?: string[],
>   taxjar_product_code?: string[],
>   avalara_sale_type?: (wholesale | retail | consumed | vendor_use)[],
>   avalara_transaction_type?: number[],
>   avalara_service_type?: number[],
>   date_from?: number[],
>   date_to?: number[]
> }
> ```

> [accordion] discounts full type
>
> ```ts theme={null}
> {
>   percentage?: number[],
>   amount?: number[],
>   quantity?: number[],
>   apply_on: (invoice_amount | specific_item_price)[],
>   item_price_id?: string[]
> }
> ```

> [accordion] entity\_identifiers full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   scheme?: string[],
>   value?: string[],
>   operation?: (create | update | delete)[],
>   standard?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `hosted_page` | `object \| null` | No | Hosted pages are the easiest way to integrate Chargebee with your website. For card payment methods, they help meet most of your PCI DSS compliance requirements. Chargebee offers hosted pages where your customers can perform the following actions: \* [Checkout a new subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription) \* [Checkout changes to an existing subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription) \* [Manage payment sources](https://docs.corsair.dev/docs/api/hosted_pages/manage-payment-sources) \* [Make payments for all due invoices](https://docs.corsair.dev/docs/api/hosted_pages/collect-now) \* [Extending a subscription](https://docs.corsair.dev/docs/api/hosted_pages/extend-subscription) When you create a hosted page, it is available at a secure and unique URL. This URL can then be provided to your customer on your website or by other means such as email. On successful completion of the hosted page workflow by the customer, they are redirected to the `redirect_url` with the hosted page `id` and `state` passed as query string parameters. As soon as the redirection happens, [retrieve the hosted page](https://docs.corsair.dev/docs/api/hosted_pages/retrieve-a-hosted-page) to get details of the customer, subscription, invoice etc. #### Embedding a hosted page Only the [Checkout](https://docs.corsair.dev/docs/api/hosted_pages/hosted-page-object#type) hosted page with the full-page [layout](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription#layout) supports embedding. To embed checkout in your website or application, use [embedded checkout](https://www.chargebee.com/docs/billing/2.0/hosted-capabilities/embedded-checkout.html) with Chargebee.js to mount checkout in a container on your page. Do not place hosted page URLs in your own [iframe](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe) elements---Chargebee.js creates and manages the iframe for you. |

> [accordion] hosted\_page full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   type?: string | null,
>   url?: string | null,
>   state?: string | null,
>   pass_thru_content?: string | null,
>   created_at?: number | null,
>   expires_at?: number | null,
>   layout?: string | null,
>   content?: {
>   } | null,
>   updated_at?: number | null,
>   resource_version?: number | null,
>   checkout_info?: {
>   } | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null
> } | null
> ```

***

### claimGift

`hostedPages.claimGift`

Claim a gift subscription. This API generates a hosted page URL to claim a gifted subscription.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.hostedPages.claimGift({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `brand_id` | `string` | No | The unique ID of the [brand](https://docs.corsair.dev/docs/api/brands) this hosted page should be linked to. Applicable only when multiple brands have been created for the site. This need not match the brand of the customer or subscription in the request; when the two differ, the value provided here is used for the hosted page. An alternative way of passing this parameter is by means of the `chargebee-brand-id` custom HTTP header; when both are provided, they must specify the same brand. **Default behavior** \* When not provided, the hosted page is linked to the brand of the customer or subscription in the request. |
| `redirect_url` | `string` | No | The customers will be redirected to this URL upon successful checkout. The hosted page id and state will be passed as parameters to this URL. **Note** : \* Although the customer will be redirected to the `redirect_url` after successful checkout, we do not recommend relying on it for completing critical post-checkout actions. This is because redirection may not happen due to unforeseen reasons such as user closing the tab, or exiting the browser, and so on. If there is any synchronization that you are doing after the redirection, you will have to have a backup. Chargebee recommends listening to appropriate webhooks such as [`subscription_created`](https://docs.corsair.dev/docs/api/events) or [`invoice_generated`](https://docs.corsair.dev/docs/api/events) to verify a successful checkout. \* Redirect URL configured in Settings \\> Hosted Pages Settings would be overriden by this redirect URL. \* *Eg :* *[http://yoursite.com?id=\\\\\*\\\\\*\\\\\&state=succeeded](http://yoursite.com?id=\\\\*\\\\*\\\\\&state=succeeded)* \* This parameter is not applicable for iframe messaging. |
| `gift` | `object` | No | Parameters for gift |
| `customer` | `object` | No | Parameters for customer |

> [accordion] gift full type
>
> ```ts theme={null}
> {
>   id: string
> }
> ```

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   locale?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `hosted_page` | `object \| null` | No | Hosted pages are the easiest way to integrate Chargebee with your website. For card payment methods, they help meet most of your PCI DSS compliance requirements. Chargebee offers hosted pages where your customers can perform the following actions: \* [Checkout a new subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription) \* [Checkout changes to an existing subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription) \* [Manage payment sources](https://docs.corsair.dev/docs/api/hosted_pages/manage-payment-sources) \* [Make payments for all due invoices](https://docs.corsair.dev/docs/api/hosted_pages/collect-now) \* [Extending a subscription](https://docs.corsair.dev/docs/api/hosted_pages/extend-subscription) When you create a hosted page, it is available at a secure and unique URL. This URL can then be provided to your customer on your website or by other means such as email. On successful completion of the hosted page workflow by the customer, they are redirected to the `redirect_url` with the hosted page `id` and `state` passed as query string parameters. As soon as the redirection happens, [retrieve the hosted page](https://docs.corsair.dev/docs/api/hosted_pages/retrieve-a-hosted-page) to get details of the customer, subscription, invoice etc. #### Embedding a hosted page Only the [Checkout](https://docs.corsair.dev/docs/api/hosted_pages/hosted-page-object#type) hosted page with the full-page [layout](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription#layout) supports embedding. To embed checkout in your website or application, use [embedded checkout](https://www.chargebee.com/docs/billing/2.0/hosted-capabilities/embedded-checkout.html) with Chargebee.js to mount checkout in a container on your page. Do not place hosted page URLs in your own [iframe](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe) elements---Chargebee.js creates and manages the iframe for you. |

> [accordion] hosted\_page full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   type?: string | null,
>   url?: string | null,
>   state?: string | null,
>   pass_thru_content?: string | null,
>   created_at?: number | null,
>   expires_at?: number | null,
>   layout?: string | null,
>   content?: {
>   } | null,
>   updated_at?: number | null,
>   resource_version?: number | null,
>   checkout_info?: {
>   } | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null
> } | null
> ```

***

### collectNow

`hostedPages.collectNow`

Collect now. This API generates a hosted page URL to collect due payments for the customer. Open the hosted page in a new browser tab or window using the url from this API's response. Do not embed it in your own iframe.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.hostedPages.collectNow({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `brand_id` | `string` | No | The unique ID of the [brand](https://docs.corsair.dev/docs/api/brands) this hosted page should be linked to. Applicable only when multiple brands have been created for the site. This need not match the brand of the customer or subscription in the request; when the two differ, the value provided here is used for the hosted page. An alternative way of passing this parameter is by means of the `chargebee-brand-id` custom HTTP header; when both are provided, they must specify the same brand. **Default behavior** \* When not provided, the hosted page is linked to the brand of the customer or subscription in the request. |
| `redirect_url` | `string` | No | Used to specify the destination URL to which a user is redirected after invoices are paid. The [transaction ID](https://docs.corsair.dev/docs/api/transactions/transaction-object#id) of the transactions made through the Pay Now hosted page will be sent as return variables along with the URL. |
| `currency_code` | `string` | No | The currency code (ISO 4217 format) of the specified *credit amount* . |
| `payment_method_save_policy` | `always \| ask \| never` | No | Determines whether the payment method should be saved to the customer's account. \* ask - Let the customer choose whether to save the payment method. \* never - Do not save the payment method. \* always - Automatically save the payment method to the customer's account for future use. |
| `customer` | `object` | No | Parameters for customer |
| `card` | `object` | No | Parameters for card |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id: string
> }
> ```

> [accordion] card full type
>
> ```ts theme={null}
> {
>   gateway_account_id?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `hosted_page` | `object \| null` | No | Hosted pages are the easiest way to integrate Chargebee with your website. For card payment methods, they help meet most of your PCI DSS compliance requirements. Chargebee offers hosted pages where your customers can perform the following actions: \* [Checkout a new subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription) \* [Checkout changes to an existing subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription) \* [Manage payment sources](https://docs.corsair.dev/docs/api/hosted_pages/manage-payment-sources) \* [Make payments for all due invoices](https://docs.corsair.dev/docs/api/hosted_pages/collect-now) \* [Extending a subscription](https://docs.corsair.dev/docs/api/hosted_pages/extend-subscription) When you create a hosted page, it is available at a secure and unique URL. This URL can then be provided to your customer on your website or by other means such as email. On successful completion of the hosted page workflow by the customer, they are redirected to the `redirect_url` with the hosted page `id` and `state` passed as query string parameters. As soon as the redirection happens, [retrieve the hosted page](https://docs.corsair.dev/docs/api/hosted_pages/retrieve-a-hosted-page) to get details of the customer, subscription, invoice etc. #### Embedding a hosted page Only the [Checkout](https://docs.corsair.dev/docs/api/hosted_pages/hosted-page-object#type) hosted page with the full-page [layout](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription#layout) supports embedding. To embed checkout in your website or application, use [embedded checkout](https://www.chargebee.com/docs/billing/2.0/hosted-capabilities/embedded-checkout.html) with Chargebee.js to mount checkout in a container on your page. Do not place hosted page URLs in your own [iframe](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe) elements---Chargebee.js creates and manages the iframe for you. |

> [accordion] hosted\_page full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   type?: string | null,
>   url?: string | null,
>   state?: string | null,
>   pass_thru_content?: string | null,
>   created_at?: number | null,
>   expires_at?: number | null,
>   layout?: string | null,
>   content?: {
>   } | null,
>   updated_at?: number | null,
>   resource_version?: number | null,
>   checkout_info?: {
>   } | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null
> } | null
> ```

***

### extendSubscription

`hostedPages.extendSubscription`

Extend subscription. This API generates a hosted page URL to extend the billing cycle of a subscription. Use one of the following methods to open the hosted page: \* In-app modal : Use Chargebee.js openCheckout() to open the hosted page in a modal popup in your website or application.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.hostedPages.extendSubscription({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `brand_id` | `string` | No | The unique ID of the [brand](https://docs.corsair.dev/docs/api/brands) this hosted page should be linked to. Applicable only when multiple brands have been created for the site. This need not match the brand of the customer or subscription in the request; when the two differ, the value provided here is used for the hosted page. An alternative way of passing this parameter is by means of the `chargebee-brand-id` custom HTTP header; when both are provided, they must specify the same brand. **Default behavior** \* When not provided, the hosted page is linked to the brand of the customer or subscription in the request. |
| `expiry` | `number` | No | Expiry (in days) for the link generated. No expiry will be set if this is not specified. |
| `billing_cycle` | `number` | No | The number of billing cycles by which the subscription should be extended. **Default behavior** \* If the subscription's plan has [`billing_cycles`](https://docs.corsair.dev/docs/api/item_prices#billing_cycles) set, that value is used. \* If the plan's billing cycles attribute is not set, `1` is used. |
| `subscription` | `object` | No | Parameters for subscription |

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `hosted_page` | `object \| null` | No | Hosted pages are the easiest way to integrate Chargebee with your website. For card payment methods, they help meet most of your PCI DSS compliance requirements. Chargebee offers hosted pages where your customers can perform the following actions: \* [Checkout a new subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription) \* [Checkout changes to an existing subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription) \* [Manage payment sources](https://docs.corsair.dev/docs/api/hosted_pages/manage-payment-sources) \* [Make payments for all due invoices](https://docs.corsair.dev/docs/api/hosted_pages/collect-now) \* [Extending a subscription](https://docs.corsair.dev/docs/api/hosted_pages/extend-subscription) When you create a hosted page, it is available at a secure and unique URL. This URL can then be provided to your customer on your website or by other means such as email. On successful completion of the hosted page workflow by the customer, they are redirected to the `redirect_url` with the hosted page `id` and `state` passed as query string parameters. As soon as the redirection happens, [retrieve the hosted page](https://docs.corsair.dev/docs/api/hosted_pages/retrieve-a-hosted-page) to get details of the customer, subscription, invoice etc. #### Embedding a hosted page Only the [Checkout](https://docs.corsair.dev/docs/api/hosted_pages/hosted-page-object#type) hosted page with the full-page [layout](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription#layout) supports embedding. To embed checkout in your website or application, use [embedded checkout](https://www.chargebee.com/docs/billing/2.0/hosted-capabilities/embedded-checkout.html) with Chargebee.js to mount checkout in a container on your page. Do not place hosted page URLs in your own [iframe](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe) elements---Chargebee.js creates and manages the iframe for you. |

> [accordion] hosted\_page full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   type?: string | null,
>   url?: string | null,
>   state?: string | null,
>   pass_thru_content?: string | null,
>   created_at?: number | null,
>   expires_at?: number | null,
>   layout?: string | null,
>   content?: {
>   } | null,
>   updated_at?: number | null,
>   resource_version?: number | null,
>   checkout_info?: {
>   } | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null
> } | null
> ```

***

### get

`hostedPages.get`

Retrieve a hosted page. When you retrieve a hosted page whose status is successful, the content attribute has the following objects based on the type of the hosted page.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.hostedPages.get({ hostedPageId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `hostedPageId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `hosted_page` | `object \| null` | No | Hosted pages are the easiest way to integrate Chargebee with your website. For card payment methods, they help meet most of your PCI DSS compliance requirements. Chargebee offers hosted pages where your customers can perform the following actions: \* [Checkout a new subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription) \* [Checkout changes to an existing subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription) \* [Manage payment sources](https://docs.corsair.dev/docs/api/hosted_pages/manage-payment-sources) \* [Make payments for all due invoices](https://docs.corsair.dev/docs/api/hosted_pages/collect-now) \* [Extending a subscription](https://docs.corsair.dev/docs/api/hosted_pages/extend-subscription) When you create a hosted page, it is available at a secure and unique URL. This URL can then be provided to your customer on your website or by other means such as email. On successful completion of the hosted page workflow by the customer, they are redirected to the `redirect_url` with the hosted page `id` and `state` passed as query string parameters. As soon as the redirection happens, [retrieve the hosted page](https://docs.corsair.dev/docs/api/hosted_pages/retrieve-a-hosted-page) to get details of the customer, subscription, invoice etc. #### Embedding a hosted page Only the [Checkout](https://docs.corsair.dev/docs/api/hosted_pages/hosted-page-object#type) hosted page with the full-page [layout](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription#layout) supports embedding. To embed checkout in your website or application, use [embedded checkout](https://www.chargebee.com/docs/billing/2.0/hosted-capabilities/embedded-checkout.html) with Chargebee.js to mount checkout in a container on your page. Do not place hosted page URLs in your own [iframe](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe) elements---Chargebee.js creates and manages the iframe for you. |

> [accordion] hosted\_page full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   type?: string | null,
>   url?: string | null,
>   state?: string | null,
>   pass_thru_content?: string | null,
>   created_at?: number | null,
>   expires_at?: number | null,
>   layout?: string | null,
>   content?: {
>   } | null,
>   updated_at?: number | null,
>   resource_version?: number | null,
>   checkout_info?: {
>   } | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null
> } | null
> ```

***

### list

`hostedPages.list`

List hosted pages. This API retrieves the list of hosted page resources.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.hostedPages.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `id` | `object` | No | optional, string filter Unique identifier generated for each hosted page requested. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *id\\\[is\\] = "Edi69nxpu6BeGBd9Fjcd0tqCSwb0sRcuKa"* |
| `type` | `object` | No | optional, enumerated string filter Type of the requested hosted page. Possible values are : checkout\_new, checkout\_existing, update\_payment\_method, manage\_payment\_sources, collect\_now, extend\_subscription, checkout\_one\_time, pre\_cancel. **Supported operators :** is, is\_not, in, not\_in **Example →** *type\\\[is\_not\\] = "checkout\_new"* |
| `state` | `object` | No | optional, enumerated string filter Indicating the current state of the hosted page resource. Possible values are : created, requested, succeeded, cancelled, acknowledged. **Supported operators :** is, is\_not, in, not\_in **Example →** *state\\\[is\\] = "succeeded"* |
| `updated_at` | `object` | No | optional, timestamp(UTC) in seconds filter Timestamp indicating when this hosted page was last updated. **Supported operators :** after, before, on, between **Example →** *updated\_at\\\[on\\] = "1490784813"* |

> [accordion] id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] type full type
>
> ```ts theme={null}
> {
>   is?: checkout_new | checkout_existing | manage_payment_sources | collect_now | extend_subscription | checkout_one_time | pre_cancel | view_voucher | accept_quote,
>   is_not?: checkout_new | checkout_existing | manage_payment_sources | collect_now | extend_subscription | checkout_one_time | pre_cancel | view_voucher | accept_quote,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] state full type
>
> ```ts theme={null}
> {
>   is?: created | requested | succeeded | cancelled | acknowledged,
>   is_not?: created | requested | succeeded | cancelled | acknowledged,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] updated\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   hosted_page?: {
>     id?: string | null,
>     type?: string | null,
>     url?: string | null,
>     state?: string | null,
>     pass_thru_content?: string | null,
>     created_at?: number | null,
>     expires_at?: number | null,
>     layout?: string | null,
>     content?: {
>     } | null,
>     updated_at?: number | null,
>     resource_version?: number | null,
>     checkout_info?: {
>     } | null,
>     business_entity_id?: string | null,
>     brand_id?: string | null
>   } | null
> }[] | null
> ```

***

### managePaymentSources

`hostedPages.managePaymentSources`

Manage payment sources. This API generates a hosted page URL to add new or update existing payment sources for the customer. Use one of the following methods to open the hosted page: \* In-app modal : Use Chargebee.js openCheckout() to open the hosted page in a modal popup in your website or application.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.hostedPages.managePaymentSources({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `business_entity_id` | `string` | No | The unique ID of the [business entity](https://docs.corsair.dev/docs/api/business_entities) of this hosted page. This is always the same as the business entity of the customer. |
| `brand_id` | `string` | No | The unique ID of the [brand](https://docs.corsair.dev/docs/api/brands) this hosted page should be linked to. Applicable only when multiple brands have been created for the site. This need not match the brand of the customer or subscription in the request; when the two differ, the value provided here is used for the hosted page. An alternative way of passing this parameter is by means of the `chargebee-brand-id` custom HTTP header; when both are provided, they must specify the same brand. **Default behavior** \* When not provided, the hosted page is linked to the brand of the customer or subscription in the request. |
| `redirect_url` | `string` | No | URL to redirect after payment method is added. |
| `customer` | `object` | No | Parameters for customer |
| `card` | `object` | No | Parameters for card |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id: string
> }
> ```

> [accordion] card full type
>
> ```ts theme={null}
> {
>   gateway_account_id?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `hosted_page` | `object \| null` | No | Hosted pages are the easiest way to integrate Chargebee with your website. For card payment methods, they help meet most of your PCI DSS compliance requirements. Chargebee offers hosted pages where your customers can perform the following actions: \* [Checkout a new subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription) \* [Checkout changes to an existing subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription) \* [Manage payment sources](https://docs.corsair.dev/docs/api/hosted_pages/manage-payment-sources) \* [Make payments for all due invoices](https://docs.corsair.dev/docs/api/hosted_pages/collect-now) \* [Extending a subscription](https://docs.corsair.dev/docs/api/hosted_pages/extend-subscription) When you create a hosted page, it is available at a secure and unique URL. This URL can then be provided to your customer on your website or by other means such as email. On successful completion of the hosted page workflow by the customer, they are redirected to the `redirect_url` with the hosted page `id` and `state` passed as query string parameters. As soon as the redirection happens, [retrieve the hosted page](https://docs.corsair.dev/docs/api/hosted_pages/retrieve-a-hosted-page) to get details of the customer, subscription, invoice etc. #### Embedding a hosted page Only the [Checkout](https://docs.corsair.dev/docs/api/hosted_pages/hosted-page-object#type) hosted page with the full-page [layout](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription#layout) supports embedding. To embed checkout in your website or application, use [embedded checkout](https://www.chargebee.com/docs/billing/2.0/hosted-capabilities/embedded-checkout.html) with Chargebee.js to mount checkout in a container on your page. Do not place hosted page URLs in your own [iframe](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe) elements---Chargebee.js creates and manages the iframe for you. |

> [accordion] hosted\_page full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   type?: string | null,
>   url?: string | null,
>   state?: string | null,
>   pass_thru_content?: string | null,
>   created_at?: number | null,
>   expires_at?: number | null,
>   layout?: string | null,
>   content?: {
>   } | null,
>   updated_at?: number | null,
>   resource_version?: number | null,
>   checkout_info?: {
>   } | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null
> } | null
> ```

***

### notifyEvent

`hostedPages.notifyEvent`

Notify an event. Use this API to notify Chargebee about important events that occur on your web pages, such as subscription cancellations. An event contains data about affected resources and additional details such as when the change occurred.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.hostedPages.notifyEvent({
	event_data: {},
	event_name: 'cancellation_page_loaded',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `event_name` | `cancellation_page_loaded` | Yes | The event that need to passed to a different system. \* cancellation\_page\_loaded - Indicates native cancellation flow provided by the merchant is loaded rather than the retention flow. |
| `occurred_at` | `number` | No | Timestamp indicating when this event had occurred. . |
| `event_data` | `object` | Yes | The meta data description of the event in key-value pair. The value is a JSON object with the following keys and their values. \* `subscription_id`: A unique and immutable identifier for the subscription. . |

> [accordion] event\_data full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `boolean \| null` | No | Event was processed successfully. |

***

### preCancel

`hostedPages.preCancel`

Create a pre-cancel hosted page. Creates a hosted\_page resource of type pre\_cancel . Route canceling users to this page to provide them a retention experience and start saving revenue.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.hostedPages.preCancel({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `brand_id` | `string` | No | The unique ID of the [brand](https://docs.corsair.dev/docs/api/brands) this hosted page should be linked to. Applicable only when multiple brands have been created for the site. This need not match the brand of the customer or subscription in the request; when the two differ, the value provided here is used for the hosted page. An alternative way of passing this parameter is by means of the `chargebee-brand-id` custom HTTP header; when both are provided, they must specify the same brand. **Default behavior** \* When not provided, the hosted page is linked to the brand of the customer or subscription in the request. |
| `pass_thru_content` | `string` | No | Additional data to be passed to Chargebee Growth. Only the value of `pass_thru_content.custom` is sent to Chargebee Growth. It is sent as the value of the [`custom`](https://www.chargebee.com/docs/js/cancel-page-api-ref#parameters) property. The fields provided in `pass_thru_content.custom` must be preconfigured in Chargebee Growth. Although only `pass_thru_content.custom` is sent to Chargebee Growth, all of `pass_thru_content` is stored by Chargebee Billing and is retrievable as an [attribute](https://docs.corsair.dev/docs/api/hosted_pages/hosted_page-object#pass_thru_content) of the `hosted_page`. . |
| `cancel_url` | `string` | No | The customer is sent to this URL if they finally decide to cancel the subscription, despite the attempt to retain them. |
| `redirect_url` | `string` | No | The customer is sent to this URL upon successful retention. In other words, this is the page to which the customer is sent when they decide **not** to cancel the subscription. |
| `locale` | `string` | No | — |
| `subscription` | `object` | No | Parameters for subscription |

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `hosted_page` | `object \| null` | No | Hosted pages are the easiest way to integrate Chargebee with your website. For card payment methods, they help meet most of your PCI DSS compliance requirements. Chargebee offers hosted pages where your customers can perform the following actions: \* [Checkout a new subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription) \* [Checkout changes to an existing subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription) \* [Manage payment sources](https://docs.corsair.dev/docs/api/hosted_pages/manage-payment-sources) \* [Make payments for all due invoices](https://docs.corsair.dev/docs/api/hosted_pages/collect-now) \* [Extending a subscription](https://docs.corsair.dev/docs/api/hosted_pages/extend-subscription) When you create a hosted page, it is available at a secure and unique URL. This URL can then be provided to your customer on your website or by other means such as email. On successful completion of the hosted page workflow by the customer, they are redirected to the `redirect_url` with the hosted page `id` and `state` passed as query string parameters. As soon as the redirection happens, [retrieve the hosted page](https://docs.corsair.dev/docs/api/hosted_pages/retrieve-a-hosted-page) to get details of the customer, subscription, invoice etc. #### Embedding a hosted page Only the [Checkout](https://docs.corsair.dev/docs/api/hosted_pages/hosted-page-object#type) hosted page with the full-page [layout](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription#layout) supports embedding. To embed checkout in your website or application, use [embedded checkout](https://www.chargebee.com/docs/billing/2.0/hosted-capabilities/embedded-checkout.html) with Chargebee.js to mount checkout in a container on your page. Do not place hosted page URLs in your own [iframe](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe) elements---Chargebee.js creates and manages the iframe for you. |

> [accordion] hosted\_page full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   type?: string | null,
>   url?: string | null,
>   state?: string | null,
>   pass_thru_content?: string | null,
>   created_at?: number | null,
>   expires_at?: number | null,
>   layout?: string | null,
>   content?: {
>   } | null,
>   updated_at?: number | null,
>   resource_version?: number | null,
>   checkout_info?: {
>   } | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null
> } | null
> ```

***

### retrieveAgreementPdf

`hostedPages.retrieveAgreementPdf`

Retrieve direct debit agreement PDF. This is applicable only for Direct Debit via SEPA, Bacs, Bg Autogiro, BECS (for both Australia and New Zealand) and PAD. For Direct Debit, the customer needs to accept an agreement that allows the merchant to debit their bank account.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.hostedPages.retrieveAgreementPdf({ payment_source_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `payment_source_id` | `string` | Yes | Payment source to be used for this payment. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `hosted_page` | `object \| null` | No | Hosted pages are the easiest way to integrate Chargebee with your website. For card payment methods, they help meet most of your PCI DSS compliance requirements. Chargebee offers hosted pages where your customers can perform the following actions: \* [Checkout a new subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription) \* [Checkout changes to an existing subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription) \* [Manage payment sources](https://docs.corsair.dev/docs/api/hosted_pages/manage-payment-sources) \* [Make payments for all due invoices](https://docs.corsair.dev/docs/api/hosted_pages/collect-now) \* [Extending a subscription](https://docs.corsair.dev/docs/api/hosted_pages/extend-subscription) When you create a hosted page, it is available at a secure and unique URL. This URL can then be provided to your customer on your website or by other means such as email. On successful completion of the hosted page workflow by the customer, they are redirected to the `redirect_url` with the hosted page `id` and `state` passed as query string parameters. As soon as the redirection happens, [retrieve the hosted page](https://docs.corsair.dev/docs/api/hosted_pages/retrieve-a-hosted-page) to get details of the customer, subscription, invoice etc. #### Embedding a hosted page Only the [Checkout](https://docs.corsair.dev/docs/api/hosted_pages/hosted-page-object#type) hosted page with the full-page [layout](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription#layout) supports embedding. To embed checkout in your website or application, use [embedded checkout](https://www.chargebee.com/docs/billing/2.0/hosted-capabilities/embedded-checkout.html) with Chargebee.js to mount checkout in a container on your page. Do not place hosted page URLs in your own [iframe](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe) elements---Chargebee.js creates and manages the iframe for you. |

> [accordion] hosted\_page full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   type?: string | null,
>   url?: string | null,
>   state?: string | null,
>   pass_thru_content?: string | null,
>   created_at?: number | null,
>   expires_at?: number | null,
>   layout?: string | null,
>   content?: {
>   } | null,
>   updated_at?: number | null,
>   resource_version?: number | null,
>   checkout_info?: {
>   } | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null
> } | null
> ```

***

### viewVoucher

`hostedPages.viewVoucher`

Create a hosted page to view Boleto vouchers. Creates a hosted\_page resource of type, view\_voucher . When your end customers choose the Boleto payment method, you can generate a voucher for their pending invoice. Using this API, you can create a voucher\_detail hosted page for your customers and email them a link to this hosted page.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.hostedPages.viewVoucher({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `payment_voucher` | `object` | No | Parameters for payment\_voucher |
| `customer` | `object` | No | Parameters for customer |

> [accordion] payment\_voucher full type
>
> ```ts theme={null}
> {
>   id: string
> }
> ```

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   locale?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `hosted_page` | `object \| null` | No | Hosted pages are the easiest way to integrate Chargebee with your website. For card payment methods, they help meet most of your PCI DSS compliance requirements. Chargebee offers hosted pages where your customers can perform the following actions: \* [Checkout a new subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription) \* [Checkout changes to an existing subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription) \* [Manage payment sources](https://docs.corsair.dev/docs/api/hosted_pages/manage-payment-sources) \* [Make payments for all due invoices](https://docs.corsair.dev/docs/api/hosted_pages/collect-now) \* [Extending a subscription](https://docs.corsair.dev/docs/api/hosted_pages/extend-subscription) When you create a hosted page, it is available at a secure and unique URL. This URL can then be provided to your customer on your website or by other means such as email. On successful completion of the hosted page workflow by the customer, they are redirected to the `redirect_url` with the hosted page `id` and `state` passed as query string parameters. As soon as the redirection happens, [retrieve the hosted page](https://docs.corsair.dev/docs/api/hosted_pages/retrieve-a-hosted-page) to get details of the customer, subscription, invoice etc. #### Embedding a hosted page Only the [Checkout](https://docs.corsair.dev/docs/api/hosted_pages/hosted-page-object#type) hosted page with the full-page [layout](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription#layout) supports embedding. To embed checkout in your website or application, use [embedded checkout](https://www.chargebee.com/docs/billing/2.0/hosted-capabilities/embedded-checkout.html) with Chargebee.js to mount checkout in a container on your page. Do not place hosted page URLs in your own [iframe](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe) elements---Chargebee.js creates and manages the iframe for you. |

> [accordion] hosted\_page full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   type?: string | null,
>   url?: string | null,
>   state?: string | null,
>   pass_thru_content?: string | null,
>   created_at?: number | null,
>   expires_at?: number | null,
>   layout?: string | null,
>   content?: {
>   } | null,
>   updated_at?: number | null,
>   resource_version?: number | null,
>   checkout_info?: {
>   } | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null
> } | null
> ```

***

## In App Subscriptions

### importReceipt

`inAppSubscriptions.importReceipt`

Import receipt. Verifies an Apple App Store or Google Play Store in-app purchase receipt and imports subscriptions for all historical purchases made by the customer. Tip An in\_app\_subscription is created for every unique original\_transaction\_id .

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.inAppSubscriptions.importReceipt({ inAppSubscriptionAppId: 'example', receipt: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `inAppSubscriptionAppId` | `string` | Yes | — |
| `receipt` | `string` | Yes | **Apple App Store** : The Base64 encoded [App Store in-app purchase receipt](https://developer.apple.com/documentation/storekit/original_api_for_in-app_purchase/validating_receipts_with_the_app_store?language=objc#overview) taken from the Apple device after successful creation of the in-app purchase subscription. **Google Play Store** : The purchase `token` taken from the Android device after the successful creation of an in-app purchase subscription. |
| `product` | `object` | No | Parameters for product |
| `customer` | `object` | No | Parameters for customer |

> [accordion] product full type
>
> ```ts theme={null}
> {
>   currency_code: string
> }
> ```

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string,
>   email?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `in_app_subscriptions` | `object[] \| null` | No | Array of in\_app\_subscription object |

> [accordion] in\_app\_subscriptions full type
>
> ```ts theme={null}
> {
>   subscription_id?: string | null,
>   customer_id?: string | null,
>   plan_id?: string | null,
>   store_status?: string | null,
>   invoice_id?: string | null
> }[] | null
> ```

***

### importSubscription

`inAppSubscriptions.importSubscription`

Import subscription without receipt. The Import Subscriptions endpoint is a Chargebee API that allows you to import historic In-App Subscriptions without using a valid Apple App Store receipt. This endpoint is useful if you do not have access to the receipt data which is required for the Import Receipt API.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.inAppSubscriptions.importSubscription({ inAppSubscriptionAppId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `inAppSubscriptionAppId` | `string` | Yes | — |
| `subscription` | `object` | No | Parameters for subscription |
| `customer` | `object` | No | Parameters for customer |

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id: string,
>   started_at: number,
>   term_start: number,
>   term_end: number,
>   product_id: string,
>   currency_code: string,
>   transaction_id: string,
>   is_trial?: boolean
> }
> ```

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string,
>   email?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `in_app_subscription` | `object \| null` | No | **Important:** \* We've stopped giving access to the legacy solution due to the limitations mentioned [here](https://www.chargebee.com/docs/billing/2.0/mobile-subscriptions/mobile-subscriptions-limitations). Please [request access](https://app.chargebee.com/login?forward=https://app.chargebee.com/request_access/omnichannel-subscription\&ref=feature) for enabling the new [Omnichannel Subscriptions](https://docs.corsair.dev/docs/api/recorded_purchases/recorded-purchase-object) solution. \* These APIs operate asynchronously. When you receive a successful response code from an API call, it indicates only the successful submission of your request, not the completion of the operation. Using In-app Subscriptions, you can track subscriptions you sell and service via in-app purchase channels such as Apple's App Store and Google's Play Store. Call [this API](https://docs.corsair.dev/docs/api/in_app_subscriptions/process-purchase-command) to notify Chargebee of new subscription purchases. Chargebee responds by creating corresponding subscriptions. You can make the API call directly from the client-side application or from your server. In the case of the Apple App Store and Google Play Store integration, you can also configure Chargebee to receive server notifications from [Apple](https://developer.apple.com/documentation/appstoreservernotifications) and [Google](https://developer.android.com/google/play/billing/rtdn-reference#sub) to keep subscriptions up-to-date. **Note:** After creating a subscription in Chargebee using the [process purchase command](https://docs.corsair.dev/docs/api/in_app_subscriptions/process-purchase-command) API, Chargebee manages it in real-time using notification events from [Apple](https://docs.corsair.dev/docs/api/in_app_purchase_events) or [Google](https://docs.corsair.dev/docs/api/in_app_purchase_events). To enable these notifications, generate a notification URL using these links - [Apple](https://www.chargebee.com/docs/2.0/mobile-app-store-product-iap.html#connection-keys_notification-url) and [Google](https://www.chargebee.com/docs/2.0/mobile-playstore-notifications.html) and configure it in their respective stores. **In-app subscriptions are read-only** The subscriptions created via the [Process Purchase Command API](https://docs.corsair.dev/docs/api/in_app_subscriptions/process-purchase-command) are managed by Apple or Google in response to actions taken by your subscribers via their respective accounts. Chargebee only keeps track of these subscriptions: creating and modifying them in response to events happening against the original subscriptions. Consequently, these subscriptions cannot be modified by you via the Chargebee admin console or the [Subscriptions API](https://docs.corsair.dev/docs/api/subscriptions). |

> [accordion] in\_app\_subscription full type
>
> ```ts theme={null}
> {
>   subscription_id?: string | null,
>   customer_id?: string | null,
>   plan_id?: string | null,
>   store_status?: string | null,
>   invoice_id?: string | null
> } | null
> ```

***

### processPurchase

`inAppSubscriptions.processPurchase`

Process purchase command. Verifies an in-app purchase made by your customer and creates a subscription in Chargebee. Note: If App Store or Play Store products have not been imported to Chargebee and this API is invoked, Chargebee will automatically create plans that correspond to the store product IDs.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.inAppSubscriptions.processPurchase({ inAppSubscriptionAppId: 'example', receipt: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `inAppSubscriptionAppId` | `string` | Yes | — |
| `receipt` | `string` | Yes | **Apple App Store** : The Base64 encoded [App Store in-app purchase receipt](https://developer.apple.com/documentation/storekit/original_api_for_in-app_purchase/validating_receipts_with_the_app_store?language=objc#overview) taken from the Apple device after successful creation of the in-app purchase subscription. **Google Play Store** : The purchase `token` taken from the Android device after the successful creation of an in-app purchase subscription. |
| `product` | `object` | No | Parameters for product |
| `customer` | `object` | No | Parameters for customer |

> [accordion] product full type
>
> ```ts theme={null}
> {
>   id: string,
>   currency_code: string,
>   price: number,
>   name?: string,
>   price_in_decimal?: string,
>   period?: string,
>   period_unit?: string
> }
> ```

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string,
>   email?: string,
>   first_name?: string,
>   last_name?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `in_app_subscription` | `object \| null` | No | **Important:** \* We've stopped giving access to the legacy solution due to the limitations mentioned [here](https://www.chargebee.com/docs/billing/2.0/mobile-subscriptions/mobile-subscriptions-limitations). Please [request access](https://app.chargebee.com/login?forward=https://app.chargebee.com/request_access/omnichannel-subscription\&ref=feature) for enabling the new [Omnichannel Subscriptions](https://docs.corsair.dev/docs/api/recorded_purchases/recorded-purchase-object) solution. \* These APIs operate asynchronously. When you receive a successful response code from an API call, it indicates only the successful submission of your request, not the completion of the operation. Using In-app Subscriptions, you can track subscriptions you sell and service via in-app purchase channels such as Apple's App Store and Google's Play Store. Call [this API](https://docs.corsair.dev/docs/api/in_app_subscriptions/process-purchase-command) to notify Chargebee of new subscription purchases. Chargebee responds by creating corresponding subscriptions. You can make the API call directly from the client-side application or from your server. In the case of the Apple App Store and Google Play Store integration, you can also configure Chargebee to receive server notifications from [Apple](https://developer.apple.com/documentation/appstoreservernotifications) and [Google](https://developer.android.com/google/play/billing/rtdn-reference#sub) to keep subscriptions up-to-date. **Note:** After creating a subscription in Chargebee using the [process purchase command](https://docs.corsair.dev/docs/api/in_app_subscriptions/process-purchase-command) API, Chargebee manages it in real-time using notification events from [Apple](https://docs.corsair.dev/docs/api/in_app_purchase_events) or [Google](https://docs.corsair.dev/docs/api/in_app_purchase_events). To enable these notifications, generate a notification URL using these links - [Apple](https://www.chargebee.com/docs/2.0/mobile-app-store-product-iap.html#connection-keys_notification-url) and [Google](https://www.chargebee.com/docs/2.0/mobile-playstore-notifications.html) and configure it in their respective stores. **In-app subscriptions are read-only** The subscriptions created via the [Process Purchase Command API](https://docs.corsair.dev/docs/api/in_app_subscriptions/process-purchase-command) are managed by Apple or Google in response to actions taken by your subscribers via their respective accounts. Chargebee only keeps track of these subscriptions: creating and modifying them in response to events happening against the original subscriptions. Consequently, these subscriptions cannot be modified by you via the Chargebee admin console or the [Subscriptions API](https://docs.corsair.dev/docs/api/subscriptions). |

> [accordion] in\_app\_subscription full type
>
> ```ts theme={null}
> {
>   subscription_id?: string | null,
>   customer_id?: string | null,
>   plan_id?: string | null,
>   store_status?: string | null,
>   invoice_id?: string | null
> } | null
> ```

***

### retrieveStoreSubscription

`inAppSubscriptions.retrieveStoreSubscription`

Retrieve store subscription. This API verifies the application id \{in\_app\_subscription\_app\_id} and receipt then returns the subscription details associated with the purchase. #### Path Parameter in\_app\_subscription\_app\_id required, string The handle is created by Chargebee for your Apple App Store or Google Play Store app.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.inAppSubscriptions.retrieveStoreSubscription({ inAppSubscriptionAppId: 'example', receipt: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `inAppSubscriptionAppId` | `string` | Yes | — |
| `receipt` | `string` | Yes | **Apple App Store** : The Base64 encoded [App Store in-app purchase receipt](https://developer.apple.com/documentation/storekit/original_api_for_in-app_purchase/validating_receipts_with_the_app_store?language=objc#overview) taken from the Apple device after successful creation of the in-app purchase subscription. **Google Play Store** : The purchase `token` taken from the Android device after the successful creation of an in-app purchase subscription. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `in_app_subscriptions` | `object[] \| null` | No | Array of in\_app\_subscription object |

> [accordion] in\_app\_subscriptions full type
>
> ```ts theme={null}
> {
>   subscription_id?: string | null,
>   customer_id?: string | null,
>   plan_id?: string | null,
>   store_status?: string | null,
>   invoice_id?: string | null
> }[] | null
> ```

***

## Invoices

### addAddonCharge

`invoices.addAddonCharge`

Add non-recurring addon to a pending invoice. Product Catalog 1.0 sites only.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.invoices.addAddonCharge({ invoiceId: 'inv_1001', addon_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `invoiceId` | `string` | Yes | — |
| `addon_id` | `string` | Yes | The ID of the non-recurring addon to be charged. |
| `addon_quantity` | `number` | No | The number of addon units to be charged. Mandatory for quantity based addons. |
| `addon_unit_price` | `number` | No | Amount that will override the Addon's default price. The unit depends on the [type of currency](https://docs.corsair.dev/docs/api/getting-started) . |
| `addon_quantity_in_decimal` | `string` | No | The decimal representation of the quantity of the [non-recurring addon](https://www.chargebee.com/docs/charges.html#non-recurring-addon). Provide the value in major units of the currency. Must be provided when the addon is quantity-based. This parameter can only be passed when [multi-decimal pricing](https://docs.corsair.dev/docs/api/v2/pcv-1/currencies) is enabled. |
| `addon_unit_price_in_decimal` | `string` | No | When [price overriding](http://chargebee.com/docs/price-override.html) is enabled for the site, the price or per-unit price of the [non-recurring addon](https://www.chargebee.com/docs/charges.html#non-recurring-addon) can be set here. The value [set for the addon](https://docs.corsair.dev/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. This parameter can only be passed when [multi-decimal pricing](https://docs.corsair.dev/docs/api/v2/pcv-1/currencies) is enabled. |
| `comment` | `string` | No | An internal [comment](https://docs.corsair.dev/docs/api/comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](https://docs.corsair.dev/docs/api/hosted_pages) or any document such as the [Invoice PDF](https://docs.corsair.dev/docs/api/invoices/retrieve-invoice-as-pdf) . |
| `subscription_id` | `string` | No | Identifier of the subscription for which this addon needs to be created. Applicable for consolidated invoice. |
| `line_item` | `object` | No | Parameters for line\_item |

> [accordion] line\_item full type
>
> ```ts theme={null}
> {
>   date_from?: number,
>   date_to?: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | Invoices are statements containing charges, adjustments and any discounts for a subscription specific to a term. For every subscription a draft invoice (upcoming invoice) is used to track all the charges, credits and adjustments for the current term. Generally, an invoice is closed at start of the next term. However, cancellation and other such operations on subscription may trigger premature closing. While closing the invoice, in addition to recurring charges, credits and coupons are applied to calculate the final amount that is due. When invoice is closed, an attempt to charge the credit card is made. If the payment succeeds, it is marked as **paid** . If the payment fails, the invoice is marked as **payment\_due** and retry settings are taken into account. If no retry attempts are configured, the invoice is marked as **not\_paid** . If the amount due is zero or negative, the invoice is immediately marked as **paid** and the balance if any is carried forward to the next term of the invoice. **Note:** If *consolidated invoicing* is enabled, the attribute *invoice.subscription\_id* should **not** be used (as it will not be present if the invoice has lines from multiple subscriptions). Instead to know the related subscriptions, their [line\_items](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) *subscription\_id* attribute should be referred. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### addCharge

`invoices.addCharge`

Add one-time charge to a pending invoice. Adds a one-time charge to a pending invoice. A one-time charge is a charge that is added ad hoc to the invoice and does not represent a predefined item price. It appears in the invoice as a line\_item of entity\_type adhoc.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.invoices.addCharge({ invoiceId: 'inv_1001', amount: 1, description: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `invoiceId` | `string` | Yes | — |
| `amount` | `number` | Yes | The amount to be charged. The unit depends on the [type of currency](https://docs.corsair.dev/docs/api/getting-started) . |
| `description` | `string` | Yes | Detailed description about this lineitem. |
| `avalara_sale_type` | `wholesale \| retail \| consumed \| vendor_use` | No | Indicates the type of sale carried out. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. \* retail - Transaction is a sale to an end user \* wholesale - Transaction is a sale to another company that will resell your product or service to another consumer \* vendor\_use - Transaction is for an item that is subject to vendor use tax \* consumed - Transaction is for an item that is consumed directly |
| `avalara_transaction_type` | `number` | No | Indicates the type of product to be taxed. Values for this field can be taken from Avalara. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. |
| `avalara_service_type` | `number` | No | Indicates the type of service for the product to be taxed. Values for this field can be taken from Avalara. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. |
| `avalara_tax_code` | `string` | No | This represents the Avalara tax code to which the one-time charge is mapped. Applicable only if you use Chargebee's [AvaTax for Sales integration](https://www.chargebee.com/docs/avatax-for-sales.html) . |
| `hsn_code` | `string` | No | The [HSN code](https://cbic-gst.gov.in/gst-goods-services-rates.html) to which the one-time charge is mapped for calculating the customer's tax in India. Applicable when both the conditions are true: \* [**India**](https://www.chargebee.com/docs/indian-gst.html#configuring-indian-gst) has been enabled as a **Tax Region**. (An error is returned when this condition is not true.) \* The [**AvaTax for Sales** integration](https://www.chargebee.com/docs/avalara.html) has been enabled in Chargebee. . |
| `taxjar_product_code` | `string` | No | This represents the TaxJar product code to which the one-time charge is mapped. Applicable only if you use Chargebee's [TaxJar integration](https://www.chargebee.com/docs/taxjar.html) . |
| `comment` | `string` | No | An internal [comment](https://docs.corsair.dev/docs/api/comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](https://docs.corsair.dev/docs/api/hosted_pages) or any document such as the [Invoice PDF](https://docs.corsair.dev/docs/api/invoices/retrieve-invoice-as-pdf) . |
| `subscription_id` | `string` | No | Identifier of the subscription for which this charge needs to be created. Applicable for consolidated invoice. |
| `line_item` | `object` | No | Parameters for line\_item |

> [accordion] line\_item full type
>
> ```ts theme={null}
> {
>   date_from?: number,
>   date_to?: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### addChargeItem

`invoices.addChargeItem`

Add a charge-item to a pending invoice. This endpoint is used when metered billing is enabled and it adds a charge-item price to a pending invoice. To collect the accumulated charges by closing the invoice, call Close a pending invoice.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.invoices.addChargeItem({ invoiceId: 'inv_1001' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `invoiceId` | `string` | Yes | — |
| `comment` | `string` | No | An internal [comment](https://docs.corsair.dev/docs/api/comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](https://docs.corsair.dev/docs/api/hosted_pages) or any document such as the [Invoice PDF](https://docs.corsair.dev/docs/api/invoices/retrieve-invoice-as-pdf) . |
| `subscription_id` | `string` | No | Identifier of the subscription for which this addon needs to be created. Applicable for consolidated invoice. |
| `item_price` | `object` | No | Parameters for item\_price |
| `item_tiers` | `object` | No | Parameters for item\_tiers |

> [accordion] item\_price full type
>
> ```ts theme={null}
> {
>   item_price_id: string,
>   quantity?: number,
>   quantity_in_decimal?: string,
>   unit_price?: number,
>   unit_price_in_decimal?: string,
>   date_from?: number,
>   date_to?: number
> }
> ```

> [accordion] item\_tiers full type
>
> ```ts theme={null}
> {
>   starting_unit?: number[],
>   ending_unit?: number[],
>   price?: number[],
>   starting_unit_in_decimal?: string[],
>   ending_unit_in_decimal?: string[],
>   price_in_decimal?: string[],
>   pricing_type?: (per_unit | flat_fee | package)[],
>   package_size?: number[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### applyCredits

`invoices.applyCredits`

Apply credits for an invoice. Applies a customer's refundable credits to a specified invoice. You can either specify the credit notes to be applied, or let Chargebee apply the available credit notes automatically. ### Prerequisites & Constraints \* The customer must have refundable credits available.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.invoices.applyCredits({ invoiceId: 'inv_1001' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `invoiceId` | `string` | Yes | — |
| `comment` | `string` | No | An internal [comment](https://docs.corsair.dev/docs/api/comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](https://docs.corsair.dev/docs/api/hosted_pages) or any document such as the [Invoice PDF](https://docs.corsair.dev/docs/api/invoices/retrieve-invoice-as-pdf) . |
| `credit_notes` | `object` | No | Parameters for credit\_notes |

> [accordion] credit\_notes full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   amount?: number[],
>   applied_at?: number[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### applyPayments

`invoices.applyPayments`

Apply payments for an invoice. Applies payment to a single invoice. You can either specify individual payment transactions as parameters, or Chargebee applies any available excess payments for that customer. If you specify individual transactions then any un-applied amount in those transactions will be used.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.invoices.applyPayments({ invoiceId: 'inv_1001' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `invoiceId` | `string` | Yes | — |
| `comment` | `string` | No | An internal [comment](https://docs.corsair.dev/docs/api/comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](https://docs.corsair.dev/docs/api/hosted_pages) or any document such as the [Invoice PDF](https://docs.corsair.dev/docs/api/invoices/retrieve-invoice-as-pdf) . |
| `transactions` | `object` | No | Parameters for transactions |

> [accordion] transactions full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   amount?: number[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### applyPaymentScheduleScheme

`invoices.applyPaymentScheduleScheme`

Apply payment schedule scheme to an invoice. Applying a payment schedule scheme to an invoice creates payment schedules, enabling the invoice to be paid in multiple, scheduled payments. Note: The invoice must be in payment\_due .

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.invoices.applyPaymentScheduleScheme({ invoiceId: 'inv_1001', scheme_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `invoiceId` | `string` | Yes | — |
| `scheme_id` | `string` | Yes | The identifier of the `payment_schedule_scheme` , used to create the payment schedules. |
| `amount` | `number` | No | The part of the `invoice.amount_due` to be distributed across the payment schedules. If not specified, the entire `invoice.amount_due` is considered by default. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### charge

`invoices.charge`

Create invoice for a one-time charge. Generate invoices for a one-time charge using this API. Product Catalog 1.0 sites only.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.invoices.charge({ description: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `customer_id` | `string` | No | Identifier of the customer for which this invoice needs to be created. Should be specified if 'subscription\_id' is not specified. |
| `subscription_id` | `string` | No | Identifier of the subscription for which this invoice needs to be created. Should be specified if 'customer\_id' is not specified.(not applicable for consolidated invoice). |
| `currency_code` | `string` | No | The currency code (ISO 4217 format) of the invoice amount. Applicable only while creating an invoice for a customer (by specifying *customer\_id* ). |
| `amount` | `number` | No | The amount to be charged. The unit depends on the [type of currency](https://docs.corsair.dev/docs/api/getting-started) . |
| `amount_in_decimal` | `string` | No | The decimal representation of the amount for the [one-time charge](https://www.chargebee.com/docs/charges.html#one-time-charges). Provide the value in major units of the currency. Can be provided only when [multi-decimal pricing](https://docs.corsair.dev/docs/api/v2/pcv-1/currencies) is enabled. |
| `description` | `string` | Yes | Description for this charge. |
| `date_from` | `number` | No | The time when the service period for the charge starts. |
| `date_to` | `number` | No | The time when the service period for the charge ends. |
| `coupon_ids` | `string[]` | No | List of Coupons to be added. |
| `avalara_sale_type` | `wholesale \| retail \| consumed \| vendor_use` | No | Indicates the type of sale carried out. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. \* retail - Transaction is a sale to an end user \* vendor\_use - Transaction is for an item that is subject to vendor use tax \* wholesale - Transaction is a sale to another company that will resell your product or service to another consumer \* consumed - Transaction is for an item that is consumed directly |
| `avalara_transaction_type` | `number` | No | Indicates the type of product to be taxed. Values for this field can be taken from Avalara. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. |
| `avalara_service_type` | `number` | No | Indicates the type of service for the product to be taxed. Values for this field can be taken from Avalara. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. |
| `po_number` | `string` | No | Purchase Order Number for this invoice. |
| `invoice_date` | `number` | No | 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. |
| `payment_source_id` | `string` | No | Payment source to be used for this payment. |
| `payment_initiator` | `customer \| merchant` | No | The type of initiator to be used for the payment request triggered by this operation. \* customer - Pass this value to indicate that the request is initiated by the customer \* merchant - Pass this value to indicate that the request is initiated by the merchant |
| `tax_providers_fields` | `object` | No | Parameters for tax\_providers\_fields |

> [accordion] tax\_providers\_fields full type
>
> ```ts theme={null}
> {
>   provider_name?: string[],
>   field_id?: string[],
>   field_value?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | Invoices are statements containing charges, adjustments and any discounts for a subscription specific to a term. For every subscription a draft invoice (upcoming invoice) is used to track all the charges, credits and adjustments for the current term. Generally, an invoice is closed at start of the next term. However, cancellation and other such operations on subscription may trigger premature closing. While closing the invoice, in addition to recurring charges, credits and coupons are applied to calculate the final amount that is due. When invoice is closed, an attempt to charge the credit card is made. If the payment succeeds, it is marked as **paid** . If the payment fails, the invoice is marked as **payment\_due** and retry settings are taken into account. If no retry attempts are configured, the invoice is marked as **not\_paid** . If the amount due is zero or negative, the invoice is immediately marked as **paid** and the balance if any is carried forward to the next term of the invoice. **Note:** If *consolidated invoicing* is enabled, the attribute *invoice.subscription\_id* should **not** be used (as it will not be present if the invoice has lines from multiple subscriptions). Instead to know the related subscriptions, their [line\_items](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) *subscription\_id* attribute should be referred. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### chargeAddon

`invoices.chargeAddon`

Create invoice for a non-recurring addon. Generate invoices for a non-recurring addon using this API. Product Catalog 1.0 sites only.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.invoices.chargeAddon({ addon_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `customer_id` | `string` | No | Identifier of the customer for which this invoice needs to be created. Should be specified if 'subscription\_id' is not specified. |
| `subscription_id` | `string` | No | Identifier of the subscription for which this invoice(not applicable for consolidated invoice) needs to be created. Should be specified if 'customer\_id' is not specified. |
| `addon_id` | `string` | Yes | The ID of the non-recurring addon to be charged. |
| `addon_quantity` | `number` | No | The number of addon units to be charged. Mandatory for quantity based addons. |
| `addon_unit_price` | `number` | No | Amount that will override the Addon's default price. The unit depends on the [type of currency](https://docs.corsair.dev/docs/api/getting-started) . |
| `addon_quantity_in_decimal` | `string` | No | The number of addon units to be charged in decimal. |
| `addon_unit_price_in_decimal` | `string` | No | Addon Amount in Decimal. |
| `date_from` | `number` | No | The time when the service period for the addon starts. |
| `date_to` | `number` | No | The time when the service period for the addon ends. |
| `coupon_ids` | `string[]` | No | List of Coupons to be added. |
| `po_number` | `string` | No | Purchase Order Number for this invoice. |
| `invoice_date` | `number` | No | 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. |
| `payment_source_id` | `string` | No | Payment source to be used for this payment. |
| `payment_initiator` | `customer \| merchant` | No | The type of initiator to be used for the payment request triggered by this operation. \* merchant - Pass this value to indicate that the request is initiated by the merchant \* customer - Pass this value to indicate that the request is initiated by the customer |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | Invoices are statements containing charges, adjustments and any discounts for a subscription specific to a term. For every subscription a draft invoice (upcoming invoice) is used to track all the charges, credits and adjustments for the current term. Generally, an invoice is closed at start of the next term. However, cancellation and other such operations on subscription may trigger premature closing. While closing the invoice, in addition to recurring charges, credits and coupons are applied to calculate the final amount that is due. When invoice is closed, an attempt to charge the credit card is made. If the payment succeeds, it is marked as **paid** . If the payment fails, the invoice is marked as **payment\_due** and retry settings are taken into account. If no retry attempts are configured, the invoice is marked as **not\_paid** . If the amount due is zero or negative, the invoice is immediately marked as **paid** and the balance if any is carried forward to the next term of the invoice. **Note:** If *consolidated invoicing* is enabled, the attribute *invoice.subscription\_id* should **not** be used (as it will not be present if the invoice has lines from multiple subscriptions). Instead to know the related subscriptions, their [line\_items](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) *subscription\_id* attribute should be referred. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### close

`invoices.close`

Close a pending invoice. Invoices for a subscription are created with a pending status when the subscription has create\_pending\_invoices attribute set to true. This API call finalizes a pending invoice.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.invoices.close({ invoiceId: 'inv_1001' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `invoiceId` | `string` | Yes | — |
| `comment` | `string` | No | An internal [comment](https://docs.corsair.dev/docs/api/comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](https://docs.corsair.dev/docs/api/hosted_pages) or any document such as the [Invoice PDF](https://docs.corsair.dev/docs/api/invoices/retrieve-invoice-as-pdf) . |
| `invoice_note` | `string` | No | A note for this particular invoice. This, and [all other notes](https://docs.corsair.dev/docs/api/invoices/invoice-object#notes) for the invoice are displayed on the PDF invoice sent to the customer. |
| `remove_general_note` | `boolean` | No | Set as `true` to remove the [**general note**](https://www.chargebee.com/docs/invoice_notes.html#adding-general-notes) from this invoice. |
| `invoice_date` | `number` | No | Set the [invoice date](https://docs.corsair.dev/docs/api/invoices/invoice-object#date). Must lie between the date when the invoice was generated and current date. Can only be passed when the site setting to allow overriding is enabled. If not passed, then the default value [set at the site level](https://www.chargebee.com/docs/metered_billing.html#overview) is used. |
| `notes_to_remove` | `object` | No | Parameters for notes\_to\_remove |

> [accordion] notes\_to\_remove full type
>
> ```ts theme={null}
> {
>   entity_type?: (customer | subscription | coupon | plan_item_price | addon_item_price | charge_item_price)[],
>   entity_id?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### collectPayment

`invoices.collectPayment`

Collect payment for an invoice. Collects a specified amount of payment for an invoice, via a specified online payment method. #### Offline payments When there is no payment method available, and if you wish to record an offline payment, use the Record an offline payment API instead. Charges the customer's payment method for the invoice.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.invoices.collectPayment({ invoiceId: 'inv_1001' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `invoiceId` | `string` | Yes | — |
| `amount` | `number` | No | Amount to be collected. **Constraints** \* Must be less than or equal to the `invoice.amount_to_collect` or the `transaction.amount` if `authorization_transaction_id` is passed, whichever is lesser. **Default value** \* When not passed, then `invoice.amount_to_collect` is assumed. |
| `authorization_transaction_id` | `string` | No | The `id` of the transaction that is used to authorize the payment. (The transaction's [`type`](https://docs.corsair.dev/docs/api/transactions/transaction-object#type) must be `authorization`.) **Required if** \* `payment_source_id` is not passed. **Prerequisites** \* The `transaction.fraud_flag` must be `safe`. **Constraints** \* Applicable only for card payments via [Stripe](https://www.chargebee.com/docs/payments/2.0/payment-gateways-and-configuration/stripe). |
| `payment_source_id` | `string` | No | The `id` of a valid `payment_source` associated with the customer. **Required if** \* `authorization_transaction_id` is not passed. |
| `comment` | `string` | No | An internal [comment](https://docs.corsair.dev/docs/api/comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](https://docs.corsair.dev/docs/api/hosted_pages) or any document such as the [Invoice PDF](https://docs.corsair.dev/docs/api/invoices/retrieve-invoice-as-pdf) . |
| `payment_initiator` | `customer \| merchant` | No | The initiator of this payment request. Sending this information can improve the success rate of the payment at the gateway. \* merchant - The payment was initiated by you (the merchant). \* customer - The payment was initiated by your customer. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |
| `transaction` | `object \| null` | No | This resource represents the [transaction](https://www.chargebee.com/docs/transactions.html) event that has happened in your account. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

> [accordion] transaction full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   gateway_account_id?: string | null,
>   payment_source_id?: string | null,
>   payment_method?: string | null,
>   reference_number?: string | null,
>   gateway?: string | null,
>   type?: string | null,
>   date?: number | null,
>   settled_at?: number | null,
>   exchange_rate?: number | null,
>   currency_code?: string | null,
>   amount?: number | null,
>   id_at_gateway?: string | null,
>   status?: string | null,
>   fraud_flag?: string | null,
>   initiator_type?: string | null,
>   three_d_secure?: boolean | null,
>   authorization_reason?: string | null,
>   error_code?: string | null,
>   error_text?: string | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   fraud_reason?: string | null,
>   custom_payment_method_id?: string | null,
>   amount_unused?: number | null,
>   masked_card_number?: string | null,
>   reference_transaction_id?: string | null,
>   refunded_txn_id?: string | null,
>   reference_authorization_id?: string | null,
>   amount_capturable?: number | null,
>   reversal_transaction_id?: string | null,
>   deleted?: boolean | null,
>   iin?: string | null,
>   last4?: string | null,
>   merchant_reference_id?: string | null,
>   business_entity_id?: string | null,
>   payment_method_details?: string | null,
>   custom_payment_method_name?: string | null,
>   linked_invoices?: {
>     invoice_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     invoice_date?: number | null,
>     invoice_total?: number | null,
>     invoice_status?: string | null
>   }[] | null,
>   linked_credit_notes?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null,
>     cn_reference_invoice_id?: string | null
>   }[] | null,
>   linked_refunds?: {
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   linked_payments?: {
>     id?: string | null,
>     status?: string | null,
>     amount?: number | null,
>     date?: number | null
>   }[] | null,
>   gateway_metadata?: {
>     acquirer_reference_id?: string | null
>   } | null,
>   error_detail?: {
>     request_id?: string | null,
>     error_category?: string | null,
>     error_code?: string | null,
>     error_message?: string | null,
>     decline_code?: string | null,
>     decline_message?: string | null,
>     network_error_code?: string | null,
>     network_error_message?: string | null,
>     error_field?: string | null,
>     recommendation_code?: string | null,
>     recommendation_message?: string | null,
>     processor_error_code?: string | null,
>     processor_error_message?: string | null,
>     error_cause_id?: string | null,
>     processor_advice_code?: string | null
>   } | null,
>   network_transaction_details?: {
>     network_transaction_id?: string | null,
>     original_network_transaction_id?: string | null
>   } | null
> } | null
> ```

***

### create

`invoices.create`

Create an invoice. Note: This operation optionally supports 3DS verification flow. To achieve the same, create the Payment Intent and pass it as input parameter to this API. Creates a one-off invoice for multiple 'Non Recurring' add-on & ad-hoc charges for a customer. Product Catalog 1.0 sites only.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.invoices.create({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `customer_id` | `string` | No | Identifier of the customer for which this invoice needs to be created. Should be specified if 'subscription\_id' is not specified. |
| `subscription_id` | `string` | No | Identifier of the subscription for which this invoice needs to be created. Should be specified if 'customer\_id' is not specified.(not applicable for consolidated invoice). |
| `currency_code` | `string` | No | The currency code (ISO 4217 format) of the invoice amount. |
| `invoice_date` | `number` | No | 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. |
| `invoice_note` | `string` | No | A note for this particular invoice. This, and [all other notes](https://docs.corsair.dev/docs/api/invoices/invoice-object#notes) for the invoice are displayed on the PDF invoice sent to the customer. |
| `remove_general_note` | `boolean` | No | Set as `true` to remove the [**general note**](https://www.chargebee.com/docs/invoice_notes.html#adding-general-notes) from this invoice. |
| `po_number` | `string` | No | Purchase Order Number for this invoice. |
| `coupon_ids` | `string[]` | No | List of Coupons to be added. |
| `authorization_transaction_id` | `string` | No | Authorization transaction to be captured. |
| `payment_source_id` | `string` | No | Payment source to be used for this payment. |
| `auto_collection` | `on \| off` | No | If specified, the customer level auto collection will be overridden. \* on - Whenever an invoice is created, an automatic attempt will be made to charge. \* off - Whenever an invoice is created as payment due. |
| `token_id` | `string` | No | Token generated by Chargebee.js representing payment method details. |
| `replace_primary_payment_source` | `boolean` | No | Indicates whether the primary payment source should be replaced with this payment source. In case of Create Subscription for Customer endpoint, the default value is True. Otherwise, the default value is False. |
| `retain_payment_source` | `boolean` | No | Indicates whether the payment source should be retained for the customer. |
| `payment_initiator` | `customer \| merchant` | No | The type of initiator to be used for the payment request triggered by this operation. \* customer - Pass this value to indicate that the request is initiated by the customer \* merchant - Pass this value to indicate that the request is initiated by the merchant |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `statement_descriptor` | `object` | No | Parameters for statement\_descriptor |
| `card` | `object` | No | Parameters for card |
| `bank_account` | `object` | No | Parameters for bank\_account |
| `payment_method` | `object` | No | Parameters for payment\_method |
| `payment_intent` | `object` | No | Parameters for payment\_intent |
| `addons` | `object` | No | Parameters for addons |
| `charges` | `object` | No | Parameters for charges |
| `tax_providers_fields` | `object` | No | Parameters for tax\_providers\_fields |
| `notes_to_remove` | `object` | No | Parameters for notes\_to\_remove |

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] statement\_descriptor full type
>
> ```ts theme={null}
> {
>   descriptor?: string
> }
> ```

> [accordion] card full type
>
> ```ts theme={null}
> {
>   gateway_account_id?: string,
>   first_name?: string,
>   last_name?: string,
>   number?: string,
>   expiry_month?: number,
>   expiry_year?: number,
>   cvv?: string,
>   preferred_scheme?: cartes_bancaires | mastercard | visa | dankort,
>   billing_addr1?: string,
>   billing_addr2?: string,
>   billing_city?: string,
>   billing_state_code?: string,
>   billing_state?: string,
>   billing_zip?: string,
>   billing_country?: string,
>   additional_information?: {
>   }
> }
> ```

> [accordion] bank\_account full type
>
> ```ts theme={null}
> {
>   gateway_account_id?: string,
>   iban?: string,
>   first_name?: string,
>   last_name?: string,
>   company?: string,
>   email?: string,
>   phone?: string,
>   bank_name?: string,
>   account_number?: string,
>   routing_number?: string,
>   bank_code?: string,
>   account_type?: checking | savings | business_checking | current,
>   account_holder_type?: individual | company,
>   echeck_type?: web | ppd | ccd,
>   issuing_country?: string,
>   swedish_identity_number?: string,
>   billing_address?: {
>   }
> }
> ```

> [accordion] payment\_method full type
>
> ```ts theme={null}
> {
>   type?: card | paypal_express_checkout | amazon_payments | direct_debit | generic | alipay | unionpay | apple_pay | wechat_pay | ideal | google_pay | sofort | bancontact | giropay | dotpay | upi | netbanking_emandates | venmo | pay_to | faster_payments | sepa_instant_transfer | automated_bank_transfer | klarna_pay_now | online_banking_poland | payconiq_by_bancontact | electronic_payment_standard | kbc_payment_button | pay_by_bank | trustly | stablecoin | kakao_pay | naver_pay | revolut_pay | cash_app_pay | twint | go_pay | grab_pay | pay_co | after_pay | swish | payme | pix | klarna | alipay_hk | paypay | gcash | south_korean_cards | paynow | bizum | promptpay | dana | touch_n_go | tamara | qpay | ovo | momo | mercado_pago | nequi | nupay | picpay | thai_qr | blik | fpx | wero | p24 | affirm_pay | rakuten_pay,
>   gateway_account_id?: string,
>   reference_id?: string,
>   tmp_token?: string,
>   issuing_country?: string,
>   additional_information?: {
>   }
> }
> ```

> [accordion] payment\_intent full type
>
> ```ts theme={null}
> {
>   id?: string,
>   gateway_account_id?: string,
>   gw_token?: string,
>   payment_method_type?: card | ideal | sofort | bancontact | google_pay | dotpay | giropay | apple_pay | upi | netbanking_emandates | paypal_express_checkout | direct_debit | boleto | venmo | amazon_payments | pay_to | faster_payments | sepa_instant_transfer | klarna_pay_now | online_banking_poland | payconiq_by_bancontact | electronic_payment_standard | kbc_payment_button | pay_by_bank | trustly | stablecoin | kakao_pay | naver_pay | revolut_pay | cash_app_pay | wechat_pay | alipay | twint | go_pay | grab_pay | pay_co | after_pay | swish | payme | pix | klarna | alipay_hk | paypay | gcash | south_korean_cards | paynow | bizum | promptpay | dana | touch_n_go | tamara | qpay | ovo | momo | mercado_pago | nequi | nupay | picpay | thai_qr | blik | fpx | wero | p24 | affirm_pay | rakuten_pay,
>   reference_id?: string,
>   additional_information?: {
>   }
> }
> ```

> [accordion] addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   unit_price?: number[],
>   quantity_in_decimal?: string[],
>   unit_price_in_decimal?: string[],
>   date_from?: number[],
>   date_to?: number[]
> }
> ```

> [accordion] charges full type
>
> ```ts theme={null}
> {
>   amount?: number[],
>   amount_in_decimal?: string[],
>   description?: string[],
>   taxable?: boolean[],
>   tax_profile_id?: string[],
>   avalara_tax_code?: string[],
>   hsn_code?: string[],
>   taxjar_product_code?: string[],
>   avalara_sale_type?: (wholesale | retail | consumed | vendor_use)[],
>   avalara_transaction_type?: number[],
>   avalara_service_type?: number[],
>   date_from?: number[],
>   date_to?: number[]
> }
> ```

> [accordion] tax\_providers\_fields full type
>
> ```ts theme={null}
> {
>   provider_name?: string[],
>   field_id?: string[],
>   field_value?: string[]
> }
> ```

> [accordion] notes\_to\_remove full type
>
> ```ts theme={null}
> {
>   entity_type?: (plan | addon | customer | subscription | coupon)[],
>   entity_id?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | Invoices are statements containing charges, adjustments and any discounts for a subscription specific to a term. For every subscription a draft invoice (upcoming invoice) is used to track all the charges, credits and adjustments for the current term. Generally, an invoice is closed at start of the next term. However, cancellation and other such operations on subscription may trigger premature closing. While closing the invoice, in addition to recurring charges, credits and coupons are applied to calculate the final amount that is due. When invoice is closed, an attempt to charge the credit card is made. If the payment succeeds, it is marked as **paid** . If the payment fails, the invoice is marked as **payment\_due** and retry settings are taken into account. If no retry attempts are configured, the invoice is marked as **not\_paid** . If the amount due is zero or negative, the invoice is immediately marked as **paid** and the balance if any is carried forward to the next term of the invoice. **Note:** If *consolidated invoicing* is enabled, the attribute *invoice.subscription\_id* should **not** be used (as it will not be present if the invoice has lines from multiple subscriptions). Instead to know the related subscriptions, their [line\_items](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) *subscription\_id* attribute should be referred. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### createForChargeItemsAndCharges

`invoices.createForChargeItemsAndCharges`

Create invoice for items and one-time charges. Creates an invoice for charge-items and one-time charges. The item prices must belong to items of type charge. You can optionally override the line item name and description displayed on the invoice for charge-item prices and one-time charges.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.invoices.createForChargeItemsAndCharges({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customer_id` | `string` | No | Unique ID of the customer this invoice should be created for. Either this or `subscription_id` must be provided. **Note** The invoice is [linked](https://docs.corsair.dev/docs/api/getting-started) to the same [business entity](https://docs.corsair.dev/docs/api/getting-started) as this customer. |
| `subscription_id` | `string` | No | Unique ID of the subscription this invoice should be created for. Either this or `customer_id` must be provided. **Note** The invoice is [linked](https://docs.corsair.dev/docs/api/getting-started) to the same [business entity](https://docs.corsair.dev/docs/api/getting-started) as this subscription. |
| `currency_code` | `string` | No | The currency code (ISO 4217 format) of the invoice amount. |
| `invoice_note` | `string` | No | A note for this particular invoice. This, and [all other notes](https://docs.corsair.dev/docs/api/invoices/invoice-object#notes) for the invoice are displayed on the PDF invoice sent to the customer. |
| `remove_general_note` | `boolean` | No | Set as `true` to remove the [**general note**](https://www.chargebee.com/docs/invoice_notes.html#adding-general-notes) from this invoice. |
| `po_number` | `string` | No | Purchase Order Number for this invoice. |
| `coupon_ids` | `string[]` | No | List of Coupons to be added. |
| `authorization_transaction_id` | `string` | No | Authorization transaction to be captured. |
| `payment_source_id` | `string` | No | Payment source to be used for this payment. |
| `auto_collection` | `on \| off` | No | If specified, the customer level auto collection will be overridden. **Note** \* When `create_pending_invoice` is `true`, `auto_collection` cannot be passed. When the pending invoice is closed, the [subscription](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#auto_collection) `auto_collection` setting is used when available; otherwise, the [customer](https://docs.corsair.dev/docs/api/customers/customer-object#auto_collection) `auto_collection` setting applies. \* on - Whenever an invoice is created, an automatic attempt will be made to charge. \* off - Whenever an invoice is created as payment due. |
| `net_term_days` | `number` | No | The [Net D](https://www.chargebee.com/docs/billing/2.0/subscriptions/net_d) value explicitly set for this invoice. Net D is the number of days within which the invoice must be paid. When this value is provided, it overrides the payment terms defined at the subscription or customer level. **Note:** This value is used only for this invoice operation and does not update the customer or subscription records. |
| `offline_payment_method` | `no_preference \| cash \| check \| bank_transfer \| ach_credit \| sepa_credit \| boleto \| us_automated_bank_transfer \| eu_automated_bank_transfer \| uk_automated_bank_transfer \| jp_automated_bank_transfer \| mx_automated_bank_transfer \| custom` | No | — |
| `invoice_date` | `number` | No | 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. |
| `create_pending_invoice` | `boolean` | No | When set to `true`, the invoice is created with `status` as `pending` and payment is not collected. The invoice can be closed later via the [close a pending invoice](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice) operation. **Prerequisites** \* [Usage-based billing](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/setting-up-usage-based-billing) must be enabled for the site. \* `subscription_id` must be provided. **Constraints** \* Payment collection parameters cannot be passed when this parameter is `true`. This includes `payment_source_id`, `authorization_transaction_id`, `auto_collection`, `payment_method` parameters, `card` parameters, `payment_intent` parameters, and `token_id`. \* `auto_collection` cannot be overridden on this request. When the pending invoice is closed, the [subscription](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#auto_collection) or [customer](https://docs.corsair.dev/docs/api/customers/customer-object#auto_collection) `auto_collection` setting applies. |
| `token_id` | `string` | No | Token generated by Chargebee.js representing payment method details. |
| `replace_primary_payment_source` | `boolean` | No | Indicates whether the primary payment source should be replaced with this payment source. In case of Create Subscription for Customer endpoint, the default value is True. Otherwise, the default value is False. |
| `retain_payment_source` | `boolean` | No | Indicates whether the payment source should be retained for the customer. |
| `payment_initiator` | `customer \| merchant` | No | The type of initiator to be used for the payment request triggered by this operation. \* customer - Pass this value to indicate that the request is initiated by the customer \* merchant - Pass this value to indicate that the request is initiated by the merchant |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `statement_descriptor` | `object` | No | Parameters for statement\_descriptor |
| `card` | `object` | No | Parameters for card |
| `bank_account` | `object` | No | Parameters for bank\_account |
| `payment_method` | `object` | No | Parameters for payment\_method |
| `payment_intent` | `object` | No | Parameters for payment\_intent |
| `item_prices` | `object` | No | Parameters for item\_prices |
| `item_tiers` | `object` | No | Parameters for item\_tiers |
| `charges` | `object` | No | Parameters for charges |
| `notes_to_remove` | `object` | No | Parameters for notes\_to\_remove |
| `tax_providers_fields` | `object` | No | Parameters for tax\_providers\_fields |
| `discounts` | `object` | No | Parameters for discounts |

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] statement\_descriptor full type
>
> ```ts theme={null}
> {
>   descriptor?: string
> }
> ```

> [accordion] card full type
>
> ```ts theme={null}
> {
>   gateway_account_id?: string,
>   first_name?: string,
>   last_name?: string,
>   number?: string,
>   expiry_month?: number,
>   expiry_year?: number,
>   cvv?: string,
>   preferred_scheme?: cartes_bancaires | mastercard | visa | dankort,
>   billing_addr1?: string,
>   billing_addr2?: string,
>   billing_city?: string,
>   billing_state_code?: string,
>   billing_state?: string,
>   billing_zip?: string,
>   billing_country?: string,
>   additional_information?: {
>   }
> }
> ```

> [accordion] bank\_account full type
>
> ```ts theme={null}
> {
>   gateway_account_id?: string,
>   iban?: string,
>   first_name?: string,
>   last_name?: string,
>   company?: string,
>   email?: string,
>   phone?: string,
>   bank_name?: string,
>   account_number?: string,
>   routing_number?: string,
>   bank_code?: string,
>   account_type?: checking | savings | business_checking | current,
>   account_holder_type?: individual | company,
>   echeck_type?: web | ppd | ccd,
>   issuing_country?: string,
>   swedish_identity_number?: string,
>   billing_address?: {
>   }
> }
> ```

> [accordion] payment\_method full type
>
> ```ts theme={null}
> {
>   type?: card | paypal_express_checkout | amazon_payments | direct_debit | generic | alipay | unionpay | apple_pay | wechat_pay | ideal | google_pay | sofort | bancontact | giropay | dotpay | upi | netbanking_emandates | venmo | pay_to | faster_payments | sepa_instant_transfer | automated_bank_transfer | klarna_pay_now | online_banking_poland | payconiq_by_bancontact | electronic_payment_standard | kbc_payment_button | pay_by_bank | trustly | stablecoin | kakao_pay | naver_pay | revolut_pay | cash_app_pay | twint | go_pay | grab_pay | pay_co | after_pay | swish | payme | pix | klarna | alipay_hk | paypay | gcash | south_korean_cards | paynow | bizum | promptpay | dana | touch_n_go | tamara | qpay | ovo | momo | mercado_pago | nequi | nupay | picpay | thai_qr | blik | fpx | wero | p24 | affirm_pay | rakuten_pay,
>   gateway_account_id?: string,
>   reference_id?: string,
>   tmp_token?: string,
>   issuing_country?: string,
>   additional_information?: {
>   }
> }
> ```

> [accordion] payment\_intent full type
>
> ```ts theme={null}
> {
>   id?: string,
>   gateway_account_id?: string,
>   gw_token?: string,
>   payment_method_type?: card | ideal | sofort | bancontact | google_pay | dotpay | giropay | apple_pay | upi | netbanking_emandates | paypal_express_checkout | direct_debit | boleto | venmo | amazon_payments | pay_to | faster_payments | sepa_instant_transfer | klarna_pay_now | online_banking_poland | payconiq_by_bancontact | electronic_payment_standard | kbc_payment_button | pay_by_bank | trustly | stablecoin | kakao_pay | naver_pay | revolut_pay | cash_app_pay | wechat_pay | alipay | twint | go_pay | grab_pay | pay_co | after_pay | swish | payme | pix | klarna | alipay_hk | paypay | gcash | south_korean_cards | paynow | bizum | promptpay | dana | touch_n_go | tamara | qpay | ovo | momo | mercado_pago | nequi | nupay | picpay | thai_qr | blik | fpx | wero | p24 | affirm_pay | rakuten_pay,
>   reference_id?: string,
>   additional_information?: {
>   }
> }
> ```

> [accordion] item\_prices full type
>
> ```ts theme={null}
> {
>   item_price_id?: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   unit_price?: number[],
>   unit_price_in_decimal?: string[],
>   date_from?: number[],
>   date_to?: number[],
>   description?: string[],
>   entity_description?: string[]
> }
> ```

> [accordion] item\_tiers full type
>
> ```ts theme={null}
> {
>   item_price_id?: string[],
>   starting_unit?: number[],
>   ending_unit?: number[],
>   price?: number[],
>   starting_unit_in_decimal?: string[],
>   ending_unit_in_decimal?: string[],
>   price_in_decimal?: string[],
>   pricing_type?: (per_unit | flat_fee | package)[],
>   package_size?: number[]
> }
> ```

> [accordion] charges full type
>
> ```ts theme={null}
> {
>   entity_description?: string[],
>   amount?: number[],
>   amount_in_decimal?: string[],
>   description?: string[],
>   taxable?: boolean[],
>   tax_profile_id?: string[],
>   avalara_tax_code?: string[],
>   hsn_code?: string[],
>   taxjar_product_code?: string[],
>   avalara_sale_type?: (wholesale | retail | consumed | vendor_use)[],
>   avalara_transaction_type?: number[],
>   avalara_service_type?: number[],
>   date_from?: number[],
>   date_to?: number[]
> }
> ```

> [accordion] notes\_to\_remove full type
>
> ```ts theme={null}
> {
>   entity_type?: (customer | subscription | coupon | plan_item_price | addon_item_price | charge_item_price)[],
>   entity_id?: string[]
> }
> ```

> [accordion] tax\_providers\_fields full type
>
> ```ts theme={null}
> {
>   provider_name?: string[],
>   field_id?: string[],
>   field_value?: string[]
> }
> ```

> [accordion] discounts full type
>
> ```ts theme={null}
> {
>   percentage?: number[],
>   amount?: number[],
>   quantity?: number[],
>   apply_on: (invoice_amount | specific_item_price)[],
>   item_price_id?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### delete

`invoices.delete`

Delete an invoice. Deletes the specified invoice. #### Void the invoice If the invoice was generated incorrectly, void it instead of deleting it. Voiding preserves the audit trail and allows for future reference and compliance without removing the original record.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.invoices.delete({ invoiceId: 'inv_1001' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `invoiceId` | `string` | Yes | — |
| `comment` | `string` | No | Reason for deleting the invoice. This comment will be added to the subscription entity if the invoice belongs to a subscription. It is added to the customer entity if the invoice is associated only with a customer. |
| `claim_credits` | `boolean` | No | Indicates whether to put prorated credits back to the subscription or ignore while deleting the invoice. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### deleteLineItems

`invoices.deleteLineItems`

Delete line items. This endpoint is used to delete line items from "Pending" invoice.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.invoices.deleteLineItems({ invoiceId: 'inv_1001' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `invoiceId` | `string` | Yes | — |
| `line_items` | `object` | No | The list of line items which have to be deleted. |

> [accordion] line\_items full type
>
> ```ts theme={null}
> {
>   id?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### downloadEinvoice

`invoices.downloadEinvoice`

Download e-invoice. Download the e-invoice in both XML and PDF formats. The response consists of a download object for each format. The XML format follows the structure as per Peppol BIS Billing v3.0. Note \* You can only download e-invoices when their status is success.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.invoices.downloadEinvoice({ invoiceId: 'inv_1001' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `invoiceId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `downloads` | `object[] \| null` | No | Resource object representing download |

> [accordion] downloads full type
>
> ```ts theme={null}
> {
>   download_url?: string | null,
>   valid_till?: number | null,
>   mime_type?: string | null
> }[] | null
> ```

***

### get

`invoices.get`

Retrieve an invoice. Retrieve the invoice for the specified invoice id.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.invoices.get({ invoiceId: 'inv_1001' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `line_items_limit` | `number` | No | Specify the maximum number of line items to include in the response. **Note:** \* Applicable only when Enterprise-scale Invoicing is enabled. \* Enterprise-scale Invoicing is currently in **Private Beta** . Please reach out to [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. |
| `line_items_offset` | `string` | No | Specify the starting point for retrieving line items. Use the value from the `line_items_next_offset` attribute of the previous retrieve API response. **Note:** \* Applicable only when Enterprise-scale Invoicing is enabled. \* Enterprise-scale Invoicing is currently in **Private Beta** . Please reach out to [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. |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `invoiceId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### getPaymentSchedules

`invoices.getPaymentSchedules`

Retrieve payment schedules for an invoice. This endpoint retrieves payment schedules created for an invoice.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.invoices.getPaymentSchedules({ invoiceId: 'inv_1001' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `invoiceId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `payment_schedules` | `object[] \| null` | No | Resource object representing payment\_schedule |

> [accordion] payment\_schedules full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   scheme_id?: string | null,
>   entity_type?: string | null,
>   entity_id?: string | null,
>   amount?: number | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   currency_code?: string | null,
>   schedule_entries?: {
>     id?: string | null,
>     date?: number | null,
>     amount?: number | null,
>     scheduled_amount?: number | null,
>     status?: string | null
>   }[] | null,
>   reference_transactions?: {
>     schedule_entry_id?: string | null,
>     applied_amount?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null
> }[] | null
> ```

***

### getPdf

`invoices.getPdf`

Retrieve invoice as PDF. Gets the invoice as PDF. The returned URL is secure and allows download. The URL will expire in 60 minutes. #### Related Tutorial \* Check out customer portal tutorial on how to download invoice as PDF.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.invoices.getPdf({ invoiceId: 'inv_1001' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `invoiceId` | `string` | Yes | — |
| `disposition_type` | `attachment \| inline` | No | Determines the pdf should be rendered as inline or attachment in the browser. \* attachment - PDF is rendered as attachment in the browser \* inline - PDF is rendered as inline in the browser |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `download` | `object \| null` | No | Requesting to download a file through this API will return the `download_url` attribute as the response. This attribute will contain a URL that will allow the requested content to be downloaded. |

> [accordion] download full type
>
> ```ts theme={null}
> {
>   download_url?: string | null,
>   valid_till?: number | null,
>   mime_type?: string | null
> } | null
> ```

***

### import

`invoices.import`

Import invoice. Imports an invoice into Chargebee Billing. Use this API to import invoices from your other billing or accounting system into Chargebee Billing. You can import both current-term and historical invoices.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.invoices.import({ date: 1, id: 'cust_8gsnbYfsMLds', total: 1 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `id` | `string` | Yes | The invoice ID (also known as the invoice number). Must be unique so that it does not conflict with any existing `invoice.id`. |
| `currency_code` | `string` | No | The currency code (ISO 4217 format) for the invoice. |
| `customer_id` | `string` | No | Identifier of the [customer](https://docs.corsair.dev/docs/api/customers) resource to which this invoice belongs. |
| `subscription_id` | `string` | No | The ID of the [subscription](https://docs.corsair.dev/docs/api/subscriptions) resource to which this invoice belongs. |
| `po_number` | `string` | No | Purchase Order Number for this invoice. |
| `price_type` | `tax_exclusive \| tax_inclusive` | No | The price type of the invoice. \* tax\_inclusive - All amounts in the document are inclusive of tax. \* tax\_exclusive - All amounts in the document are exclusive of tax. |
| `tax_override_reason` | `zero_rated \| id_exempt \| customer_exempt \| region_non_taxable \| product_exempt \| export \| high_value_physical_goods \| zero_value_item \| tax_not_configured_external_provider` | No | The reason for exempting the invoice from tax. The reason applies to every line item. Applicable only for exempt invoices. **Constraints** \* Must not be sent when `line_items[tax_exempt_reason]` is sent. \* zero\_rated - If the rate of tax is 0% and no Sales/ GST tax is collectable for that line item. Each line is stored with [`line_items.is_taxed`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items_is_taxed) set to `false`. \* export - The customer is from a non-taxable region or the billing address and shipping address are unavailable. \* customer\_exempt - The customer is [exempted](https://docs.corsair.dev/docs/api/customers/customer-object#taxability) from tax. \* tax\_not\_configured\_external\_provider - If the tax is not configured for the country in 3rd party tax provider. \* id\_exempt - The customer is from a different country than your business and they have a valid VAT number or, the customer is a business entity. (This reason is only applicable when [EU VAT](https://www.chargebee.com/docs/eu-vat.html) or [UK VAT](https://www.chargebee.com/docs/uk-vat.html) is enabled.) \* high\_value\_physical\_goods - If physical goods are sold from outside Australia to customers in Australia, and the price of all the physical good line items is greater than AUD 1000, then tax will not be applied \* product\_exempt - If the Plan or Addon is marked as Tax exempt \* region\_non\_taxable - If the product sold is not taxable in this region, but it is taxable in other regions, hence this region is not part of the Taxable jurisdiction \* zero\_value\_item - If the total invoice value/amount is equal to zero. E.g., If the total order value is $10 and a $10 coupon has been applied against that order, the total order value becomes $0. Hence the invoice value also becomes $0. |
| `vat_number` | `string` | No | VAT number. Required when `tax_override_reason` is `id_exempt`. Also required when `line_items[tax_exempt_reason]` is `reverse_charge`. |
| `vat_number_prefix` | `string` | No | 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](https://docs.corsair.dev/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](https://docs.corsair.dev/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. |
| `date` | `number` | Yes | Date when invoice raised. |
| `total` | `number` | Yes | Invoice total amount. |
| `round_off` | `number` | No | [Round off amount](https://docs.corsair.dev/docs/api/invoices/invoice-object#round_off_amount). |
| `status` | `paid \| posted \| payment_due \| not_paid \| voided \| pending` | No | Current status of this invoice. \* not\_paid - Indicates the payment is not made and all attempts to collect is failed. \* voided - Indicates a voided invoice. \* paid - Indicates a paid invoice. \* posted - Indicates the payment is not yet collected and will be in this state till the due date to indicate the due period. \* pending - The [invoice](https://docs.corsair.dev/docs/api/invoices/invoice-object#status) is yet to be closed (sent for payment collection). An invoice is generated with this `status` when it has line items that belong to items that are `metered` or when the `subscription.create_pending_invoices`attribute is set to `true`. The [invoice](https://docs.corsair.dev/docs/api/v2/pcv-1/invoices/invoice-object#status) is yet to be closed (sent for payment collection). All invoices are generated with this `status` when [Metered Billing](https://www.chargebee.com/docs/1.0/metered_billing.html) is enabled for the site. \* payment\_due - Indicates the payment is not yet collected and is being retried as per retry settings. |
| `voided_at` | `number` | No | Timestamp indicating the date \\& time this invoice got voided. |
| `void_reason_code` | `string` | No | Reason code for voiding the invoice. Select from a list of reason codes set in the Chargebee app in **Settings \\> Configure Chargebee \\> Reason Codes \\> Invoices \\> Void invoice**. Must be passed if set as mandatory in the app. The codes are case-sensitive. |
| `is_written_off` | `boolean` | No | If is\_written\_off is true then the invoice is written off. |
| `write_off_amount` | `number` | No | Amount written off against this invoice. If this value is not present then the due amount of the invoice will be written off. |
| `write_off_date` | `number` | No | The date on which the write\_off invoice has occurred. This is a mandatory field if is\_written\_off is true. The same date reflects on the created credit note. |
| `due_date` | `number` | No | The due date of the invoice. |
| `net_term_days` | `number` | No | The number of days from [`invoice.date`](https://docs.corsair.dev/docs/api/invoices/invoice-object#date) until payment for the invoice is due. |
| `has_advance_charges` | `boolean` | No | Boolean indicating any advance charge is present in this invoice. |
| `use_for_proration` | `boolean` | No | If the invoice falls within the subscription current term will be used for proration. |
| `paid_at` | `number` | No | Timestamp when the invoice was paid. Applicable only when `status` is `paid`. |
| `credit_note` | `object` | No | Parameters for credit\_note |
| `billing_address` | `object` | No | Parameters for billing\_address |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `line_items` | `object` | No | Parameters for line\_items |
| `payment_reference_numbers` | `object` | No | Parameters for payment\_reference\_numbers |
| `line_item_tiers` | `object` | No | Parameters for line\_item\_tiers |
| `discounts` | `object` | No | Parameters for discounts |
| `taxes` | `object` | No | Parameters for taxes |
| `payments` | `object` | No | Parameters for payments |
| `notes` | `object` | No | Parameters for notes |
| `line_item_addresses` | `object` | No | The list of addresses used for tax calculation on line items. |

> [accordion] credit\_note full type
>
> ```ts theme={null}
> {
>   id?: string
> }
> ```

> [accordion] billing\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] line\_items full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   date_from?: number[],
>   date_to?: number[],
>   subscription_id?: string[],
>   description: string[],
>   unit_amount?: number[],
>   quantity?: number[],
>   amount?: number[],
>   unit_amount_in_decimal?: string[],
>   quantity_in_decimal?: string[],
>   amount_in_decimal?: string[],
>   entity_type?: (adhoc | plan_item_price | addon_item_price | charge_item_price)[],
>   entity_id?: string[],
>   item_level_discount1_entity_id?: string[],
>   item_level_discount1_amount?: number[],
>   item_level_discount2_entity_id?: string[],
>   item_level_discount2_amount?: number[],
>   tax1_name?: string[],
>   tax1_amount?: number[],
>   tax2_name?: string[],
>   tax2_amount?: number[],
>   tax3_name?: string[],
>   tax3_amount?: number[],
>   tax4_name?: string[],
>   tax4_amount?: number[],
>   tax5_name?: string[],
>   tax5_amount?: number[],
>   tax6_name?: string[],
>   tax6_amount?: number[],
>   tax7_name?: string[],
>   tax7_amount?: number[],
>   tax8_name?: string[],
>   tax8_amount?: number[],
>   tax9_name?: string[],
>   tax9_amount?: number[],
>   tax10_name?: string[],
>   tax10_amount?: number[],
>   is_partial_tax_applied?: boolean[],
>   taxable_amount?: number[],
>   tax_exempt_reason?: (region_non_taxable | export | customer_exempt | product_exempt | zero_rated | reverse_charge | high_value_physical_goods | zero_value_item | tax_not_configured_external_provider)[],
>   proration_mode?: (reset | delta | service_period_revision | adjusted_term)[],
>   created_at?: number[]
> }
> ```

> [accordion] payment\_reference\_numbers full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   type: (kid | ocr | frn | fik | swiss_reference)[],
>   number: string[]
> }
> ```

> [accordion] line\_item\_tiers full type
>
> ```ts theme={null}
> {
>   line_item_id: string[],
>   starting_unit?: number[],
>   ending_unit?: number[],
>   quantity_used?: number[],
>   unit_amount?: number[],
>   starting_unit_in_decimal?: string[],
>   ending_unit_in_decimal?: string[],
>   quantity_used_in_decimal?: string[],
>   unit_amount_in_decimal?: string[]
> }
> ```

> [accordion] discounts full type
>
> ```ts theme={null}
> {
>   line_item_id?: string[],
>   entity_type: (item_level_coupon | document_level_coupon | promotional_credits | item_level_discount | document_level_discount)[],
>   entity_id?: string[],
>   description?: string[],
>   amount: number[]
> }
> ```

> [accordion] taxes full type
>
> ```ts theme={null}
> {
>   name: string[],
>   rate: number[],
>   amount?: number[],
>   description?: string[],
>   juris_type?: (country | federal | state | county | city | special | unincorporated | other)[],
>   juris_name?: string[],
>   juris_code?: string[]
> }
> ```

> [accordion] payments full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   amount: number[],
>   payment_method: (cash | check | bank_transfer | other | custom)[],
>   date?: number[],
>   reference_number?: string[]
> }
> ```

> [accordion] notes full type
>
> ```ts theme={null}
> {
>   entity_type?: (coupon | plan_item_price | addon_item_price | charge_item_price)[],
>   entity_id?: string[],
>   note?: string[]
> }
> ```

> [accordion] line\_item\_addresses full type
>
> ```ts theme={null}
> {
>   line_item_id?: string[],
>   first_name?: string[],
>   last_name?: string[],
>   email?: string[],
>   company?: string[],
>   phone?: string[],
>   line1?: string[],
>   line2?: string[],
>   line3?: string[],
>   city?: string[],
>   state_code?: string[],
>   state?: string[],
>   zip?: string[],
>   country?: string[],
>   validation_status?: (not_validated | valid | partially_valid | invalid)[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |
| `credit_note` | `object \| null` | No | A [Credit Note](https://www.chargebee.com/docs/credit-notes.html) is a document that specifies the money owed by a business to its customer. The seller usually issues a Credit Note for the same or lower amount than the invoice, and then repays the money to the customer or set it off against other 'due' invoices. ### Credit Note Types Credit notes in Chargebee are categorized into three types: 1. `adjustment`: Adjustment credit notes are used to adjust the amount of an existing invoice in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Use this type of credit note to reduce the invoice amount, typically as a discount to the customer. Adjustment credit notes are automatically created in the following cases: \* When an invoice is written off. \* When a subscription is modified with proration enabled, and the invoice for the current term is in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). 2. `refundable`: Refundable credit notes allow you to return a certain amount to the customer. These credits can be: \* Retained for automatic application on future invoices. \* Applied to existing unpaid invoices. \* Refunded to the customer. Refundable credit notes are automatically created in the following cases: \* When an invoice is refunded. \* When a subscription is changed or canceled with proration enabled, the invoice for the current term is in the `paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Refundable credits are applied to future invoices or can be refunded to the original payment method. 3. `store`: Store credit notes are created for `paid` or `partially_paid` invoice [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status) during subscription changes, such as upgrades, downgrades, or cancellations. Key characteristics of store credits: \* No tax component is included at the time of creation. \* A credit note document is generated, similar to refundable credits. \* Store credits are applied before tax calculations on future invoices. **Note:** If you have enabled *consolidated invoicing* , to know the subscriptions attached with a credit note you have to refer [line\_item's](https://docs.corsair.dev/docs/api/credit_notes/credit_note-object#line_items) *subscription\_id* . The credit note's *subscription\_id* should **not** be used (which will be *null* if the credit note has lines from multiple subscriptions). Impact on reference invoice The following updates are made to the reference invoice when a credit note is created/imported: \* If the credit note `type` is `adjustment`: \* The adjustment credit note details are added to the `adjustment_credit_notes[]` attribute of the invoice. \* The invoice `amount_due` is reduced by the credit note `total`. \* The invoice `status` is updated to `paid` if the invoice `amount_due` equals the credit note `total`. \* The invoice `status` does not change if the invoice `amount_due` is greater than credit note `total`. \* If the credit note `type` is `refundable`: \* The refundable credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. \* If the credit note `type` is `store`: \* The store credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

> [accordion] credit\_note full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   reference_invoice_id?: string | null,
>   type?: string | null,
>   reason_code?: string | null,
>   status?: string | null,
>   vat_number?: string | null,
>   date?: number | null,
>   price_type?: string | null,
>   currency_code?: string | null,
>   total?: number | null,
>   amount_allocated?: number | null,
>   amount_refunded?: number | null,
>   amount_available?: number | null,
>   refunded_at?: number | null,
>   voided_at?: number | null,
>   generated_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   channel?: string | null,
>   line_items_next_offset?: string | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total_in_local_currency?: number | null,
>   local_currency_code?: string | null,
>   round_off_amount?: number | null,
>   fractional_correction?: number | null,
>   notes?: string[] | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   local_currency_exchange_rate?: number | null,
>   create_reason_code?: string | null,
>   vat_number_prefix?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_refunds?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     refund_reason_code?: string | null
>   }[] | null,
>   linked_tax_withheld_refunds?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   allocations?: {
>     invoice_id?: string | null,
>     allocated_amount?: number | null,
>     allocated_at?: number | null,
>     invoice_date?: number | null,
>     invoice_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### list

`invoices.list`

List invoices. Lists all the Invoices. (GET /invoices)

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.invoices.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `include_deleted` | `boolean` | No | If set to true, includes the deleted resources in the response. For the deleted resources in the response, the '**deleted** ' attribute will be '**true** '. |
| `id` | `object` | No | optional, string filter The invoice number. Acts as a identifier for invoice and typically generated sequentially. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *id\\\[is\\] = "INVOICE\_654"* |
| `subscription_id` | `object` | No | optional, string filter To filter based on subscription\_id. NOTE: Not to be used if *consolidated invoicing* is enabled. **Supported operators :** is, is\_not, starts\_with, is\_present, in, not\_in **Example →** *subscription\_id\\\[is\\] = "3bdjnDnsdQn"* |
| `customer_id` | `object` | No | optional, string filter The identifier of the customer this invoice belongs to. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *customer\_id\\\[is\\] = "3bdjnDnsdQn"* |
| `recurring` | `object` | No | optional, boolean filter Boolean indicating whether this invoice belongs to a subscription. Possible values are : *true, false* **Supported operators :** is **Example →** *recurring\\\[is\\] = "true"* |
| `status` | `object` | No | optional, enumerated string filter Current status of this invoice. Possible values are : paid, posted, payment\_due, not\_paid, voided, pending. **Supported operators :** is, is\_not, in, not\_in **Example →** *status\\\[is\\] = "paid"* |
| `price_type` | `object` | No | optional, enumerated string filter The price type of the invoice. Possible values are : tax\_exclusive, tax\_inclusive. **Supported operators :** is, is\_not, in, not\_in **Example →** *price\_type\\\[is\\] = "tax\_exclusive"* |
| `date` | `object` | No | optional, timestamp(UTC) in seconds filter The document date displayed on the invoice PDF. **Supported operators :** after, before, on, between **Example →** *date\\\[on\\] = "1394532759"* |
| `paid_at` | `object` | No | optional, timestamp(UTC) in seconds filter Timestamp indicating the date \\& time this invoice got paid. **Supported operators :** after, before, on, between **Example →** *paid\_at\\\[before\\] = "1394532759"* |
| `total` | `object` | No | optional, in cents filter Invoiced amount displayed in cents; that is, a decimal point is not present between the whole number and the decimal part. For example, \$499.99 is displayed as 49999, and so on. **Supported operators :** is, is\_not, lt, lte, gt, gte, between **Example →** *total\\\[gt\\] = "1000"* |
| `amount_paid` | `object` | No | optional, in cents filter Payments collected successfully for the invoice. This is the sum of [linked\_payments\[\]](https://docs.corsair.dev/docs/api/invoices/invoice-object#linked_payments)`.txn_amount` for all `linked_payments[]` that have `txn_status` as `success`. **Supported operators :** is, is\_not, lt, lte, gt, gte, between **Example →** *amount\_paid\\\[lt\\] = "800"* |
| `amount_adjusted` | `object` | No | optional, in cents filter Total adjustments made against this invoice. **Supported operators :** is, is\_not, lt, lte, gt, gte, between **Example →** *amount\_adjusted\\\[gte\\] = "100"* |
| `credits_applied` | `object` | No | optional, in cents filter Total credits applied against this invoice. **Supported operators :** is, is\_not, lt, lte, gt, gte, between **Example →** *credits\_applied\\\[lte\\] = "100"* |
| `amount_due` | `object` | No | optional, in cents filter The unpaid amount that is due on the invoice. This is calculated as: [total](https://docs.corsair.dev/docs/api/invoices/invoice-object#total) \* [amount\_paid](https://docs.corsair.dev/docs/api/invoices/invoice-object#amount_paid) \* sum of [applied\_credits](https://docs.corsair.dev/docs/api/invoices/invoice-object#applied_credits)`.applied_amount` \* sum of [adjustment\_credit\_notes](https://docs.corsair.dev/docs/api/invoices/invoice-object#adjustment_credit_notes)`.cn_total` \* sum of [linked\_taxes\_withheld](https://docs.corsair.dev/docs/api/invoices/invoice-object#linked_taxes_withheld)`.amount`. **Supported operators :** is, is\_not, lt, lte, gt, gte, between **Example →** *amount\_due\\\[lt\\] = "200"* |
| `dunning_status` | `object` | No | optional, enumerated string filter Current dunning status of the invoice. Possible values are : in\_progress, exhausted, stopped, success. **Supported operators :** is, is\_not, in, not\_in, is\_present **Example →** *dunning\_status\\\[is\\] = "in\_progress"* |
| `payment_owner` | `object` | No | optional, string filter Payment owner of an invoice. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *payment\_owner\\\[is\\] = "payment\_customer"* |
| `updated_at` | `object` | No | optional, timestamp(UTC) in seconds filter To filter based on `updated_at`. This attribute will be present only if the resource has been updated after 2016-09-28. It is advisable when using this filter, to pass the `sort_by` input parameter as `updated_at` for a faster response. **Supported operators :** after, before, on, between **Example →** *updated\_at\\\[after\\] = "1243545465"* |
| `channel` | `object` | No | optional, enumerated string filter The subscription channel this object originated from and is maintained in. Possible values are : web, app\_store, play\_store. **Supported operators :** is, is\_not, in, not\_in **Example →** *channel\\\[is\\] = "APP STORE"* |
| `voided_at` | `object` | No | optional, timestamp(UTC) in seconds filter Timestamp indicating the date \\& time this invoice got voided. **Supported operators :** after, before, on, between **Example →** *voided\_at\\\[on\\] = "1394532759"* |
| `void_reason_code` | `object` | No | optional, string filter Reason code for voiding the invoice. Select from a list of reason codes set in the Chargebee app in **Settings \\> Configure Chargebee \\> Reason Codes \\> Invoices \\> Void invoice** . Must be passed if set as mandatory in the app. The codes are case-sensitive. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *void\_reason\_code\\\[is\_not\\] = "Other"* |
| `sort_by` | `object` | No | optional, string filter Sorts based on the specified attribute. **Supported attributes :** date, updated\_at **Supported sort-orders :** asc, desc **Example →** *sort\_by\\\[asc\\] = "date"* This will sort the result based on the 'date' attribute in ascending(earliest first) order. |
| `exclude` | `object` | No | — |
| `einvoice` | `object` | No | Parameters for einvoice |

> [accordion] id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] subscription\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   is_present?: true | false,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] customer\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] recurring full type
>
> ```ts theme={null}
> {
>   is?: true | false
> }
> ```

> [accordion] status full type
>
> ```ts theme={null}
> {
>   is?: paid | posted | payment_due | not_paid | voided | pending,
>   is_not?: paid | posted | payment_due | not_paid | voided | pending,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] price\_type full type
>
> ```ts theme={null}
> {
>   is?: tax_exclusive | tax_inclusive,
>   is_not?: tax_exclusive | tax_inclusive,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] date full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] paid\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] total full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   lt?: string,
>   lte?: string,
>   gt?: string,
>   gte?: string,
>   between?: string
> }
> ```

> [accordion] amount\_paid full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   lt?: string,
>   lte?: string,
>   gt?: string,
>   gte?: string,
>   between?: string
> }
> ```

> [accordion] amount\_adjusted full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   lt?: string,
>   lte?: string,
>   gt?: string,
>   gte?: string,
>   between?: string
> }
> ```

> [accordion] credits\_applied full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   lt?: string,
>   lte?: string,
>   gt?: string,
>   gte?: string,
>   between?: string
> }
> ```

> [accordion] amount\_due full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   lt?: string,
>   lte?: string,
>   gt?: string,
>   gte?: string,
>   between?: string
> }
> ```

> [accordion] dunning\_status full type
>
> ```ts theme={null}
> {
>   is?: in_progress | exhausted | stopped | success,
>   is_not?: in_progress | exhausted | stopped | success,
>   in?: string,
>   not_in?: string,
>   is_present?: true | false
> }
> ```

> [accordion] payment\_owner full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] updated\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] channel full type
>
> ```ts theme={null}
> {
>   is?: web | app_store | play_store,
>   is_not?: web | app_store | play_store,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] voided\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] void\_reason\_code full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] sort\_by full type
>
> ```ts theme={null}
> {
>   asc?: date | updated_at,
>   desc?: date | updated_at
> }
> ```

> [accordion] exclude full type
>
> ```ts theme={null}
> {
>   in?: string
> }
> ```

> [accordion] einvoice full type
>
> ```ts theme={null}
> {
>   status?: {
>     is?: scheduled | skipped | in_progress | success | failed | registered | accepted | rejected | message_acknowledgement | in_process | under_query | conditionally_accepted | paid,
>     is_not?: scheduled | skipped | in_progress | success | failed | registered | accepted | rejected | message_acknowledgement | in_process | under_query | conditionally_accepted | paid,
>     in?: string,
>     not_in?: string
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   invoice?: {
>     id?: string | null,
>     customer_id?: string | null,
>     payment_owner?: string | null,
>     subscription_id?: string | null,
>     recurring?: boolean | null,
>     status?: string | null,
>     date?: number | null,
>     due_date?: number | null,
>     net_term_days?: number | null,
>     po_number?: string | null,
>     vat_number?: string | null,
>     price_type?: string | null,
>     exchange_rate?: number | null,
>     local_currency_exchange_rate?: number | null,
>     currency_code?: string | null,
>     local_currency_code?: string | null,
>     tax?: number | null,
>     sub_total?: number | null,
>     sub_total_in_local_currency?: number | null,
>     total?: number | null,
>     total_in_local_currency?: number | null,
>     amount_due?: number | null,
>     amount_adjusted?: number | null,
>     amount_paid?: number | null,
>     paid_at?: number | null,
>     write_off_amount?: number | null,
>     credits_applied?: number | null,
>     dunning_status?: string | null,
>     next_retry_at?: number | null,
>     voided_at?: number | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     line_items_next_offset?: string | null,
>     first_invoice?: boolean | null,
>     new_sales_amount?: number | null,
>     has_advance_charges?: boolean | null,
>     offline_payment_method?: string | null,
>     term_finalized?: boolean | null,
>     is_gifted?: boolean | null,
>     generated_at?: number | null,
>     expected_payment_date?: number | null,
>     amount_to_collect?: number | null,
>     round_off_amount?: number | null,
>     retry_segment_id?: string | null,
>     void_reason_code?: string | null,
>     deleted?: boolean | null,
>     tax_category?: string | null,
>     vat_number_prefix?: string | null,
>     channel?: string | null,
>     business_entity_id?: string | null,
>     brand_id?: string | null,
>     exchange_rates?: {
>       currency_code?: string | null,
>       rate?: number | null
>     }[] | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     tax_origin?: {
>       country?: string | null,
>       registration_number?: string | null
>     } | null,
>     linked_taxes_withheld?: {
>       id?: string | null,
>       amount?: number | null,
>       description?: string | null,
>       date?: number | null,
>       reference_number?: string | null
>     }[] | null,
>     linked_payments?: {
>       txn_id?: string | null,
>       applied_amount?: number | null,
>       applied_at?: number | null,
>       txn_status?: string | null,
>       txn_date?: number | null,
>       txn_amount?: number | null
>     }[] | null,
>     reference_transactions?: {
>       applied_amount?: number | null,
>       applied_at?: number | null,
>       txn_id?: string | null,
>       txn_status?: string | null,
>       txn_date?: number | null,
>       txn_amount?: number | null,
>       txn_type?: string | null,
>       amount_capturable?: number | null,
>       authorization_reason?: string | null
>     }[] | null,
>     dunning_attempts?: {
>       attempt?: number | null,
>       transaction_id?: string | null,
>       dunning_type?: string | null,
>       created_at?: number | null,
>       txn_status?: string | null,
>       txn_amount?: number | null,
>       retry_engine?: string | null
>     }[] | null,
>     applied_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       applied_at?: number | null,
>       cn_reason_code?: string | null,
>       cn_create_reason_code?: string | null,
>       cn_date?: number | null,
>       cn_status?: string | null,
>       tax_application?: string | null
>     }[] | null,
>     adjustment_credit_notes?: {
>       cn_id?: string | null,
>       cn_reason_code?: string | null,
>       cn_create_reason_code?: string | null,
>       cn_date?: number | null,
>       cn_total?: number | null,
>       cn_status?: string | null
>     }[] | null,
>     issued_credit_notes?: {
>       cn_id?: string | null,
>       cn_reason_code?: string | null,
>       cn_create_reason_code?: string | null,
>       cn_date?: number | null,
>       cn_total?: number | null,
>       cn_status?: string | null
>     }[] | null,
>     linked_orders?: {
>       id?: string | null,
>       document_number?: string | null,
>       status?: string | null,
>       order_type?: string | null,
>       reference_id?: string | null,
>       fulfillment_status?: string | null,
>       batch_id?: string | null,
>       created_at?: number | null
>     }[] | null,
>     notes?: {
>       note?: string | null,
>       entity_id?: string | null,
>       entity_type?: string | null
>     }[] | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     billing_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     statement_descriptor?: {
>       id?: string | null,
>       descriptor?: string | null
>     } | null,
>     einvoice?: {
>       id?: string | null,
>       reference_id?: string | null,
>       reference_number?: string | null,
>       status?: string | null,
>       message?: string | null,
>       provider_references?: any[] | null
>     } | null,
>     site_details_at_creation?: {
>       timezone?: string | null,
>       organization_address?: {
>       } | null
>     } | null
>   } | null
> }[] | null
> ```

***

### listPaymentReferenceNumbers

`invoices.listPaymentReferenceNumbers`

List payment reference numbers. This API endpoint allows users to retrieve the payment reference numbers (PRNs) associated with an invoice. Only one PRN is allowed per payment type. You can use the invoice\_id or the payment\_reference\_number\[number] to retrieve the PRN.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.invoices.listPaymentReferenceNumbers({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `id` | `object` | No | optional, string filter An unique identifier for the invoice serves that links the invoice to the corresponding payment reference number (PRN). **Note** : To retrieve the PRN, the API requires either the invoice ID or the payment reference number to be provided by the user. If both values are missing, an error will be returned by the API. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *id\\\[is\\] = "old\_inv\_001"* |
| `payment_reference_number` | `object` | No | Parameters for payment\_reference\_number |

> [accordion] id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   in?: string
> }
> ```

> [accordion] payment\_reference\_number full type
>
> ```ts theme={null}
> {
>   number?: {
>     is?: string,
>     in?: string
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   payment_reference_number?: {
>     id?: string | null,
>     type?: string | null,
>     number?: string | null,
>     invoice_id?: string | null
>   } | null
> }[] | null
> ```

***

### listPayments

`invoices.listPayments`

List payments for an invoice. Retrieves the payments for an invoice with the recent ones on top. This returns all the payment attempts(manual & automatic) made for this invoice.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.invoices.listPayments({ invoiceId: 'inv_1001' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `invoiceId` | `string` | Yes | — |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   transaction?: {
>     id?: string | null,
>     customer_id?: string | null,
>     subscription_id?: string | null,
>     gateway_account_id?: string | null,
>     payment_source_id?: string | null,
>     payment_method?: string | null,
>     reference_number?: string | null,
>     gateway?: string | null,
>     type?: string | null,
>     date?: number | null,
>     settled_at?: number | null,
>     exchange_rate?: number | null,
>     currency_code?: string | null,
>     amount?: number | null,
>     id_at_gateway?: string | null,
>     status?: string | null,
>     fraud_flag?: string | null,
>     initiator_type?: string | null,
>     three_d_secure?: boolean | null,
>     authorization_reason?: string | null,
>     error_code?: string | null,
>     error_text?: string | null,
>     voided_at?: number | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     fraud_reason?: string | null,
>     custom_payment_method_id?: string | null,
>     amount_unused?: number | null,
>     masked_card_number?: string | null,
>     reference_transaction_id?: string | null,
>     refunded_txn_id?: string | null,
>     reference_authorization_id?: string | null,
>     amount_capturable?: number | null,
>     reversal_transaction_id?: string | null,
>     deleted?: boolean | null,
>     iin?: string | null,
>     last4?: string | null,
>     merchant_reference_id?: string | null,
>     business_entity_id?: string | null,
>     payment_method_details?: string | null,
>     custom_payment_method_name?: string | null,
>     linked_invoices?: {
>       invoice_id?: string | null,
>       applied_amount?: number | null,
>       applied_at?: number | null,
>       invoice_date?: number | null,
>       invoice_total?: number | null,
>       invoice_status?: string | null
>     }[] | null,
>     linked_credit_notes?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       applied_at?: number | null,
>       cn_reason_code?: string | null,
>       cn_create_reason_code?: string | null,
>       cn_date?: number | null,
>       cn_total?: number | null,
>       cn_status?: string | null,
>       cn_reference_invoice_id?: string | null
>     }[] | null,
>     linked_refunds?: {
>       txn_id?: string | null,
>       txn_status?: string | null,
>       txn_date?: number | null,
>       txn_amount?: number | null
>     }[] | null,
>     linked_payments?: {
>       id?: string | null,
>       status?: string | null,
>       amount?: number | null,
>       date?: number | null
>     }[] | null,
>     gateway_metadata?: {
>       acquirer_reference_id?: string | null
>     } | null,
>     error_detail?: {
>       request_id?: string | null,
>       error_category?: string | null,
>       error_code?: string | null,
>       error_message?: string | null,
>       decline_code?: string | null,
>       decline_message?: string | null,
>       network_error_code?: string | null,
>       network_error_message?: string | null,
>       error_field?: string | null,
>       recommendation_code?: string | null,
>       recommendation_message?: string | null,
>       processor_error_code?: string | null,
>       processor_error_message?: string | null,
>       error_cause_id?: string | null,
>       processor_advice_code?: string | null
>     } | null,
>     network_transaction_details?: {
>       network_transaction_id?: string | null,
>       original_network_transaction_id?: string | null
>     } | null
>   } | null
> }[] | null
> ```

***

### listPaymentVouchers

`invoices.listPaymentVouchers`

List vouchers for an invoice. Retrieves vouchers for an invoice in reverse chronological order.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.invoices.listPaymentVouchers({ invoiceId: 'inv_1001' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `invoiceId` | `string` | Yes | — |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `status` | `object` | No | optional, enumerated string filter Current status of Payment Voucher. Possible values are : active, consumed, expired, failure. **Supported operators :** is, is\_not, in, not\_in, in, not\_in **Example →** *status\\\[is\_not\\] = "active, consumed, expired"* |
| `sort_by` | `object` | No | optional, string filter Sorts based on the specified attribute. **Supported attributes :** date, updated\_at **Supported sort-orders :** asc, desc **Example →** *sort\_by\\\[asc\\] = "date"* This will sort the result based on the 'date' attribute in ascending(earliest first) order. |

> [accordion] status full type
>
> ```ts theme={null}
> {
>   is?: active | consumed | expired | failure,
>   is_not?: active | consumed | expired | failure,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] sort\_by full type
>
> ```ts theme={null}
> {
>   asc?: date | updated_at,
>   desc?: date | updated_at
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   payment_voucher?: {
>     id?: string | null,
>     id_at_gateway?: string | null,
>     payment_voucher_type?: string | null,
>     expires_at?: number | null,
>     status?: string | null,
>     subscription_id?: string | null,
>     currency_code?: string | null,
>     amount?: number | null,
>     gateway_account_id?: string | null,
>     payment_source_id?: string | null,
>     gateway?: string | null,
>     payload?: string | null,
>     error_code?: string | null,
>     error_text?: string | null,
>     url?: string | null,
>     date?: number | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     customer_id?: string | null,
>     linked_invoices?: {
>       invoice_id?: string | null,
>       txn_id?: string | null,
>       applied_at?: number | null
>     }[] | null
>   } | null
> }[] | null
> ```

***

### pauseDunning

`invoices.pauseDunning`

Pause dunning for invoice. Pause dunning for the specified invoice until expected\_payment\_date. Chargebee cancels all configured payment collection retry attempts and dunning email notifications for the invoice until expected\_payment\_date.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.invoices.pauseDunning({ invoiceId: 'inv_1001', expected_payment_date: 1 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `invoiceId` | `string` | Yes | — |
| `expected_payment_date` | `number` | Yes | The date and time at which dunning should resume. **See also** : [Dunning resumption process](https://docs.corsair.dev/docs/api/invoices/resume-dunning-for-invoice). |
| `comment` | `string` | No | An internal [comment](https://docs.corsair.dev/docs/api/comments) to add to the invoice for this operation. This comment is displayed on the Chargebee Billing UI. **Note** : This comment does not appear on any customer-facing [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages) or documents, such as the [invoice PDF](https://docs.corsair.dev/docs/api/invoices/retrieve-invoice-as-pdf). |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### recordPayment

`invoices.recordPayment`

Record an invoice payment. Records an offline payment for an invoice. Use this API to record payments that you receive outside Chargebee, such as bank transfers or checks, so that you can reconcile them against invoices. ### Prerequisites & Constraints \* The invoice status must be payment\_due, posted, or not\_paid.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.invoices.recordPayment({ invoiceId: 'inv_1001' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `invoiceId` | `string` | Yes | — |
| `comment` | `string` | No | Remarks, if any, on the payment. |
| `transaction` | `object` | No | Parameters for transaction |

> [accordion] transaction full type
>
> ```ts theme={null}
> {
>   amount?: number,
>   payment_method: cash | check | bank_transfer | other | custom,
>   reference_number?: string,
>   custom_payment_method_id?: string,
>   id_at_gateway?: string,
>   status?: success | failure | late_failure,
>   date?: number,
>   error_code?: string,
>   error_text?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |
| `transaction` | `object \| null` | No | This resource represents the [transaction](https://www.chargebee.com/docs/transactions.html) event that has happened in your account. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

> [accordion] transaction full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   gateway_account_id?: string | null,
>   payment_source_id?: string | null,
>   payment_method?: string | null,
>   reference_number?: string | null,
>   gateway?: string | null,
>   type?: string | null,
>   date?: number | null,
>   settled_at?: number | null,
>   exchange_rate?: number | null,
>   currency_code?: string | null,
>   amount?: number | null,
>   id_at_gateway?: string | null,
>   status?: string | null,
>   fraud_flag?: string | null,
>   initiator_type?: string | null,
>   three_d_secure?: boolean | null,
>   authorization_reason?: string | null,
>   error_code?: string | null,
>   error_text?: string | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   fraud_reason?: string | null,
>   custom_payment_method_id?: string | null,
>   amount_unused?: number | null,
>   masked_card_number?: string | null,
>   reference_transaction_id?: string | null,
>   refunded_txn_id?: string | null,
>   reference_authorization_id?: string | null,
>   amount_capturable?: number | null,
>   reversal_transaction_id?: string | null,
>   deleted?: boolean | null,
>   iin?: string | null,
>   last4?: string | null,
>   merchant_reference_id?: string | null,
>   business_entity_id?: string | null,
>   payment_method_details?: string | null,
>   custom_payment_method_name?: string | null,
>   linked_invoices?: {
>     invoice_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     invoice_date?: number | null,
>     invoice_total?: number | null,
>     invoice_status?: string | null
>   }[] | null,
>   linked_credit_notes?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null,
>     cn_reference_invoice_id?: string | null
>   }[] | null,
>   linked_refunds?: {
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   linked_payments?: {
>     id?: string | null,
>     status?: string | null,
>     amount?: number | null,
>     date?: number | null
>   }[] | null,
>   gateway_metadata?: {
>     acquirer_reference_id?: string | null
>   } | null,
>   error_detail?: {
>     request_id?: string | null,
>     error_category?: string | null,
>     error_code?: string | null,
>     error_message?: string | null,
>     decline_code?: string | null,
>     decline_message?: string | null,
>     network_error_code?: string | null,
>     network_error_message?: string | null,
>     error_field?: string | null,
>     recommendation_code?: string | null,
>     recommendation_message?: string | null,
>     processor_error_code?: string | null,
>     processor_error_message?: string | null,
>     error_cause_id?: string | null,
>     processor_advice_code?: string | null
>   } | null,
>   network_transaction_details?: {
>     network_transaction_id?: string | null,
>     original_network_transaction_id?: string | null
>   } | null
> } | null
> ```

***

### recordRefund

`invoices.recordRefund`

Record refund for an invoice. Record a full or partial offline refund for an invoice. Use this API to record refunds processed outside Chargebee (for example, directly through a payment gateway or via offline methods such as bank transfers or checks) so you can reconcile them in Chargebee.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.invoices.recordRefund({ invoiceId: 'inv_1001' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `invoiceId` | `string` | Yes | — |
| `comment` | `string` | No | Remarks, if any, on the refund. |
| `customer_notes` | `string` | No | The Customer Notes to be filled in the Credit Notes created to capture this refund detail. |
| `transaction` | `object` | No | Parameters for transaction |
| `credit_note` | `object` | No | Parameters for credit\_note |

> [accordion] transaction full type
>
> ```ts theme={null}
> {
>   amount?: number,
>   payment_method: cash | check | chargeback | bank_transfer | other | custom,
>   reference_number?: string,
>   custom_payment_method_id?: string,
>   date: number
> }
> ```

> [accordion] credit\_note full type
>
> ```ts theme={null}
> {
>   reason_code?: chargeback | product_unsatisfactory | service_unsatisfactory | order_change | order_cancellation | waiver | other,
>   create_reason_code?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |
| `transaction` | `object \| null` | No | This resource represents the [transaction](https://www.chargebee.com/docs/transactions.html) event that has happened in your account. |
| `credit_note` | `object \| null` | No | A [Credit Note](https://www.chargebee.com/docs/credit-notes.html) is a document that specifies the money owed by a business to its customer. The seller usually issues a Credit Note for the same or lower amount than the invoice, and then repays the money to the customer or set it off against other 'due' invoices. ### Credit Note Types Credit notes in Chargebee are categorized into three types: 1. `adjustment`: Adjustment credit notes are used to adjust the amount of an existing invoice in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Use this type of credit note to reduce the invoice amount, typically as a discount to the customer. Adjustment credit notes are automatically created in the following cases: \* When an invoice is written off. \* When a subscription is modified with proration enabled, and the invoice for the current term is in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). 2. `refundable`: Refundable credit notes allow you to return a certain amount to the customer. These credits can be: \* Retained for automatic application on future invoices. \* Applied to existing unpaid invoices. \* Refunded to the customer. Refundable credit notes are automatically created in the following cases: \* When an invoice is refunded. \* When a subscription is changed or canceled with proration enabled, the invoice for the current term is in the `paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Refundable credits are applied to future invoices or can be refunded to the original payment method. 3. `store`: Store credit notes are created for `paid` or `partially_paid` invoice [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status) during subscription changes, such as upgrades, downgrades, or cancellations. Key characteristics of store credits: \* No tax component is included at the time of creation. \* A credit note document is generated, similar to refundable credits. \* Store credits are applied before tax calculations on future invoices. **Note:** If you have enabled *consolidated invoicing* , to know the subscriptions attached with a credit note you have to refer [line\_item's](https://docs.corsair.dev/docs/api/credit_notes/credit_note-object#line_items) *subscription\_id* . The credit note's *subscription\_id* should **not** be used (which will be *null* if the credit note has lines from multiple subscriptions). Impact on reference invoice The following updates are made to the reference invoice when a credit note is created/imported: \* If the credit note `type` is `adjustment`: \* The adjustment credit note details are added to the `adjustment_credit_notes[]` attribute of the invoice. \* The invoice `amount_due` is reduced by the credit note `total`. \* The invoice `status` is updated to `paid` if the invoice `amount_due` equals the credit note `total`. \* The invoice `status` does not change if the invoice `amount_due` is greater than credit note `total`. \* If the credit note `type` is `refundable`: \* The refundable credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. \* If the credit note `type` is `store`: \* The store credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

> [accordion] transaction full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   gateway_account_id?: string | null,
>   payment_source_id?: string | null,
>   payment_method?: string | null,
>   reference_number?: string | null,
>   gateway?: string | null,
>   type?: string | null,
>   date?: number | null,
>   settled_at?: number | null,
>   exchange_rate?: number | null,
>   currency_code?: string | null,
>   amount?: number | null,
>   id_at_gateway?: string | null,
>   status?: string | null,
>   fraud_flag?: string | null,
>   initiator_type?: string | null,
>   three_d_secure?: boolean | null,
>   authorization_reason?: string | null,
>   error_code?: string | null,
>   error_text?: string | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   fraud_reason?: string | null,
>   custom_payment_method_id?: string | null,
>   amount_unused?: number | null,
>   masked_card_number?: string | null,
>   reference_transaction_id?: string | null,
>   refunded_txn_id?: string | null,
>   reference_authorization_id?: string | null,
>   amount_capturable?: number | null,
>   reversal_transaction_id?: string | null,
>   deleted?: boolean | null,
>   iin?: string | null,
>   last4?: string | null,
>   merchant_reference_id?: string | null,
>   business_entity_id?: string | null,
>   payment_method_details?: string | null,
>   custom_payment_method_name?: string | null,
>   linked_invoices?: {
>     invoice_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     invoice_date?: number | null,
>     invoice_total?: number | null,
>     invoice_status?: string | null
>   }[] | null,
>   linked_credit_notes?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null,
>     cn_reference_invoice_id?: string | null
>   }[] | null,
>   linked_refunds?: {
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   linked_payments?: {
>     id?: string | null,
>     status?: string | null,
>     amount?: number | null,
>     date?: number | null
>   }[] | null,
>   gateway_metadata?: {
>     acquirer_reference_id?: string | null
>   } | null,
>   error_detail?: {
>     request_id?: string | null,
>     error_category?: string | null,
>     error_code?: string | null,
>     error_message?: string | null,
>     decline_code?: string | null,
>     decline_message?: string | null,
>     network_error_code?: string | null,
>     network_error_message?: string | null,
>     error_field?: string | null,
>     recommendation_code?: string | null,
>     recommendation_message?: string | null,
>     processor_error_code?: string | null,
>     processor_error_message?: string | null,
>     error_cause_id?: string | null,
>     processor_advice_code?: string | null
>   } | null,
>   network_transaction_details?: {
>     network_transaction_id?: string | null,
>     original_network_transaction_id?: string | null
>   } | null
> } | null
> ```

> [accordion] credit\_note full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   reference_invoice_id?: string | null,
>   type?: string | null,
>   reason_code?: string | null,
>   status?: string | null,
>   vat_number?: string | null,
>   date?: number | null,
>   price_type?: string | null,
>   currency_code?: string | null,
>   total?: number | null,
>   amount_allocated?: number | null,
>   amount_refunded?: number | null,
>   amount_available?: number | null,
>   refunded_at?: number | null,
>   voided_at?: number | null,
>   generated_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   channel?: string | null,
>   line_items_next_offset?: string | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total_in_local_currency?: number | null,
>   local_currency_code?: string | null,
>   round_off_amount?: number | null,
>   fractional_correction?: number | null,
>   notes?: string[] | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   local_currency_exchange_rate?: number | null,
>   create_reason_code?: string | null,
>   vat_number_prefix?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_refunds?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     refund_reason_code?: string | null
>   }[] | null,
>   linked_tax_withheld_refunds?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   allocations?: {
>     invoice_id?: string | null,
>     allocated_amount?: number | null,
>     allocated_at?: number | null,
>     invoice_date?: number | null,
>     invoice_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### recordTaxWithheld

`invoices.recordTaxWithheld`

Record tax withheld for an invoice. Records tax\_withheld by the customer against the invoice specified. This operation is allowed only when all of the following conditions are true: \* Tax Amount Withheld is enabled. \* The invoice does not have a linked\_taxes\_withheld record associated with it already.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.invoices.recordTaxWithheld({ invoiceId: 'inv_1001' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `invoiceId` | `string` | Yes | — |
| `tax_withheld` | `object` | No | Parameters for tax\_withheld |

> [accordion] tax\_withheld full type
>
> ```ts theme={null}
> {
>   amount: number,
>   reference_number?: string,
>   date?: number,
>   description?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### refund

`invoices.refund`

Refund an invoice. Refunds online payments or online refundable credit notes applied to an invoice. If multiple transactions or credit note allocations are associated with the invoice, the refund can be processed only for one transaction or allocation at a time.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.invoices.refund({ invoiceId: 'inv_1001' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `invoiceId` | `string` | Yes | — |
| `refund_amount` | `number` | No | The amount to be refunded. **Constraints** \* If multiple [transactions](https://docs.corsair.dev/docs/api/invoices/invoice-object#linked_payments) or [credit note allocations](https://docs.corsair.dev/docs/api/invoices/invoice-object#applied_credits) are associated with the invoice, the refund can be processed only for one transaction or allocation at a time. \* Offline refunds, including those for [`linked_taxes_withheld`](https://docs.corsair.dev/docs/api/invoices/invoice-object#linked_taxes_withheld), cannot be refunded via this operation. Use the [Record refund for an invoice](https://docs.corsair.dev/docs/api/invoices/record-refund-for-an-invoice) API instead. **Default behavior** \* If not specified, the total refundable amount for this invoice derived from online transactions is implied. The refundable amount is calculated as: (the total amount paid on the invoice via online payments) + (allocations on the invoice from refundable credit notes that were created from online payments) - (any amount already refunded from the invoice). |
| `comment` | `string` | No | Comment, if any, on the refund. |
| `customer_notes` | `string` | No | The Customer Notes to be filled in the Credit Notes created to capture this refund detail. |
| `credit_note` | `object` | No | Parameters for credit\_note |

> [accordion] credit\_note full type
>
> ```ts theme={null}
> {
>   reason_code?: product_unsatisfactory | service_unsatisfactory | order_change | order_cancellation | waiver | other,
>   create_reason_code?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |
| `transaction` | `object \| null` | No | This resource represents the [transaction](https://www.chargebee.com/docs/transactions.html) event that has happened in your account. |
| `credit_note` | `object \| null` | No | A [Credit Note](https://www.chargebee.com/docs/credit-notes.html) is a document that specifies the money owed by a business to its customer. The seller usually issues a Credit Note for the same or lower amount than the invoice, and then repays the money to the customer or set it off against other 'due' invoices. ### Credit Note Types Credit notes in Chargebee are categorized into three types: 1. `adjustment`: Adjustment credit notes are used to adjust the amount of an existing invoice in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Use this type of credit note to reduce the invoice amount, typically as a discount to the customer. Adjustment credit notes are automatically created in the following cases: \* When an invoice is written off. \* When a subscription is modified with proration enabled, and the invoice for the current term is in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). 2. `refundable`: Refundable credit notes allow you to return a certain amount to the customer. These credits can be: \* Retained for automatic application on future invoices. \* Applied to existing unpaid invoices. \* Refunded to the customer. Refundable credit notes are automatically created in the following cases: \* When an invoice is refunded. \* When a subscription is changed or canceled with proration enabled, the invoice for the current term is in the `paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Refundable credits are applied to future invoices or can be refunded to the original payment method. 3. `store`: Store credit notes are created for `paid` or `partially_paid` invoice [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status) during subscription changes, such as upgrades, downgrades, or cancellations. Key characteristics of store credits: \* No tax component is included at the time of creation. \* A credit note document is generated, similar to refundable credits. \* Store credits are applied before tax calculations on future invoices. **Note:** If you have enabled *consolidated invoicing* , to know the subscriptions attached with a credit note you have to refer [line\_item's](https://docs.corsair.dev/docs/api/credit_notes/credit_note-object#line_items) *subscription\_id* . The credit note's *subscription\_id* should **not** be used (which will be *null* if the credit note has lines from multiple subscriptions). Impact on reference invoice The following updates are made to the reference invoice when a credit note is created/imported: \* If the credit note `type` is `adjustment`: \* The adjustment credit note details are added to the `adjustment_credit_notes[]` attribute of the invoice. \* The invoice `amount_due` is reduced by the credit note `total`. \* The invoice `status` is updated to `paid` if the invoice `amount_due` equals the credit note `total`. \* The invoice `status` does not change if the invoice `amount_due` is greater than credit note `total`. \* If the credit note `type` is `refundable`: \* The refundable credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. \* If the credit note `type` is `store`: \* The store credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

> [accordion] transaction full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   gateway_account_id?: string | null,
>   payment_source_id?: string | null,
>   payment_method?: string | null,
>   reference_number?: string | null,
>   gateway?: string | null,
>   type?: string | null,
>   date?: number | null,
>   settled_at?: number | null,
>   exchange_rate?: number | null,
>   currency_code?: string | null,
>   amount?: number | null,
>   id_at_gateway?: string | null,
>   status?: string | null,
>   fraud_flag?: string | null,
>   initiator_type?: string | null,
>   three_d_secure?: boolean | null,
>   authorization_reason?: string | null,
>   error_code?: string | null,
>   error_text?: string | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   fraud_reason?: string | null,
>   custom_payment_method_id?: string | null,
>   amount_unused?: number | null,
>   masked_card_number?: string | null,
>   reference_transaction_id?: string | null,
>   refunded_txn_id?: string | null,
>   reference_authorization_id?: string | null,
>   amount_capturable?: number | null,
>   reversal_transaction_id?: string | null,
>   deleted?: boolean | null,
>   iin?: string | null,
>   last4?: string | null,
>   merchant_reference_id?: string | null,
>   business_entity_id?: string | null,
>   payment_method_details?: string | null,
>   custom_payment_method_name?: string | null,
>   linked_invoices?: {
>     invoice_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     invoice_date?: number | null,
>     invoice_total?: number | null,
>     invoice_status?: string | null
>   }[] | null,
>   linked_credit_notes?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null,
>     cn_reference_invoice_id?: string | null
>   }[] | null,
>   linked_refunds?: {
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   linked_payments?: {
>     id?: string | null,
>     status?: string | null,
>     amount?: number | null,
>     date?: number | null
>   }[] | null,
>   gateway_metadata?: {
>     acquirer_reference_id?: string | null
>   } | null,
>   error_detail?: {
>     request_id?: string | null,
>     error_category?: string | null,
>     error_code?: string | null,
>     error_message?: string | null,
>     decline_code?: string | null,
>     decline_message?: string | null,
>     network_error_code?: string | null,
>     network_error_message?: string | null,
>     error_field?: string | null,
>     recommendation_code?: string | null,
>     recommendation_message?: string | null,
>     processor_error_code?: string | null,
>     processor_error_message?: string | null,
>     error_cause_id?: string | null,
>     processor_advice_code?: string | null
>   } | null,
>   network_transaction_details?: {
>     network_transaction_id?: string | null,
>     original_network_transaction_id?: string | null
>   } | null
> } | null
> ```

> [accordion] credit\_note full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   reference_invoice_id?: string | null,
>   type?: string | null,
>   reason_code?: string | null,
>   status?: string | null,
>   vat_number?: string | null,
>   date?: number | null,
>   price_type?: string | null,
>   currency_code?: string | null,
>   total?: number | null,
>   amount_allocated?: number | null,
>   amount_refunded?: number | null,
>   amount_available?: number | null,
>   refunded_at?: number | null,
>   voided_at?: number | null,
>   generated_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   channel?: string | null,
>   line_items_next_offset?: string | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total_in_local_currency?: number | null,
>   local_currency_code?: string | null,
>   round_off_amount?: number | null,
>   fractional_correction?: number | null,
>   notes?: string[] | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   local_currency_exchange_rate?: number | null,
>   create_reason_code?: string | null,
>   vat_number_prefix?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_refunds?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     refund_reason_code?: string | null
>   }[] | null,
>   linked_tax_withheld_refunds?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   allocations?: {
>     invoice_id?: string | null,
>     allocated_amount?: number | null,
>     allocated_at?: number | null,
>     invoice_date?: number | null,
>     invoice_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### removeCreditNote

`invoices.removeCreditNote`

Remove credit note from an invoice. Removes the specified adjustment credit or refundable credit allocation applied to the invoice. ### Prerequisites & Constraints \* The invoice status must not be voided or pending. \* The credit note status must not be voided. \* The credit note type must be adjustment or refundable.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.invoices.removeCreditNote({ invoiceId: 'inv_1001' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `invoiceId` | `string` | Yes | — |
| `credit_note` | `object` | No | Parameters for credit\_note |

> [accordion] credit\_note full type
>
> ```ts theme={null}
> {
>   id: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |
| `credit_note` | `object \| null` | No | A [Credit Note](https://www.chargebee.com/docs/credit-notes.html) is a document that specifies the money owed by a business to its customer. The seller usually issues a Credit Note for the same or lower amount than the invoice, and then repays the money to the customer or set it off against other 'due' invoices. ### Credit Note Types Credit notes in Chargebee are categorized into three types: 1. `adjustment`: Adjustment credit notes are used to adjust the amount of an existing invoice in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Use this type of credit note to reduce the invoice amount, typically as a discount to the customer. Adjustment credit notes are automatically created in the following cases: \* When an invoice is written off. \* When a subscription is modified with proration enabled, and the invoice for the current term is in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). 2. `refundable`: Refundable credit notes allow you to return a certain amount to the customer. These credits can be: \* Retained for automatic application on future invoices. \* Applied to existing unpaid invoices. \* Refunded to the customer. Refundable credit notes are automatically created in the following cases: \* When an invoice is refunded. \* When a subscription is changed or canceled with proration enabled, the invoice for the current term is in the `paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Refundable credits are applied to future invoices or can be refunded to the original payment method. 3. `store`: Store credit notes are created for `paid` or `partially_paid` invoice [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status) during subscription changes, such as upgrades, downgrades, or cancellations. Key characteristics of store credits: \* No tax component is included at the time of creation. \* A credit note document is generated, similar to refundable credits. \* Store credits are applied before tax calculations on future invoices. **Note:** If you have enabled *consolidated invoicing* , to know the subscriptions attached with a credit note you have to refer [line\_item's](https://docs.corsair.dev/docs/api/credit_notes/credit_note-object#line_items) *subscription\_id* . The credit note's *subscription\_id* should **not** be used (which will be *null* if the credit note has lines from multiple subscriptions). Impact on reference invoice The following updates are made to the reference invoice when a credit note is created/imported: \* If the credit note `type` is `adjustment`: \* The adjustment credit note details are added to the `adjustment_credit_notes[]` attribute of the invoice. \* The invoice `amount_due` is reduced by the credit note `total`. \* The invoice `status` is updated to `paid` if the invoice `amount_due` equals the credit note `total`. \* The invoice `status` does not change if the invoice `amount_due` is greater than credit note `total`. \* If the credit note `type` is `refundable`: \* The refundable credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. \* If the credit note `type` is `store`: \* The store credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

> [accordion] credit\_note full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   reference_invoice_id?: string | null,
>   type?: string | null,
>   reason_code?: string | null,
>   status?: string | null,
>   vat_number?: string | null,
>   date?: number | null,
>   price_type?: string | null,
>   currency_code?: string | null,
>   total?: number | null,
>   amount_allocated?: number | null,
>   amount_refunded?: number | null,
>   amount_available?: number | null,
>   refunded_at?: number | null,
>   voided_at?: number | null,
>   generated_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   channel?: string | null,
>   line_items_next_offset?: string | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total_in_local_currency?: number | null,
>   local_currency_code?: string | null,
>   round_off_amount?: number | null,
>   fractional_correction?: number | null,
>   notes?: string[] | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   local_currency_exchange_rate?: number | null,
>   create_reason_code?: string | null,
>   vat_number_prefix?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_refunds?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     refund_reason_code?: string | null
>   }[] | null,
>   linked_tax_withheld_refunds?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   allocations?: {
>     invoice_id?: string | null,
>     allocated_amount?: number | null,
>     allocated_at?: number | null,
>     invoice_date?: number | null,
>     invoice_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### removePayment

`invoices.removePayment`

Remove payment from an invoice. Removes a payment transaction that was applied to an invoice and moves the amount to the customer's excess payments balance. This API does not refund the payment to the customer. To refund a payment transaction, use one of the following APIs: \* For online payments, use Refund a payment.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.invoices.removePayment({ invoiceId: 'inv_1001' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `invoiceId` | `string` | Yes | — |
| `transaction` | `object` | No | Parameters for transaction |

> [accordion] transaction full type
>
> ```ts theme={null}
> {
>   id: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |
| `transaction` | `object \| null` | No | This resource represents the [transaction](https://www.chargebee.com/docs/transactions.html) event that has happened in your account. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

> [accordion] transaction full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   gateway_account_id?: string | null,
>   payment_source_id?: string | null,
>   payment_method?: string | null,
>   reference_number?: string | null,
>   gateway?: string | null,
>   type?: string | null,
>   date?: number | null,
>   settled_at?: number | null,
>   exchange_rate?: number | null,
>   currency_code?: string | null,
>   amount?: number | null,
>   id_at_gateway?: string | null,
>   status?: string | null,
>   fraud_flag?: string | null,
>   initiator_type?: string | null,
>   three_d_secure?: boolean | null,
>   authorization_reason?: string | null,
>   error_code?: string | null,
>   error_text?: string | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   fraud_reason?: string | null,
>   custom_payment_method_id?: string | null,
>   amount_unused?: number | null,
>   masked_card_number?: string | null,
>   reference_transaction_id?: string | null,
>   refunded_txn_id?: string | null,
>   reference_authorization_id?: string | null,
>   amount_capturable?: number | null,
>   reversal_transaction_id?: string | null,
>   deleted?: boolean | null,
>   iin?: string | null,
>   last4?: string | null,
>   merchant_reference_id?: string | null,
>   business_entity_id?: string | null,
>   payment_method_details?: string | null,
>   custom_payment_method_name?: string | null,
>   linked_invoices?: {
>     invoice_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     invoice_date?: number | null,
>     invoice_total?: number | null,
>     invoice_status?: string | null
>   }[] | null,
>   linked_credit_notes?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null,
>     cn_reference_invoice_id?: string | null
>   }[] | null,
>   linked_refunds?: {
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   linked_payments?: {
>     id?: string | null,
>     status?: string | null,
>     amount?: number | null,
>     date?: number | null
>   }[] | null,
>   gateway_metadata?: {
>     acquirer_reference_id?: string | null
>   } | null,
>   error_detail?: {
>     request_id?: string | null,
>     error_category?: string | null,
>     error_code?: string | null,
>     error_message?: string | null,
>     decline_code?: string | null,
>     decline_message?: string | null,
>     network_error_code?: string | null,
>     network_error_message?: string | null,
>     error_field?: string | null,
>     recommendation_code?: string | null,
>     recommendation_message?: string | null,
>     processor_error_code?: string | null,
>     processor_error_message?: string | null,
>     error_cause_id?: string | null,
>     processor_advice_code?: string | null
>   } | null,
>   network_transaction_details?: {
>     network_transaction_id?: string | null,
>     original_network_transaction_id?: string | null
>   } | null
> } | null
> ```

***

### removePaymentScheduleScheme

`invoices.removePaymentScheduleScheme`

Remove payment schedule scheme from an invoice. Cancels remaining unpaid schedule entries on an invoice. Use this when a payment schedule was applied in error or is no longer required. Unpaid schedule entries are set to voided; paid entries and their payments are preserved.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.invoices.removePaymentScheduleScheme({ invoiceId: 'inv_1001' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `invoiceId` | `string` | Yes | — |
| `comment` | `string` | No | An internal [comment](https://docs.corsair.dev/docs/api/comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](https://docs.corsair.dev/docs/api/hosted_pages) or any document such as the [Invoice PDF](https://docs.corsair.dev/docs/api/invoices/retrieve-invoice-as-pdf) . |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### removeTaxWithheld

`invoices.removeTaxWithheld`

Remove tax withheld for an invoice. Removes a linked\_taxes\_withheld record from the invoice specified. This operation is allowed only when all of the following conditions are true: \* invoice.status is one of the following: payment\_due, not\_paid, or posted. \* There are no adjustment\_credit\_notes associated with the invoice.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.invoices.removeTaxWithheld({ invoiceId: 'inv_1001' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `invoiceId` | `string` | Yes | — |
| `tax_withheld` | `object` | No | Parameters for tax\_withheld |

> [accordion] tax\_withheld full type
>
> ```ts theme={null}
> {
>   id: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### resendEinvoice

`invoices.resendEinvoice`

Resend failed einvoice in invoices. Resend failed einvoice of an invoice to the customer using this API.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.invoices.resendEinvoice({ invoiceId: 'inv_1001' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `invoiceId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### resumeDunning

`invoices.resumeDunning`

Resume dunning for invoice. Immediately resumes dunning for the specified invoice. \* If the current time is within the dunning period for the invoice, Chargebee resumes any dunning retries and email notifications that remain after the pause period, and not attempt the retries or notifications that were canceled during the…

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.invoices.resumeDunning({ invoiceId: 'inv_1001' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `invoiceId` | `string` | Yes | — |
| `comment` | `string` | No | An internal [comment](https://docs.corsair.dev/docs/api/comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](https://docs.corsair.dev/docs/api/hosted_pages) or any document such as the [Invoice PDF](https://docs.corsair.dev/docs/api/invoices/retrieve-invoice-as-pdf) . |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### sendEinvoice

`invoices.sendEinvoice`

Send an einvoice for invoices. This endpoint is used to send an e-invoice for invoice. To support cases like TDS and invoice edits, we need to stop auto e-invoice sending and be able to send e-invoices manually. This endpoint schedules e-invoices manually.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.invoices.sendEinvoice({ invoiceId: 'inv_1001' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `invoiceId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### sendEmail

`invoices.sendEmail`

Send Invoice Email. Sends the invoice email to the customer using the site's published Send Invoice Email Engage notification template. Use this operation to resend or manually trigger the invoice email for a customer outside the normal notification schedule. Async-only This operation is asynchronous only.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.invoices.sendEmail({ invoiceId: 'inv_1001' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `prefer` | `string` | No | Must be set to `respond-async`. Instructs Chargebee to process the request asynchronously and return `202 Accepted` immediately. |
| `requestId` | `string` | No | A client-generated unique identifier (UUID recommended) for this request. Echoed back as `request.id` in the async callback payload, allowing you to correlate each callback to its originating request. |
| `asyncCallbackUrl` | `string` | No | The callback URL where Chargebee will `POST` the async result. Must be an `https://` URL and may embed basic-auth credentials, e.g. `https://username:password@example.com`. |
| `invoiceId` | `string` | Yes | — |

**Output:** `object`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   email_logs?: {
>     id?: string | null,
>     template_name?: string | null,
>     from_address?: string | null,
>     to_address?: string | null,
>     subject?: string | null,
>     status?: string | null,
>     sent_on?: number | null,
>     customer_id?: string | null,
>     email_conversation_id?: string | null,
>     site_id?: string | null,
>     business_entity_id?: string | null,
>     brand_id?: string | null,
>     error_message?: string | null
>   }[] | null
> } | {
>   success: true
> }
> ```

***

### stopDunning

`invoices.stopDunning`

Stop dunning for invoice. This API is used to stop dunning for "Payment Due" invoices that have been enabled for Auto Collection. When dunning is stopped, the status of the invoice will be changed to "Not Paid".

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.invoices.stopDunning({ invoiceId: 'inv_1001' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `invoiceId` | `string` | Yes | — |
| `comment` | `string` | No | An internal [comment](https://docs.corsair.dev/docs/api/comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](https://docs.corsair.dev/docs/api/hosted_pages) or any document such as the [Invoice PDF](https://docs.corsair.dev/docs/api/invoices/retrieve-invoice-as-pdf) . |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### syncUsages

`invoices.syncUsages`

Sync usages. Updates the quantity for metered line\_items of an invoice to reflect the latest usage data. Note: This operation is done automatically while closing the invoice.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.invoices.syncUsages({ invoiceId: 'inv_1001' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `invoiceId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### updateDetails

`invoices.updateDetails`

Update invoice details. This API allows you to update the invoice Billing/Shipping address, VAT, custom fields, and PO number. During this operation if Billing Info (Billing Address, vat\_number), Shipping info and PO number are not already present in the system the data will be added.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.invoices.updateDetails({ invoiceId: 'inv_1001' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `invoiceId` | `string` | Yes | — |
| `vat_number` | `string` | No | VAT/ Tax registration number of the customer. [Learn more](https://www.chargebee.com/docs/tax.html#capture-tax-registration-number) . |
| `vat_number_prefix` | `string` | No | 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](https://docs.corsair.dev/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](https://docs.corsair.dev/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. |
| `po_number` | `string` | No | Purchase Order Number for this invoice. |
| `comment` | `string` | No | An internal [comment](https://docs.corsair.dev/docs/api/comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](https://docs.corsair.dev/docs/api/hosted_pages) or any document such as the [Invoice PDF](https://docs.corsair.dev/docs/api/invoices/retrieve-invoice-as-pdf) . |
| `billing_address` | `object` | No | Parameters for billing\_address |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `statement_descriptor` | `object` | No | — |

> [accordion] billing\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] statement\_descriptor full type
>
> ```ts theme={null}
> {
>   descriptor?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### void

`invoices.void`

Void an invoice. Voids the specified invoice. Use this operation when: \* The invoice was generated in error. \* The invoice amount is incorrect. \* The customer requests a change to the invoice. \* The customer cancels the order.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.invoices.void({ invoiceId: 'inv_1001' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `invoiceId` | `string` | Yes | — |
| `comment` | `string` | No | An internal [comment](https://docs.corsair.dev/docs/api/comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](https://docs.corsair.dev/docs/api/hosted_pages) or any document such as the [Invoice PDF](https://docs.corsair.dev/docs/api/invoices/retrieve-invoice-as-pdf) . |
| `void_reason_code` | `string` | No | Reason code for voiding the invoice. Select from a list of reason codes set in the Chargebee app in **Settings \\> Configure Chargebee \\> Reason Codes \\> Invoices \\> Void invoice**. Must be passed if set as mandatory in the app. The codes are case-sensitive. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |
| `credit_note` | `object \| null` | No | A [Credit Note](https://www.chargebee.com/docs/credit-notes.html) is a document that specifies the money owed by a business to its customer. The seller usually issues a Credit Note for the same or lower amount than the invoice, and then repays the money to the customer or set it off against other 'due' invoices. ### Credit Note Types Credit notes in Chargebee are categorized into three types: 1. `adjustment`: Adjustment credit notes are used to adjust the amount of an existing invoice in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Use this type of credit note to reduce the invoice amount, typically as a discount to the customer. Adjustment credit notes are automatically created in the following cases: \* When an invoice is written off. \* When a subscription is modified with proration enabled, and the invoice for the current term is in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). 2. `refundable`: Refundable credit notes allow you to return a certain amount to the customer. These credits can be: \* Retained for automatic application on future invoices. \* Applied to existing unpaid invoices. \* Refunded to the customer. Refundable credit notes are automatically created in the following cases: \* When an invoice is refunded. \* When a subscription is changed or canceled with proration enabled, the invoice for the current term is in the `paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Refundable credits are applied to future invoices or can be refunded to the original payment method. 3. `store`: Store credit notes are created for `paid` or `partially_paid` invoice [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status) during subscription changes, such as upgrades, downgrades, or cancellations. Key characteristics of store credits: \* No tax component is included at the time of creation. \* A credit note document is generated, similar to refundable credits. \* Store credits are applied before tax calculations on future invoices. **Note:** If you have enabled *consolidated invoicing* , to know the subscriptions attached with a credit note you have to refer [line\_item's](https://docs.corsair.dev/docs/api/credit_notes/credit_note-object#line_items) *subscription\_id* . The credit note's *subscription\_id* should **not** be used (which will be *null* if the credit note has lines from multiple subscriptions). Impact on reference invoice The following updates are made to the reference invoice when a credit note is created/imported: \* If the credit note `type` is `adjustment`: \* The adjustment credit note details are added to the `adjustment_credit_notes[]` attribute of the invoice. \* The invoice `amount_due` is reduced by the credit note `total`. \* The invoice `status` is updated to `paid` if the invoice `amount_due` equals the credit note `total`. \* The invoice `status` does not change if the invoice `amount_due` is greater than credit note `total`. \* If the credit note `type` is `refundable`: \* The refundable credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. \* If the credit note `type` is `store`: \* The store credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

> [accordion] credit\_note full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   reference_invoice_id?: string | null,
>   type?: string | null,
>   reason_code?: string | null,
>   status?: string | null,
>   vat_number?: string | null,
>   date?: number | null,
>   price_type?: string | null,
>   currency_code?: string | null,
>   total?: number | null,
>   amount_allocated?: number | null,
>   amount_refunded?: number | null,
>   amount_available?: number | null,
>   refunded_at?: number | null,
>   voided_at?: number | null,
>   generated_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   channel?: string | null,
>   line_items_next_offset?: string | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total_in_local_currency?: number | null,
>   local_currency_code?: string | null,
>   round_off_amount?: number | null,
>   fractional_correction?: number | null,
>   notes?: string[] | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   local_currency_exchange_rate?: number | null,
>   create_reason_code?: string | null,
>   vat_number_prefix?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_refunds?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     refund_reason_code?: string | null
>   }[] | null,
>   linked_tax_withheld_refunds?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   allocations?: {
>     invoice_id?: string | null,
>     allocated_amount?: number | null,
>     allocated_at?: number | null,
>     invoice_date?: number | null,
>     invoice_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### voidBeforeCapture

`invoices.voidBeforeCapture`

Void authorizations before capture. Voids all outstanding scheduled-capture authorizations linked to an invoice before capture, then voids or writes off the invoice. Use this operation when an invoice has an outstanding delayed-capture authorization that must be released before the invoice is either voided or written off.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.invoices.voidBeforeCapture({ invoiceId: 'inv_1001' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `invoiceId` | `string` | Yes | — |
| `comment` | `string` | No | An internal [comment](https://docs.corsair.dev/docs/api/comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](https://docs.corsair.dev/docs/api/hosted_pages) or any document such as the [Invoice PDF](https://docs.corsair.dev/docs/api/invoices/retrieve-invoice-as-pdf) . |
| `void_reason_code` | `string` | No | Reason code for voiding the invoice. Applicable only when `invoice_action` is `void`. Select from the reason codes configured in **Settings \\> Configure Chargebee \\> Reason Codes \\> Invoices \\> Void invoice**. This parameter is required when a void reason code is configured as mandatory. The codes are case-sensitive. |
| `invoice_action` | `void \| write_off` | No | Determines whether Chargebee voids or writes off the invoice after voiding all eligible outstanding scheduled-capture authorizations. Possible values are `void` and `write_off`. This is not related to [Close a pending invoice](https://docs.corsair.dev/docs/api/invoices#close_a_pending_invoice). **Default value** `void` \* void - Voids the invoice after all eligible outstanding scheduled-capture authorizations are voided. \* write\_off - Writes off the invoice after all eligible outstanding scheduled-capture authorizations are voided. `void_reason_code` is not applicable for this value. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |
| `credit_note` | `object \| null` | No | A [Credit Note](https://www.chargebee.com/docs/credit-notes.html) is a document that specifies the money owed by a business to its customer. The seller usually issues a Credit Note for the same or lower amount than the invoice, and then repays the money to the customer or set it off against other 'due' invoices. ### Credit Note Types Credit notes in Chargebee are categorized into three types: 1. `adjustment`: Adjustment credit notes are used to adjust the amount of an existing invoice in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Use this type of credit note to reduce the invoice amount, typically as a discount to the customer. Adjustment credit notes are automatically created in the following cases: \* When an invoice is written off. \* When a subscription is modified with proration enabled, and the invoice for the current term is in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). 2. `refundable`: Refundable credit notes allow you to return a certain amount to the customer. These credits can be: \* Retained for automatic application on future invoices. \* Applied to existing unpaid invoices. \* Refunded to the customer. Refundable credit notes are automatically created in the following cases: \* When an invoice is refunded. \* When a subscription is changed or canceled with proration enabled, the invoice for the current term is in the `paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Refundable credits are applied to future invoices or can be refunded to the original payment method. 3. `store`: Store credit notes are created for `paid` or `partially_paid` invoice [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status) during subscription changes, such as upgrades, downgrades, or cancellations. Key characteristics of store credits: \* No tax component is included at the time of creation. \* A credit note document is generated, similar to refundable credits. \* Store credits are applied before tax calculations on future invoices. **Note:** If you have enabled *consolidated invoicing* , to know the subscriptions attached with a credit note you have to refer [line\_item's](https://docs.corsair.dev/docs/api/credit_notes/credit_note-object#line_items) *subscription\_id* . The credit note's *subscription\_id* should **not** be used (which will be *null* if the credit note has lines from multiple subscriptions). Impact on reference invoice The following updates are made to the reference invoice when a credit note is created/imported: \* If the credit note `type` is `adjustment`: \* The adjustment credit note details are added to the `adjustment_credit_notes[]` attribute of the invoice. \* The invoice `amount_due` is reduced by the credit note `total`. \* The invoice `status` is updated to `paid` if the invoice `amount_due` equals the credit note `total`. \* The invoice `status` does not change if the invoice `amount_due` is greater than credit note `total`. \* If the credit note `type` is `refundable`: \* The refundable credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. \* If the credit note `type` is `store`: \* The store credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

> [accordion] credit\_note full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   reference_invoice_id?: string | null,
>   type?: string | null,
>   reason_code?: string | null,
>   status?: string | null,
>   vat_number?: string | null,
>   date?: number | null,
>   price_type?: string | null,
>   currency_code?: string | null,
>   total?: number | null,
>   amount_allocated?: number | null,
>   amount_refunded?: number | null,
>   amount_available?: number | null,
>   refunded_at?: number | null,
>   voided_at?: number | null,
>   generated_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   channel?: string | null,
>   line_items_next_offset?: string | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total_in_local_currency?: number | null,
>   local_currency_code?: string | null,
>   round_off_amount?: number | null,
>   fractional_correction?: number | null,
>   notes?: string[] | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   local_currency_exchange_rate?: number | null,
>   create_reason_code?: string | null,
>   vat_number_prefix?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_refunds?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     refund_reason_code?: string | null
>   }[] | null,
>   linked_tax_withheld_refunds?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   allocations?: {
>     invoice_id?: string | null,
>     allocated_amount?: number | null,
>     allocated_at?: number | null,
>     invoice_date?: number | null,
>     invoice_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

### writeOff

`invoices.writeOff`

Write off an invoice. Write off the specified invoice. Use this operation to mark invoices as settled when they remain unpaid after multiple attempts to collect payment. #### Reverse a write-off You can reverse the write-off by removing the linked credit note.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.invoices.writeOff({ invoiceId: 'inv_1001' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `invoiceId` | `string` | Yes | — |
| `comment` | `string` | No | An internal [comment](https://docs.corsair.dev/docs/api/comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](https://docs.corsair.dev/docs/api/hosted_pages) or any document such as the [Invoice PDF](https://docs.corsair.dev/docs/api/invoices/retrieve-invoice-as-pdf) . |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |
| `credit_note` | `object \| null` | No | A [Credit Note](https://www.chargebee.com/docs/credit-notes.html) is a document that specifies the money owed by a business to its customer. The seller usually issues a Credit Note for the same or lower amount than the invoice, and then repays the money to the customer or set it off against other 'due' invoices. ### Credit Note Types Credit notes in Chargebee are categorized into three types: 1. `adjustment`: Adjustment credit notes are used to adjust the amount of an existing invoice in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Use this type of credit note to reduce the invoice amount, typically as a discount to the customer. Adjustment credit notes are automatically created in the following cases: \* When an invoice is written off. \* When a subscription is modified with proration enabled, and the invoice for the current term is in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). 2. `refundable`: Refundable credit notes allow you to return a certain amount to the customer. These credits can be: \* Retained for automatic application on future invoices. \* Applied to existing unpaid invoices. \* Refunded to the customer. Refundable credit notes are automatically created in the following cases: \* When an invoice is refunded. \* When a subscription is changed or canceled with proration enabled, the invoice for the current term is in the `paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Refundable credits are applied to future invoices or can be refunded to the original payment method. 3. `store`: Store credit notes are created for `paid` or `partially_paid` invoice [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status) during subscription changes, such as upgrades, downgrades, or cancellations. Key characteristics of store credits: \* No tax component is included at the time of creation. \* A credit note document is generated, similar to refundable credits. \* Store credits are applied before tax calculations on future invoices. **Note:** If you have enabled *consolidated invoicing* , to know the subscriptions attached with a credit note you have to refer [line\_item's](https://docs.corsair.dev/docs/api/credit_notes/credit_note-object#line_items) *subscription\_id* . The credit note's *subscription\_id* should **not** be used (which will be *null* if the credit note has lines from multiple subscriptions). Impact on reference invoice The following updates are made to the reference invoice when a credit note is created/imported: \* If the credit note `type` is `adjustment`: \* The adjustment credit note details are added to the `adjustment_credit_notes[]` attribute of the invoice. \* The invoice `amount_due` is reduced by the credit note `total`. \* The invoice `status` is updated to `paid` if the invoice `amount_due` equals the credit note `total`. \* The invoice `status` does not change if the invoice `amount_due` is greater than credit note `total`. \* If the credit note `type` is `refundable`: \* The refundable credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. \* If the credit note `type` is `store`: \* The store credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. |

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

> [accordion] credit\_note full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   reference_invoice_id?: string | null,
>   type?: string | null,
>   reason_code?: string | null,
>   status?: string | null,
>   vat_number?: string | null,
>   date?: number | null,
>   price_type?: string | null,
>   currency_code?: string | null,
>   total?: number | null,
>   amount_allocated?: number | null,
>   amount_refunded?: number | null,
>   amount_available?: number | null,
>   refunded_at?: number | null,
>   voided_at?: number | null,
>   generated_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   channel?: string | null,
>   line_items_next_offset?: string | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total_in_local_currency?: number | null,
>   local_currency_code?: string | null,
>   round_off_amount?: number | null,
>   fractional_correction?: number | null,
>   notes?: string[] | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   local_currency_exchange_rate?: number | null,
>   create_reason_code?: string | null,
>   vat_number_prefix?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_refunds?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     refund_reason_code?: string | null
>   }[] | null,
>   linked_tax_withheld_refunds?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   allocations?: {
>     invoice_id?: string | null,
>     allocated_amount?: number | null,
>     allocated_at?: number | null,
>     invoice_date?: number | null,
>     invoice_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

***

## Item Families

### create

`itemFamilies.create`

Create an item family. This endpoint creates an item family for your product line or service.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.itemFamilies.create({ id: 'cust_8gsnbYfsMLds', name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `id` | `string` | Yes | The identifier for the item family. Must be unique and is immutable. |
| `name` | `string` | Yes | The display name for the item family. Must be unique. This is visible only in Chargebee and not to customers. |
| `description` | `string` | No | Description of the item family. This is visible only in Chargebee and not to customers. |
| `business_entity_id` | `string` | No | The unique ID of the [business entity](https://docs.corsair.dev/docs/api/business_entities) for this `item_family`. This is applicable only when multiple business entities have been created for the site. When provided, the operation will read or write data associated with the specified business entity. If not provided, the resource will be created at the site level, and the `business_entity_id` will not be included in the API response. **Note** An alternative way of passing this parameter is by means of a [custom HTTP header](https://docs.corsair.dev/docs/api/advanced-features#mbe-header-main). |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `item_family` | `object \| null` | No | If you're a company that sells multiple product lines then each product line or service is an item family in the Chargebee API. For example, if you are a SaaS company that offers separate products for project management, content collaboration, and customer support. Each of those can be an item family under which the various plans, addons and charges can be the [items](https://docs.corsair.dev/docs/api/items). Item families compartmentalize items such that only items belonging to the same family can be part of any given subscription. **Note:** You must have the [Product Families](https://www.chargebee.com/docs/2.0/product-families.html) enabled for your site to be able to set up item families. |

> [accordion] item\_family full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   status?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null
> } | null
> ```

***

### delete

`itemFamilies.delete`

Delete an item family. Deletes an item family, marking its status as deleted . This is not allowed if there are active items under the item family. Once deleted, the id and name of the item family can be reused to create a new item family.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.itemFamilies.delete({ itemFamilyId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `itemFamilyId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `item_family` | `object \| null` | No | If you're a company that sells multiple product lines then each product line or service is an item family in the Chargebee API. For example, if you are a SaaS company that offers separate products for project management, content collaboration, and customer support. Each of those can be an item family under which the various plans, addons and charges can be the [items](https://docs.corsair.dev/docs/api/items). Item families compartmentalize items such that only items belonging to the same family can be part of any given subscription. **Note:** You must have the [Product Families](https://www.chargebee.com/docs/2.0/product-families.html) enabled for your site to be able to set up item families. |

> [accordion] item\_family full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   status?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null
> } | null
> ```

***

### get

`itemFamilies.get`

Retrieve an item family. This endpoint retrieves an item family based on the item family id.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.itemFamilies.get({ itemFamilyId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `itemFamilyId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `item_family` | `object \| null` | No | If you're a company that sells multiple product lines then each product line or service is an item family in the Chargebee API. For example, if you are a SaaS company that offers separate products for project management, content collaboration, and customer support. Each of those can be an item family under which the various plans, addons and charges can be the [items](https://docs.corsair.dev/docs/api/items). Item families compartmentalize items such that only items belonging to the same family can be part of any given subscription. **Note:** You must have the [Product Families](https://www.chargebee.com/docs/2.0/product-families.html) enabled for your site to be able to set up item families. |

> [accordion] item\_family full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   status?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null
> } | null
> ```

***

### list

`itemFamilies.list`

List item families. Returns a list of item families satisfying all the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.itemFamilies.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `id` | `object` | No | optional, string filter The identifier for the item family. It is unique and immutable. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *id\\\[is\\] = "family-id"* |
| `name` | `object` | No | optional, string filter A unique display name for the item family. This is visible only in Chargebee and not to customers. **Supported operators :** is, is\_not, starts\_with **Example →** *name\\\[is\_not\\] = "family-name"* |
| `updated_at` | `object` | No | optional, timestamp(UTC) in seconds filter When the item family was last updated. **Supported operators :** after, before, on, between **Example →** *updated\_at\\\[before\\] = "1243545465"* |
| `business_entity_id` | `object` | No | optional, string filter The unique ID of the [business entity](https://docs.corsair.dev/docs/api/business_entities) of this `item_family`. [Learn more](https://docs.corsair.dev/docs/api/using_business_entity_filters_in_product_catalog_list_apis) about all the scenarios before using this filter. **Supported operators :** is, is\_present **Example →** *business\_entity\_id\\\[is\_present\\] = "true"* |
| `include_site_level_resources` | `object` | No | optional, boolean filter Default value is `true` . To exclude site-level resources in [specific cases](), set this parameter to `false`. Possible values are : *true, false* **Supported operators :** is **Example →** *include\_site\_level\_resources\\\[is\\] = "null"* |

> [accordion] id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] name full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string
> }
> ```

> [accordion] updated\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] business\_entity\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_present?: true | false
> }
> ```

> [accordion] include\_site\_level\_resources full type
>
> ```ts theme={null}
> {
>   is?: true | false
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   item_family?: {
>     id?: string | null,
>     name?: string | null,
>     description?: string | null,
>     status?: string | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     channel?: string | null,
>     business_entity_id?: string | null,
>     deleted?: boolean | null
>   } | null
> }[] | null
> ```

***

### update

`itemFamilies.update`

Update an item family. This endpoint updates the name and/or description of the item family.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.itemFamilies.update({ itemFamilyId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `itemFamilyId` | `string` | Yes | — |
| `name` | `string` | No | The display name for the item family. Must be unique. This is visible only in Chargebee and not to customers. |
| `description` | `string` | No | Description of the item family. This is visible only in Chargebee and not to customers. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `item_family` | `object \| null` | No | If you're a company that sells multiple product lines then each product line or service is an item family in the Chargebee API. For example, if you are a SaaS company that offers separate products for project management, content collaboration, and customer support. Each of those can be an item family under which the various plans, addons and charges can be the [items](https://docs.corsair.dev/docs/api/items). Item families compartmentalize items such that only items belonging to the same family can be part of any given subscription. **Note:** You must have the [Product Families](https://www.chargebee.com/docs/2.0/product-families.html) enabled for your site to be able to set up item families. |

> [accordion] item\_family full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   status?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null
> } | null
> ```

***

## Item Prices

### create

`itemPrices.create`

Create an item price. This API creates an item price (a price point) for an item.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.itemPrices.create({ id: 'cust_8gsnbYfsMLds', item_id: 'example', name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `id` | `string` | Yes | The identifier for the item price. It is unique and immutable. |
| `name` | `string` | Yes | A unique display name for the item price in the Chargebee UI. If `external_name` is not provided, this is also used in customer-facing pages and documents such as [invoices](https://docs.corsair.dev/docs/api/invoices) and [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages) . |
| `description` | `string` | No | Description of the item price. |
| `item_id` | `string` | Yes | The id of the item that the item price belongs to. |
| `invoice_notes` | `string` | No | A customer-facing note added to all invoices associated with this API resource. This note becomes one among [all the notes](https://docs.corsair.dev/docs/api/invoices/invoice-object#notes) displayed on the invoice PDF. |
| `proration_type` | `site_default \| partial_term \| full_term` | No | Specifies how to manage charges or credits for the addon item price during a [subscription update](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) or [estimating](https://docs.corsair.dev/docs/api/estimates/estimate-for-updating-a-subscription) a subscription update. \* full\_term - Charge the full price of the addon item price or give the full credit. Don't apply any proration. \* site\_default - Use the [site-wide proration setting](https://www.chargebee.com/docs/2.0/proration.html#proration-for-subscription-change) . \* partial\_term - Prorate the charges or credits for the rest of the current term. |
| `external_name` | `string` | No | The name of the item price used in customer-facing pages and documents. These include [invoices](https://docs.corsair.dev/docs/api/invoices) and [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages). If not provided, then `name` is used. |
| `currency_code` | `string` | No | The currency code ([ISO 4217 format](https://www.chargebee.com/docs/supported-currencies.html) ) for the item price. Is required when multiple currencies have been enabled. |
| `price_variant_id` | `string` | No | An immutable unique identifier of a [price variant](https://docs.corsair.dev/docs/api/price_variants). |
| `is_taxable` | `boolean` | No | Specifies whether taxes apply to this item price. This value is set and returned even if [Taxes](https://www.chargebee.com/docs/tax.html) have been disabled in Chargebee. However, the value is effective only while Taxes are enabled. |
| `free_quantity` | `number` | No | Free quantity the subscriptions of this **plan** `item_price` will have. Only the quantity exceeding this value will be charged in the subscription. **Note:** \* `free_quantity` is currently supported only for [plan](https://docs.corsair.dev/docs/api/items/item-object#type) `item_price`. \* `free_quantity` is not supported for the [Usage-Based Billing](https://www.chargebee.com/docs/2.0/understanding-usages.html) (UBB). All included or free quantities should be configured exclusively through [entitlements](https://docs.corsair.dev/docs/api/entitlements) . |
| `free_quantity_in_decimal` | `string` | No | The quantity of the item that is available free-of-charge, represented in decimal. When a subscription is created for this plan or when the plan of a subscription is changed to this one, only the quantity above this number is charged for. Applicable for quantity-based plans and only when [multi-decimal pricing](https://docs.corsair.dev/docs/api/getting-started) is enabled. |
| `metadata` | `object` | No | A collection of key-value pairs that provides extra information about the item price. **Note:** There's a character limit of 65,535. [Learn more](https://docs.corsair.dev/docs/api/advanced-features#metadata) . |
| `show_description_in_invoices` | `boolean` | No | Whether the item price's description should be shown on [invoice PDFs](https://docs.corsair.dev/docs/api/invoices/retrieve-invoice-as-pdf). If this Boolean is changed, only invoices generated (or [regenerated](https://www.chargebee.com/docs/invoice-operations.html#actions-for-payment-due-not-paid-invoices_regenerate-invoice) ) after the change are affected; past invoices are not. |
| `show_description_in_quotes` | `boolean` | No | Whether the item price's description should be shown on [quote PDFs](https://docs.corsair.dev/docs/api/quotes/retrieve-quote-as-pdf). If this Boolean is changed, only quotes created after the change are affected; past quotes are not. |
| `usage_accumulation_reset_frequency` | `never \| subscription_billing_frequency` | No | Specifies the frequency at which the usage counter needs to be reset. **Prerequisites** \* Usage accumulation across the contract period must be enabled for the site before providing `usage_accumulation_reset_frequency`. **Constraints** \* Applicable only to metered item prices that use the `tiered` pricing model. **Note:** Changes to the `usage_accumulation_reset_frequency` parameter are not allowed when the item price is already linked to a subscription. \* never - Accumulates usage without ever resetting it. \* subscription\_billing\_frequency - Accumulates usage until the subscription's billing frequency ends. |
| `business_entity_id` | `string` | No | The unique ID of the [business entity](https://docs.corsair.dev/docs/api/business_entities) for this `item_price`. This is applicable only when multiple business entities have been created for the site. When provided, the operation will read or write data associated with the specified business entity. If not provided, the resource will be created at the site level, and the `business_entity_id` will not be included in the API response. **Note** An alternative way of passing this parameter is by means of a [custom HTTP header](https://docs.corsair.dev/docs/api/advanced-features#mbe-header-main). |
| `pricing_model` | `flat_fee \| per_unit \| tiered \| volume \| stairstep` | No | The [pricing scheme](https://www.chargebee.com/docs/2.0/plans.html#pricing-models) for this item price. If subscriptions, invoices or [differential prices](https://docs.corsair.dev/docs/api/differential_prices) exist for this item price, `pricing_model` cannot be changed. \* tiered - There are quantity tiers for which per unit prices are set. Quantities are purchased from successive tiers. \* per\_unit - A fixed price per unit quantity. \* flat\_fee - A fixed price that is not quantity-based. \* volume - The per unit price is based on the tier that the total quantity falls in. \* stairstep - A quantity-based pricing scheme. The item is charged a fixed price based on the tier that the total quantity falls in. |
| `price` | `number` | No | The cost of the item price when the pricing model is `flat_fee`. When the pricing model is `per_unit` , it is the price per unit quantity of the item. Not applicable for the other pricing models. The value is in the [minor unit of the currency](https://docs.corsair.dev/docs/api/getting-started) . |
| `price_in_decimal` | `string` | No | The price of the item when the pricing\_model is `flat_fee`. When the pricing model is `per_unit` , it is the price per unit quantity of the item. Not applicable for the other pricing models. The value is in decimal and in major units of the currency. Also, this is only applicable when [multi-decimal pricing](https://docs.corsair.dev/docs/api/getting-started) is enabled. |
| `period_unit` | `day \| week \| month \| year` | No | The unit of time for `period`. If subscriptions or invoices exist for this item price, `period_unit` cannot be changed. The `period_unit` is mandatory when the item `type` is `plan` or `addon` . **Important:** The `period` + `period_unit` pair must match a *configured billing frequency* on your site. The API does not create new frequencies. To use a new frequency (for example, 3 months or 2 weeks), add it in the site settings first. Requests with non-configured combinations fail validation. \* Monthly: `period=1`, `period_unit=month` (available by default) \* Quarterly: `period=3`, `period_unit=month` (*enable 3-month frequency in settings*) \* Weekly: `period=1`, `period_unit=week` (available by default) See [how billing periods apply](https://www.chargebee.com/docs/billing/2.0/subscriptions/addons-billingcycle) . \* month - A period of 1 calendar month. \* week - A period of 7 days. \* year - A period of 1 calendar year. \* day - A period of 24 hours. |
| `period` | `number` | No | \* When the item `type` is `plan`: The billing period of the plan in `period_unit`s. For example, create a 6 month plan by providing `period` as 6 and `period_unit` as month. \* When item `type` is `addon`: The period of the addon in `period_unit`s. For example, create an addon with a 2 month `period` by providing period as 2 and `period_unit` as `month`. The period of an addon is the duration for which its `price` applies. When attached to a plan, the addon is billed for the billing period of the plan. [Learn more.](https://www.chargebee.com/docs/2.0/addons-billingcycle.html) If subscriptions or invoices exist for this item price, `period` cannot be changed. The `period` is mandatory when the item `type` is `plan` or `addon`. **Important:** The `period` value, together with `period_unit`, must equal one of your site's *configured billing frequencies* . If the combination does not exist, the request fails with an invalid billing period configuration error. Configure the frequency in site settings and retry. See [Addons and billing cycle](https://www.chargebee.com/docs/billing/2.0/subscriptions/addons-billingcycle). |
| `trial_period_unit` | `day \| month` | No | The unit of time for `trial_period` . \* month - A period of 1 calendar month. \* day - A period of 24 hours. |
| `trial_period` | `number` | No | The trial period of the plan in `trial_period_unit` s. You can also set [trial periods for addons](https://www.chargebee.com/docs/2.0/addons-trial.html) ; contact [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 that feature. |
| `shipping_period` | `number` | No | Defines the shipping frequency. Example: to bill customer every 2 weeks, provide "2" here. |
| `shipping_period_unit` | `day \| week \| month \| year` | No | Defines the shipping frequency in association with shipping period. \* day - A period of 24 hours. \* week - A period of 7 days. \* year - A period of 1 calendar year. \* month - A period of 1 calendar month. |
| `billing_cycles` | `number` | No | The default number of billing cycles a subscription to the plan must run. Can be [overridden](https://docs.corsair.dev/docs/api/subscriptions) for a subscription. Addons can also [have billing cycles](https://www.chargebee.com/docs/2.0/addons-billingcycle.html). Also, for addons, you can [override this](https://docs.corsair.dev/docs/api/attached_items) while attaching it to a plan. However, if you provide the value while [applying the addon to a subscription](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#subscription_items_item_type), then that value takes still higher precedence. If subscriptions, invoices or [differential prices](https://docs.corsair.dev/docs/api/differential_prices) exist for this item price, `billing_cycles` cannot be changed. **Note:** If you want to change the `billing_cycles` to unlimited renewals, enter an empty string. This value can only be updated if the `item_price` is not attached to a subscription or invoice. If no `billing_cycles` value is entered, then by default the value will be set as unlimited `billing_cycles` renewals. |
| `trial_end_action` | `site_default \| activate_subscription \| cancel_subscription` | No | Applicable only when [End-of-trial Action](https://www.chargebee.com/docs/2.0/trial_periods_hidden.html#how-to-define-the-end-of-trial-actions-for-subscriptions) has been enabled for the site. Specifies the operation to be carried out for the subscription once the trial ends. Whenever the `item.type` is `plan` and a trial period is defined for this item price, this attribute (parameter) is returned (required). This can be overridden at the [subscription-level](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#trial_end_action) . \* cancel\_subscription - The subscription cancels. \* activate\_subscription - The subscription activates and charges are raised for non-metered items. \* site\_default - The action [configured for the site](https://www.chargebee.com/docs/2.0/trial_periods_hidden.html#how-to-define-the-end-of-trial-actions-for-subscriptions) at the time when the trial ends, takes effect. |
| `tax_detail` | `object` | No | Parameters for tax\_detail |
| `accounting_detail` | `object` | No | Parameters for accounting\_detail |
| `tiers` | `object` | No | Parameters for tiers |
| `tax_providers_fields` | `object` | No | Parameters for tax\_providers\_fields |

> [accordion] metadata full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] tax\_detail full type
>
> ```ts theme={null}
> {
>   tax_profile_id?: string,
>   avalara_tax_code?: string,
>   hsn_code?: string,
>   avalara_sale_type?: wholesale | retail | consumed | vendor_use,
>   avalara_transaction_type?: number,
>   avalara_service_type?: number,
>   taxjar_product_code?: string
> }
> ```

> [accordion] accounting\_detail full type
>
> ```ts theme={null}
> {
>   sku?: string,
>   accounting_code?: string,
>   accounting_category1?: string,
>   accounting_category2?: string,
>   accounting_category3?: string,
>   accounting_category4?: string
> }
> ```

> [accordion] tiers full type
>
> ```ts theme={null}
> {
>   starting_unit?: number[],
>   ending_unit?: number[],
>   price?: number[],
>   starting_unit_in_decimal?: string[],
>   ending_unit_in_decimal?: string[],
>   price_in_decimal?: string[],
>   pricing_type?: (per_unit | flat_fee | package)[],
>   package_size?: number[]
> }
> ```

> [accordion] tax\_providers\_fields full type
>
> ```ts theme={null}
> {
>   provider_name: string[],
>   field_id: string[],
>   field_value: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `item_price` | `object \| null` | No | An item price is a price point for an item. It defines the currency, pricing model, price, billing period and other attributes for an [item](https://docs.corsair.dev/docs/api/items). For example, consider a cloud storage service as an item. Then each of the following defines an item price: \* The cloud storage sold at USD 10 per month. \* The same service sold at AUD 100 per year. \* The service sold at a monthly rate determined by the following [stairstep](https://www.chargebee.com/docs/2.0/plans.html#pricing-models) pricing model: \* 1-10 users for EUR 10 \* 11-25 users for EUR 20 \* 26-50 users for EUR 45 \* 51 and above for EUR 100 Types of item prices -------------------- The type of an item price corresponds to the [type of the item](https://docs.corsair.dev/docs/api/items) that the item price belongs to. In other words, item prices can be of the following types: \* Plan-item prices \* Addon-item prices \* Charge-item prices Billing periods for item prices ------------------------------- The **billing period** of an item price (applicable only to plan-item prices and addon-item prices) is the [`period`](https://docs.corsair.dev/docs/api/item_prices/item-price-object#period) of the item price in [`period_unit`](https://docs.corsair.dev/docs/api/item_prices/item-price-object#period_unit)s. \* When [price variants](https://docs.corsair.dev/docs/api/price_variants) are **not** enabled, an item can have only one item price for a given currency and billing period. \* When price variants **are** enabled, an item can have multiple item prices for the same currency and billing period, as long as each has a distinct [`price_variant_id`](https://docs.corsair.dev/docs/api/item_prices/item-price-object#price_variant_id). An item price created without a `price_variant_id` is treated as the default ("no variant"), and only one such default item price can exist for a given currency and billing period. |

> [accordion] item\_price full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   item_family_id?: string | null,
>   item_id?: string | null,
>   description?: string | null,
>   status?: string | null,
>   external_name?: string | null,
>   price_variant_id?: string | null,
>   price_ramp_id?: string | null,
>   proration_type?: string | null,
>   pricing_model?: string | null,
>   price?: number | null,
>   price_in_decimal?: string | null,
>   period?: number | null,
>   currency_code?: string | null,
>   period_unit?: string | null,
>   trial_period?: number | null,
>   trial_period_unit?: string | null,
>   trial_end_action?: string | null,
>   shipping_period?: number | null,
>   shipping_period_unit?: string | null,
>   billing_cycles?: number | null,
>   free_quantity?: number | null,
>   free_quantity_in_decimal?: string | null,
>   channel?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   usage_accumulation_reset_frequency?: string | null,
>   archived_at?: number | null,
>   invoice_notes?: string | null,
>   is_taxable?: boolean | null,
>   metadata?: {
>   } | null,
>   item_type?: string | null,
>   show_description_in_invoices?: boolean | null,
>   show_description_in_quotes?: boolean | null,
>   deleted?: boolean | null,
>   business_entity_id?: string | null,
>   tiers?: {
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   tax_detail?: {
>     tax_profile_id?: string | null,
>     avalara_sale_type?: string | null,
>     avalara_transaction_type?: number | null,
>     avalara_service_type?: number | null,
>     avalara_tax_code?: string | null,
>     hsn_code?: string | null,
>     taxjar_product_code?: string | null
>   } | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   accounting_detail?: {
>     sku?: string | null,
>     accounting_code?: string | null,
>     accounting_category1?: string | null,
>     accounting_category2?: string | null,
>     accounting_category3?: string | null,
>     accounting_category4?: string | null
>   } | null
> } | null
> ```

***

### createDifferentialPrice

`itemPrices.createDifferentialPrice`

Create a differential price. for addon item price, addon item price with tiered pricing, or charge item price.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.itemPrices.createDifferentialPrice({ itemPriceId: 'silver-USD-monthly', parent_item_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `itemPriceId` | `string` | Yes | — |
| `parent_item_id` | `string` | Yes | The id of the plan-item, in relation to which, the differential pricing for the addon or charge is defined. For example, this would be the id of the *Standard* or *Enterprise* plans-items mentioned in the [examples above](https://docs.corsair.dev/docs/api/differential_prices) . |
| `price` | `number` | No | The differential price. If the pricing model of the `item_price_id` is `tiered` , `volume` , or `stairstep` , pass `tiers` instead of this. |
| `price_in_decimal` | `string` | No | The price of the item when the pricing\_model is `flat_fee`. When the pricing model is `per_unit` , it is the price per unit quantity of the item. Not applicable for the other pricing models. The value is in decimal and in major units of the currency. Also, this is only applicable when [multi-decimal pricing](https://docs.corsair.dev/docs/api/currencies) is enabled. |
| `business_entity_id` | `string` | No | The unique ID of the [business entity](https://docs.corsair.dev/docs/api/business_entities) for this `differential_price`. This is applicable only when multiple business entities have been created for the site. When provided, the operation will read or write data associated with the specified business entity. If not provided, the resource will be created at the site level, and the business\_entity\_id will not be included in the API response. **Note** : An alternative way of passing this parameter is by using a [custom HTTP header](https://docs.corsair.dev/docs/api/advanced-features) or [query string parameter](https://docs.corsair.dev/docs/api/advanced-features#mbe-alternative). |
| `parent_periods` | `object` | No | Parameters for parent\_periods |
| `tiers` | `object` | No | Parameters for tiers |

> [accordion] parent\_periods full type
>
> ```ts theme={null}
> {
>   period_unit: (day | week | month | year)[],
>   period?: any[][]
> }
> ```

> [accordion] tiers full type
>
> ```ts theme={null}
> {
>   starting_unit?: number[],
>   ending_unit?: number[],
>   price?: number[],
>   starting_unit_in_decimal?: string[],
>   ending_unit_in_decimal?: string[],
>   price_in_decimal?: string[],
>   pricing_type?: (per_unit | flat_fee | package)[],
>   package_size?: number[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `differential_price` | `object \| null` | No | Differential pricing helps implement a pricing strategy for addons and charges based on the plans they're purchased with. A differential price a specific price for an addon- or charge-[item price](https://docs.corsair.dev/docs/api/item_prices) when purchased along with a particular plan. Differential pricing for addons ------------------------------- Consider an addon called 24x7 Customer Support provided with a cloud storage service. You can configure differential prices for each of the addon-item prices based on the plan they are purchased with, as follows: \|---\|-----------------------------------------------------\|-----------------------------------------------\|-----------------------------------------------------\| \| \| **Addon item price** \| **Price when applied to *Standard*** **Plan** \| **Price when applied to** ***Enterprise*** **Plan** \| \| 1 \| 24x7 Customer Support, USD, Monthly, Flat fee, $100 \| $90 \| $150 \| \| 2 \| 24x7 Customer Support, USD, Yearly, Flat fee, $1000 \| $900 \| $1500 \| Differential pricing for charges -------------------------------- Consider a charge, called Setup fee, for installing and configuring a cloud-based project management platform. There are two modes in which you can set up differential pricing for a charge: #### Mode A: One charge differential price per plan-item This mode is used to specify one differential price for the charge-item price per [plan-item](https://docs.corsair.dev/docs/api/items) it is applied to. \|-------------------------------\|---------------------------------------------------\|-----------------------------------------------------\| \| **Charge-item price** \| **Price when applied to** ***Standard*** **plan** \| **Price when applied to** ***Enterprise*** **plan** \| \| Setup fee, USD, Flat fee $500 \| $400 \| $700 \| #### Mode B: Multiple charge differential prices per plan item This mode is used to specify multiple differential prices for the charge per plan-item, based on the plan period. \|-------------------------------\|-------------------------------------------------------------\|-----------------------------------------------------------\| \| **Charge-item price** \| **Price when applied to** ***Standard*** **plan, 6 months** \| **Price when applied to** ***Standard*** **plan, yearly** \| \| Setup fee, USD, Flat fee $500 \| $400 \| $300 \| In the above example, even if the "6 month" or "yearly" plan-item prices do not exist, the differential prices for the charge can still be created. They take effect whenever the plan-item prices are eventually created and used in subscriptions. |

> [accordion] differential\_price full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   item_price_id?: string | null,
>   parent_item_id?: string | null,
>   price?: number | null,
>   price_in_decimal?: string | null,
>   status?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   modified_at?: number | null,
>   currency_code?: string | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null,
>   tiers?: {
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   parent_periods?: {
>     period_unit?: string | null,
>     period?: any[] | null
>   }[] | null
> } | null
> ```

***

### delete

`itemPrices.delete`

Delete an item price. Deletes an item price, marking its status as deleted. If it is part of a subscription or invoice, the item price status is marked archived instead. Once deleted, the id and name of the item price can be reused to create a new item price.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.itemPrices.delete({ itemPriceId: 'silver-USD-monthly' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `itemPriceId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `item_price` | `object \| null` | No | An item price is a price point for an item. It defines the currency, pricing model, price, billing period and other attributes for an [item](https://docs.corsair.dev/docs/api/items). For example, consider a cloud storage service as an item. Then each of the following defines an item price: \* The cloud storage sold at USD 10 per month. \* The same service sold at AUD 100 per year. \* The service sold at a monthly rate determined by the following [stairstep](https://www.chargebee.com/docs/2.0/plans.html#pricing-models) pricing model: \* 1-10 users for EUR 10 \* 11-25 users for EUR 20 \* 26-50 users for EUR 45 \* 51 and above for EUR 100 Types of item prices -------------------- The type of an item price corresponds to the [type of the item](https://docs.corsair.dev/docs/api/items) that the item price belongs to. In other words, item prices can be of the following types: \* Plan-item prices \* Addon-item prices \* Charge-item prices Billing periods for item prices ------------------------------- The **billing period** of an item price (applicable only to plan-item prices and addon-item prices) is the [`period`](https://docs.corsair.dev/docs/api/item_prices/item-price-object#period) of the item price in [`period_unit`](https://docs.corsair.dev/docs/api/item_prices/item-price-object#period_unit)s. \* When [price variants](https://docs.corsair.dev/docs/api/price_variants) are **not** enabled, an item can have only one item price for a given currency and billing period. \* When price variants **are** enabled, an item can have multiple item prices for the same currency and billing period, as long as each has a distinct [`price_variant_id`](https://docs.corsair.dev/docs/api/item_prices/item-price-object#price_variant_id). An item price created without a `price_variant_id` is treated as the default ("no variant"), and only one such default item price can exist for a given currency and billing period. |

> [accordion] item\_price full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   item_family_id?: string | null,
>   item_id?: string | null,
>   description?: string | null,
>   status?: string | null,
>   external_name?: string | null,
>   price_variant_id?: string | null,
>   price_ramp_id?: string | null,
>   proration_type?: string | null,
>   pricing_model?: string | null,
>   price?: number | null,
>   price_in_decimal?: string | null,
>   period?: number | null,
>   currency_code?: string | null,
>   period_unit?: string | null,
>   trial_period?: number | null,
>   trial_period_unit?: string | null,
>   trial_end_action?: string | null,
>   shipping_period?: number | null,
>   shipping_period_unit?: string | null,
>   billing_cycles?: number | null,
>   free_quantity?: number | null,
>   free_quantity_in_decimal?: string | null,
>   channel?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   usage_accumulation_reset_frequency?: string | null,
>   archived_at?: number | null,
>   invoice_notes?: string | null,
>   is_taxable?: boolean | null,
>   metadata?: {
>   } | null,
>   item_type?: string | null,
>   show_description_in_invoices?: boolean | null,
>   show_description_in_quotes?: boolean | null,
>   deleted?: boolean | null,
>   business_entity_id?: string | null,
>   tiers?: {
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   tax_detail?: {
>     tax_profile_id?: string | null,
>     avalara_sale_type?: string | null,
>     avalara_transaction_type?: number | null,
>     avalara_service_type?: number | null,
>     avalara_tax_code?: string | null,
>     hsn_code?: string | null,
>     taxjar_product_code?: string | null
>   } | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   accounting_detail?: {
>     sku?: string | null,
>     accounting_code?: string | null,
>     accounting_category1?: string | null,
>     accounting_category2?: string | null,
>     accounting_category3?: string | null,
>     accounting_category4?: string | null
>   } | null
> } | null
> ```

***

### get

`itemPrices.get`

Retrieve an item price. This API retrieves a specific item price using the id.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.itemPrices.get({ itemPriceId: 'silver-USD-monthly' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `itemPriceId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `item_price` | `object \| null` | No | An item price is a price point for an item. It defines the currency, pricing model, price, billing period and other attributes for an [item](https://docs.corsair.dev/docs/api/items). For example, consider a cloud storage service as an item. Then each of the following defines an item price: \* The cloud storage sold at USD 10 per month. \* The same service sold at AUD 100 per year. \* The service sold at a monthly rate determined by the following [stairstep](https://www.chargebee.com/docs/2.0/plans.html#pricing-models) pricing model: \* 1-10 users for EUR 10 \* 11-25 users for EUR 20 \* 26-50 users for EUR 45 \* 51 and above for EUR 100 Types of item prices -------------------- The type of an item price corresponds to the [type of the item](https://docs.corsair.dev/docs/api/items) that the item price belongs to. In other words, item prices can be of the following types: \* Plan-item prices \* Addon-item prices \* Charge-item prices Billing periods for item prices ------------------------------- The **billing period** of an item price (applicable only to plan-item prices and addon-item prices) is the [`period`](https://docs.corsair.dev/docs/api/item_prices/item-price-object#period) of the item price in [`period_unit`](https://docs.corsair.dev/docs/api/item_prices/item-price-object#period_unit)s. \* When [price variants](https://docs.corsair.dev/docs/api/price_variants) are **not** enabled, an item can have only one item price for a given currency and billing period. \* When price variants **are** enabled, an item can have multiple item prices for the same currency and billing period, as long as each has a distinct [`price_variant_id`](https://docs.corsair.dev/docs/api/item_prices/item-price-object#price_variant_id). An item price created without a `price_variant_id` is treated as the default ("no variant"), and only one such default item price can exist for a given currency and billing period. |

> [accordion] item\_price full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   item_family_id?: string | null,
>   item_id?: string | null,
>   description?: string | null,
>   status?: string | null,
>   external_name?: string | null,
>   price_variant_id?: string | null,
>   price_ramp_id?: string | null,
>   proration_type?: string | null,
>   pricing_model?: string | null,
>   price?: number | null,
>   price_in_decimal?: string | null,
>   period?: number | null,
>   currency_code?: string | null,
>   period_unit?: string | null,
>   trial_period?: number | null,
>   trial_period_unit?: string | null,
>   trial_end_action?: string | null,
>   shipping_period?: number | null,
>   shipping_period_unit?: string | null,
>   billing_cycles?: number | null,
>   free_quantity?: number | null,
>   free_quantity_in_decimal?: string | null,
>   channel?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   usage_accumulation_reset_frequency?: string | null,
>   archived_at?: number | null,
>   invoice_notes?: string | null,
>   is_taxable?: boolean | null,
>   metadata?: {
>   } | null,
>   item_type?: string | null,
>   show_description_in_invoices?: boolean | null,
>   show_description_in_quotes?: boolean | null,
>   deleted?: boolean | null,
>   business_entity_id?: string | null,
>   tiers?: {
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   tax_detail?: {
>     tax_profile_id?: string | null,
>     avalara_sale_type?: string | null,
>     avalara_transaction_type?: number | null,
>     avalara_service_type?: number | null,
>     avalara_tax_code?: string | null,
>     hsn_code?: string | null,
>     taxjar_product_code?: string | null
>   } | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   accounting_detail?: {
>     sku?: string | null,
>     accounting_code?: string | null,
>     accounting_category1?: string | null,
>     accounting_category2?: string | null,
>     accounting_category3?: string | null,
>     accounting_category4?: string | null
>   } | null
> } | null
> ```

***

### list

`itemPrices.list`

List item prices. Returns a list of item prices satisfying all the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order. ### Use Cases ##### Filter by custom fields Note: Custom field filters are turned off by default.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.itemPrices.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `id` | `object` | No | optional, string filter Filter item prices based on their [id](https://docs.corsair.dev/docs/api/item_prices) . **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *id\\\[is\\] = "basic\_USD"* |
| `name` | `object` | No | optional, string filter Filter item prices based on their `name` s. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *name\\\[is\\] = "basic USD"* |
| `pricing_model` | `object` | No | optional, enumerated string filter Filter item prices based on their `pricing_model`. Possible values are : flat\_fee, per\_unit, tiered, volume, stairstep. **Supported operators :** is, is\_not, in, not\_in **Example →** *pricing\_model\\\[is\\] = "flat\_fee"* |
| `item_id` | `object` | No | optional, string filter Filter item prices based on their `item_id` . **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *item\_id\\\[is\\] = "basic"* |
| `item_family_id` | `object` | No | optional, string filter Filter item prices based on `item_family_id` . **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *item\_family\_id\\\[is\\] = "Acme"* |
| `item_type` | `object` | No | optional, enumerated string filter Filter item prices based on `item_type`. Possible values are : plan, addon, charge. **Supported operators :** is, is\_not, in, not\_in **Example →** *item\_type\\\[is\_not\\] = "plan"* |
| `currency_code` | `object` | No | optional, string filter Filter item prices based on their `currency_code` . **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *currency\_code\\\[is\_not\\] = "USD"* |
| `price_variant_id` | `object` | No | optional, string filter Filter item prices based on their `price_variant_id` . **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *price\_variant\_id\\\[is\\] = "tamilNadu-India"* |
| `trial_period` | `object` | No | optional, integer filter Filter item prices based on their `trial_period` . **Supported operators :** is, is\_not, lt, lte, gt, gte, between **Example →** *trial\_period\\\[is\\] = "14"* |
| `trial_period_unit` | `object` | No | optional, enumerated string filter Filter item prices based on their `trial_period_unit`. Possible values are : day, month. **Supported operators :** is, is\_not, in, not\_in **Example →** *trial\_period\_unit\\\[is\\] = "day"* |
| `status` | `object` | No | optional, enumerated string filter Filter item prices based on their `status`. Possible values are : active, archived. **Supported operators :** is, is\_not, in, not\_in **Example →** *status\\\[is\\] = "active"* |
| `updated_at` | `object` | No | optional, timestamp(UTC) in seconds filter Filter item prices based on their `updated_at` . **Supported operators :** after, before, on, between **Example →** *updated\_at\\\[after\\] = "1243545465"* |
| `business_entity_id` | `object` | No | optional, string filter The unique ID of the [business entity](https://docs.corsair.dev/docs/api/business_entities) of this `item_price`. [Learn more](https://docs.corsair.dev/docs/api/using_business_entity_filters_in_product_catalog_list_apis) about all the scenarios before using this filter. **Supported operators :** is, is\_present **Example →** *business\_entity\_id\\\[is\_present\\] = "true"* |
| `include_site_level_resources` | `object` | No | optional, boolean filter Default value is `true` . To exclude site-level resources in [specific cases](), set this parameter to `false`. Possible values are : *true, false* **Supported operators :** is **Example →** *include\_site\_level\_resources\\\[is\\] = "null"* |
| `period_unit` | `object` | No | optional, enumerated string filter Filter item prices based on their `period_unit`. Possible values are : day, week, month, year. **Supported operators :** is, is\_not, in, not\_in **Example →** *period\_unit\\\[is\\] = "month"* |
| `period` | `object` | No | optional, integer filter Filter item prices based on their `period` . **Supported operators :** is, is\_not, lt, lte, gt, gte, between **Example →** *period\\\[is\\] = "3"* |
| `channel` | `object` | No | optional, enumerated string filter The subscription channel this object originated from and is maintained in. Possible values are : web, app\_store, play\_store. **Supported operators :** is, is\_not, in, not\_in **Example →** *channel\\\[is\\] = "APP STORE"* |
| `sort_by` | `object` | No | optional, string filter Sorts based on the specified attribute. **Supported attributes :** name, id, updated\_at **Supported sort-orders :** asc, desc **Example →** *sort\_by\\\[asc\\] = "name"* This will sort the result based on the 'name' attribute in ascending(earliest first) order. |

> [accordion] id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] name full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] pricing\_model full type
>
> ```ts theme={null}
> {
>   is?: flat_fee | per_unit | tiered | volume | stairstep,
>   is_not?: flat_fee | per_unit | tiered | volume | stairstep,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] item\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] item\_family\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] item\_type full type
>
> ```ts theme={null}
> {
>   is?: plan | addon | charge,
>   is_not?: plan | addon | charge,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] currency\_code full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] price\_variant\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] trial\_period full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   lt?: string,
>   lte?: string,
>   gt?: string,
>   gte?: string,
>   between?: string
> }
> ```

> [accordion] trial\_period\_unit full type
>
> ```ts theme={null}
> {
>   is?: day | month,
>   is_not?: day | month,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] status full type
>
> ```ts theme={null}
> {
>   is?: active | archived | deleted,
>   is_not?: active | archived | deleted,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] updated\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] business\_entity\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_present?: true | false
> }
> ```

> [accordion] include\_site\_level\_resources full type
>
> ```ts theme={null}
> {
>   is?: true | false
> }
> ```

> [accordion] period\_unit full type
>
> ```ts theme={null}
> {
>   is?: day | week | month | year,
>   is_not?: day | week | month | year,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] period full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   lt?: string,
>   lte?: string,
>   gt?: string,
>   gte?: string,
>   between?: string
> }
> ```

> [accordion] channel full type
>
> ```ts theme={null}
> {
>   is?: web | app_store | play_store,
>   is_not?: web | app_store | play_store,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] sort\_by full type
>
> ```ts theme={null}
> {
>   asc?: name | id | updated_at,
>   desc?: name | id | updated_at
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   item_price?: {
>     id?: string | null,
>     name?: string | null,
>     item_family_id?: string | null,
>     item_id?: string | null,
>     description?: string | null,
>     status?: string | null,
>     external_name?: string | null,
>     price_variant_id?: string | null,
>     price_ramp_id?: string | null,
>     proration_type?: string | null,
>     pricing_model?: string | null,
>     price?: number | null,
>     price_in_decimal?: string | null,
>     period?: number | null,
>     currency_code?: string | null,
>     period_unit?: string | null,
>     trial_period?: number | null,
>     trial_period_unit?: string | null,
>     trial_end_action?: string | null,
>     shipping_period?: number | null,
>     shipping_period_unit?: string | null,
>     billing_cycles?: number | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     channel?: string | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     created_at?: number | null,
>     usage_accumulation_reset_frequency?: string | null,
>     archived_at?: number | null,
>     invoice_notes?: string | null,
>     is_taxable?: boolean | null,
>     metadata?: {
>     } | null,
>     item_type?: string | null,
>     show_description_in_invoices?: boolean | null,
>     show_description_in_quotes?: boolean | null,
>     deleted?: boolean | null,
>     business_entity_id?: string | null,
>     tiers?: {
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       price?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       price_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     tax_detail?: {
>       tax_profile_id?: string | null,
>       avalara_sale_type?: string | null,
>       avalara_transaction_type?: number | null,
>       avalara_service_type?: number | null,
>       avalara_tax_code?: string | null,
>       hsn_code?: string | null,
>       taxjar_product_code?: string | null
>     } | null,
>     tax_providers_fields?: {
>       provider_name?: string | null,
>       field_id?: string | null,
>       field_value?: string | null
>     }[] | null,
>     accounting_detail?: {
>       sku?: string | null,
>       accounting_code?: string | null,
>       accounting_category1?: string | null,
>       accounting_category2?: string | null,
>       accounting_category3?: string | null,
>       accounting_category4?: string | null
>     } | null
>   } | null
> }[] | null
> ```

***

### listApplicableItemPrices

`itemPrices.listApplicableItemPrices`

List applicable item prices for a plan-item price. Returns the set of all applicable addon-item prices for a specific plan-item price. This set consists of all the addon-item prices that can be applied to a subscription having the plan-item price.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.itemPrices.listApplicableItemPrices({ itemPriceId: 'silver-USD-monthly' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `itemPriceId` | `string` | Yes | — |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `item_id` | `string` | No | The id of the item that the item price belongs to. |
| `sort_by` | `object` | No | optional, string filter Sorts based on the specified attribute. **Supported attributes :** name, id, updated\_at **Supported sort-orders :** asc, desc **Example →** *sort\_by\\\[asc\\] = "name"* This will sort the result based on the 'name' attribute in ascending(earliest first) order. |

> [accordion] sort\_by full type
>
> ```ts theme={null}
> {
>   asc?: name | id | updated_at,
>   desc?: name | id | updated_at
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   item_price?: {
>     id?: string | null,
>     name?: string | null,
>     item_family_id?: string | null,
>     item_id?: string | null,
>     description?: string | null,
>     status?: string | null,
>     external_name?: string | null,
>     price_variant_id?: string | null,
>     price_ramp_id?: string | null,
>     proration_type?: string | null,
>     pricing_model?: string | null,
>     price?: number | null,
>     price_in_decimal?: string | null,
>     period?: number | null,
>     currency_code?: string | null,
>     period_unit?: string | null,
>     trial_period?: number | null,
>     trial_period_unit?: string | null,
>     trial_end_action?: string | null,
>     shipping_period?: number | null,
>     shipping_period_unit?: string | null,
>     billing_cycles?: number | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     channel?: string | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     created_at?: number | null,
>     usage_accumulation_reset_frequency?: string | null,
>     archived_at?: number | null,
>     invoice_notes?: string | null,
>     is_taxable?: boolean | null,
>     metadata?: {
>     } | null,
>     item_type?: string | null,
>     show_description_in_invoices?: boolean | null,
>     show_description_in_quotes?: boolean | null,
>     deleted?: boolean | null,
>     business_entity_id?: string | null,
>     tiers?: {
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       price?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       price_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     tax_detail?: {
>       tax_profile_id?: string | null,
>       avalara_sale_type?: string | null,
>       avalara_transaction_type?: number | null,
>       avalara_service_type?: number | null,
>       avalara_tax_code?: string | null,
>       hsn_code?: string | null,
>       taxjar_product_code?: string | null
>     } | null,
>     tax_providers_fields?: {
>       provider_name?: string | null,
>       field_id?: string | null,
>       field_value?: string | null
>     }[] | null,
>     accounting_detail?: {
>       sku?: string | null,
>       accounting_code?: string | null,
>       accounting_category1?: string | null,
>       accounting_category2?: string | null,
>       accounting_category3?: string | null,
>       accounting_category4?: string | null
>     } | null
>   } | null
> }[] | null
> ```

***

### listApplicableItems

`itemPrices.listApplicableItems`

List applicable items for a plan-item price. Returns the set of all applicable addon-items for a specific plan-item price . This set consists of all addon-items whose item prices can be applied to a subscription having the plan-item price in it.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.itemPrices.listApplicableItems({ itemPriceId: 'silver-USD-monthly' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `itemPriceId` | `string` | Yes | — |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `sort_by` | `object` | No | optional, string filter Sorts based on the specified attribute. **Supported attributes :** name, id, updated\_at **Supported sort-orders :** asc, desc **Example →** *sort\_by\\\[asc\\] = "name"* This will sort the result based on the 'name' attribute in ascending(earliest first) order. |

> [accordion] sort\_by full type
>
> ```ts theme={null}
> {
>   asc?: name | id | updated_at,
>   desc?: name | id | updated_at
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   item?: {
>     id?: string | null,
>     name?: string | null,
>     external_name?: string | null,
>     description?: string | null,
>     status?: string | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     item_family_id?: string | null,
>     type?: string | null,
>     is_shippable?: boolean | null,
>     is_giftable?: boolean | null,
>     redirect_url?: string | null,
>     enabled_for_checkout?: boolean | null,
>     enabled_in_portal?: boolean | null,
>     included_in_mrr?: boolean | null,
>     item_applicability?: string | null,
>     gift_claim_redirect_url?: string | null,
>     unit?: string | null,
>     metered?: boolean | null,
>     usage_calculation?: string | null,
>     is_percentage_pricing?: boolean | null,
>     archived_at?: number | null,
>     channel?: string | null,
>     metadata?: {
>     } | null,
>     deleted?: boolean | null,
>     business_entity_id?: string | null,
>     applicable_items?: {
>       id?: string | null
>     }[] | null,
>     bundle_items?: {
>       item_id?: string | null,
>       item_type?: string | null,
>       quantity?: number | null,
>       price_allocation?: number | null
>     }[] | null,
>     bundle_configuration?: {
>       type?: string | null
>     } | null
>   } | null
> }[] | null
> ```

***

### update

`itemPrices.update`

Update an item price. Updates an item price with the changes specified. Unspecified item price attributes are not modified.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.itemPrices.update({ itemPriceId: 'silver-USD-monthly' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `itemPriceId` | `string` | Yes | — |
| `name` | `string` | No | A unique display name for the item price in the Chargebee UI. If `external_name` is not provided, this is also used in customer-facing pages and documents such as [invoices](https://docs.corsair.dev/docs/api/invoices) and [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages) . |
| `description` | `string` | No | Description of the item price. **Note**: \* The description field supports up to 2000 characters, including HTML tags. The inner text (excluding HTML tags) must not exceed 500 characters. For example: `- testing - desc `. Total with tags: 38 characters, inner text: 'testing desc' (12 characters). \* If your input includes characters requiring sanitization, such as incomplete HTML tags, the sanitization process may alter the input and increase its length. If the sanitized content exceeds the allowed limit, the request will be rejected. |
| `proration_type` | `site_default \| partial_term \| full_term` | No | **Note** Applicable only for item prices with: \* [item\_type](https://docs.corsair.dev/docs/api/item_prices/item_price-object#item_type) = `addon`. \* [pricing\_model](https://docs.corsair.dev/docs/api/item_prices/item_price-object#pricing_model) = `per_unit`. Specifies how to manage charges or credits for the addon item price during a [subscription update](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) or [estimating](https://docs.corsair.dev/docs/api/estimates/estimate-for-updating-a-subscription) a subscription update. \* full\_term - Charge the full price of the addon item price or give the full credit. Don't apply any proration. \* site\_default - Use the [site-wide proration setting](https://www.chargebee.com/docs/2.0/proration.html#proration-for-subscription-change) . \* partial\_term - Prorate the charges or credits for the rest of the current term. |
| `price_variant_id` | `string` | No | An immutable unique identifier of a [price variant](https://docs.corsair.dev/docs/api/price_variants). |
| `status` | `active \| archived` | No | The status of the item price. \* archived - The item price is no longer active and cannot be used in new subscriptions or added to existing ones. Existing subscriptions that already have this item price will continue to renew with the item price. \* active - The item price can be used in subscriptions. |
| `external_name` | `string` | No | The name of the item price used in customer-facing pages and documents. These include [invoices](https://docs.corsair.dev/docs/api/invoices) and [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages). If not provided, then `name` is used. |
| `usage_accumulation_reset_frequency` | `never \| subscription_billing_frequency` | No | Specifies the frequency at which the usage counter needs to be reset. **Prerequisites** \* Usage accumulation across the contract period must be enabled for the site before providing `usage_accumulation_reset_frequency`. **Constraints** \* Applicable only to metered item prices that use the `tiered` pricing model. **Note:** Changes to the `usage_accumulation_reset_frequency` parameter are not allowed when the item price is already linked to a subscription. \* never - Accumulates usage without ever resetting it. \* subscription\_billing\_frequency - Accumulates usage until the subscription's billing frequency ends. |
| `currency_code` | `string` | No | The currency code ([ISO 4217 format](https://www.chargebee.com/docs/2.0/supported-currencies.html) ) for the item price. If subscriptions, invoices or [differential prices](https://docs.corsair.dev/docs/api/differential_prices) exist for this item price, `currency_code` cannot be changed. |
| `invoice_notes` | `string` | No | A customer-facing note added to all invoices associated with this API resource. This note becomes one among [all the notes](https://docs.corsair.dev/docs/api/invoices/invoice-object#notes) displayed on the invoice PDF. |
| `is_taxable` | `boolean` | No | Specifies whether taxes apply to this item price. This value is set and returned even if [Taxes](https://www.chargebee.com/docs/tax.html) have been disabled in Chargebee. However, the value is effective only while Taxes are enabled. |
| `free_quantity` | `number` | No | Free quantity the subscriptions of this **plan** `item_price` will have. Only the quantity exceeding this value will be charged in the subscription. **Note:** \* `free_quantity` is currently supported only for [plan](https://docs.corsair.dev/docs/api/items/item-object#type) `item_price`. \* `free_quantity` is not supported for the [Usage-Based Billing](https://www.chargebee.com/docs/2.0/understanding-usages.html) (UBB). All included or free quantities should be configured exclusively through [entitlements](https://docs.corsair.dev/docs/api/entitlements) . |
| `free_quantity_in_decimal` | `string` | No | The quantity of the item that is available free-of-charge, represented in decimal. When a subscription is created for this plan or when the plan of a subscription is changed to this one, only the quantity above this number is charged for. Applicable for quantity-based plans and only when [multi-decimal pricing](https://docs.corsair.dev/docs/api/currencies) is enabled. |
| `metadata` | `object` | No | A collection of key-value pairs that provides extra information about the item price. **Note:** There's a character limit of 65,535. [Learn more](https://docs.corsair.dev/docs/api/advanced-features#metadata) . |
| `pricing_model` | `flat_fee \| per_unit \| tiered \| volume \| stairstep` | No | The [pricing scheme](https://www.chargebee.com/docs/2.0/plans.html#pricing-models) for this item price. If subscriptions, invoices or [differential prices](https://docs.corsair.dev/docs/api/differential_prices) exist for this item price, `pricing_model` cannot be changed. \* tiered - There are quantity tiers for which per unit prices are set. Quantities are purchased from successive tiers. \* per\_unit - A fixed price per unit quantity. \* flat\_fee - A fixed price that is not quantity-based. \* volume - The per unit price is based on the tier that the total quantity falls in. \* stairstep - A quantity-based pricing scheme. The item is charged a fixed price based on the tier that the total quantity falls in. |
| `price` | `number` | No | The cost of the item price when the pricing model is `flat_fee`. When the pricing model is `per_unit` , it is the price per unit quantity of the item. Not applicable for the other pricing models. The value is in the [minor unit of the currency](https://docs.corsair.dev/docs/api/currencies) . |
| `price_in_decimal` | `string` | No | The price of the item when the pricing\_model is `flat_fee`. When the pricing model is `per_unit` , it is the price per unit quantity of the item. Not applicable for the other pricing models. The value is in decimal and in major units of the currency. Also, this is only applicable when [multi-decimal pricing](https://docs.corsair.dev/docs/api/currencies) is enabled. |
| `period_unit` | `day \| week \| month \| year` | No | The unit of time for `period`. If subscriptions or invoices exist for this item price, `period_unit` cannot be changed. The `period_unit` is mandatory when the item `type` is `plan` or `addon` . **Important:** The `period` + `period_unit` pair must match a *configured billing frequency* on your site. The API does not create new frequencies. To use a new frequency (for example, 3 months or 2 weeks), add it in the site settings first. Requests with non-configured combinations fail validation. \* Monthly: `period=1`, `period_unit=month` (available by default) \* Quarterly: `period=3`, `period_unit=month` (*enable 3-month frequency in settings*) \* Weekly: `period=1`, `period_unit=week` (available by default) See [how billing periods apply](https://www.chargebee.com/docs/billing/2.0/subscriptions/addons-billingcycle) . \* month - A period of 1 calendar month. \* week - A period of 7 days. \* year - A period of 1 calendar year. \* day - A period of 24 hours. |
| `period` | `number` | No | \* When the item `type` is `plan`: The billing period of the plan in `period_unit`s. For example, create a 6 month plan by providing `period` as 6 and `period_unit` as month. \* When item `type` is `addon`: The period of the addon in `period_unit`s. For example, create an addon with a 2 month `period` by providing period as 2 and `period_unit` as `month`. The period of an addon is the duration for which its `price` applies. When attached to a plan, the addon is billed for the billing period of the plan. [Learn more.](https://www.chargebee.com/docs/2.0/addons-billingcycle.html) If subscriptions or invoices exist for this item price, `period` cannot be changed. The `period` is mandatory when the item `type` is `plan` or `addon`. **Important:** The `period` value, together with `period_unit`, must equal one of your site's *configured billing frequencies* . If the combination does not exist, the request fails with an invalid billing period configuration error. Configure the frequency in site settings and retry. See [Addons and billing cycle](https://www.chargebee.com/docs/billing/2.0/subscriptions/addons-billingcycle). |
| `trial_period_unit` | `day \| month` | No | The unit of time for `trial_period` . \* month - A period of 1 calendar month. \* day - A period of 24 hours. |
| `trial_period` | `number` | No | The trial period of the plan in `trial_period_unit` s. You can also set [trial periods for addons](https://www.chargebee.com/docs/2.0/addons-trial.html) ; contact [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 that feature. |
| `shipping_period` | `number` | No | Defines the shipping frequency. Example: to bill customer every 2 weeks, provide "2" here. |
| `shipping_period_unit` | `day \| week \| month \| year` | No | Defines the shipping frequency in association with shipping period. \* day - A period of 24 hours. \* week - A period of 7 days. \* year - A period of 1 calendar year. \* month - A period of 1 calendar month. |
| `billing_cycles` | `number` | No | The default number of billing cycles a subscription to the plan must run. Can be [overridden](https://docs.corsair.dev/docs/api/subscriptions) for a subscription. Addons can also [have billing cycles](https://www.chargebee.com/docs/2.0/addons-billingcycle.html). Also, for addons, you can [override this](https://docs.corsair.dev/docs/api/attached_items) while attaching it to a plan. However, if you provide the value while [applying the addon to a subscription](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#subscription_items_item_type), then that value takes still higher precedence. If subscriptions, invoices or [differential prices](https://docs.corsair.dev/docs/api/differential_prices) exist for this item price, `billing_cycles` cannot be changed. **Note:** If you want to change the `billing_cycles` to unlimited renewals, enter an empty string. This value can only be updated if the `item_price` is not attached to a subscription or invoice. If no `billing_cycles` value is entered, then by default the value will be set as unlimited `billing_cycles` renewals. |
| `trial_end_action` | `site_default \| activate_subscription \| cancel_subscription` | No | Applicable only when [End-of-trial Action](https://www.chargebee.com/docs/2.0/trial_periods_hidden.html#how-to-define-the-end-of-trial-actions-for-subscriptions) has been enabled for the site. Specifies the operation to be carried out for the subscription once the trial ends. Whenever the `item.type` is `plan` and a trial period is defined for this item price, this attribute (parameter) is returned (required). This can be overridden at the [subscription-level](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#trial_end_action) . \* cancel\_subscription - The subscription cancels. \* activate\_subscription - The subscription activates and charges are raised for non-metered items. \* site\_default - The action [configured for the site](https://www.chargebee.com/docs/2.0/trial_periods_hidden.html#how-to-define-the-end-of-trial-actions-for-subscriptions) at the time when the trial ends, takes effect. |
| `show_description_in_invoices` | `boolean` | No | Whether the item price's description should be shown on [invoice PDFs](https://docs.corsair.dev/docs/api/invoices/retrieve-invoice-as-pdf). If this Boolean is changed, only invoices generated (or [regenerated](https://www.chargebee.com/docs/invoice-operations.html#actions-for-payment-due-not-paid-invoices_regenerate-invoice) ) after the change are affected; past invoices are not. |
| `show_description_in_quotes` | `boolean` | No | Whether the item price's description should be shown on [quote PDFs](https://docs.corsair.dev/docs/api/quotes/retrieve-quote-as-pdf). If this Boolean is changed, only quotes created after the change are affected; past quotes are not. |
| `tax_detail` | `object` | No | Parameters for tax\_detail |
| `accounting_detail` | `object` | No | Parameters for accounting\_detail |
| `tiers` | `object` | No | Parameters for tiers |
| `tax_providers_fields` | `object` | No | Parameters for tax\_providers\_fields |

> [accordion] metadata full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] tax\_detail full type
>
> ```ts theme={null}
> {
>   tax_profile_id?: string,
>   avalara_tax_code?: string,
>   hsn_code?: string,
>   avalara_sale_type?: wholesale | retail | consumed | vendor_use,
>   avalara_transaction_type?: number,
>   avalara_service_type?: number,
>   taxjar_product_code?: string
> }
> ```

> [accordion] accounting\_detail full type
>
> ```ts theme={null}
> {
>   sku?: string,
>   accounting_code?: string,
>   accounting_category1?: string,
>   accounting_category2?: string,
>   accounting_category3?: string,
>   accounting_category4?: string
> }
> ```

> [accordion] tiers full type
>
> ```ts theme={null}
> {
>   starting_unit?: number[],
>   ending_unit?: number[],
>   price?: number[],
>   starting_unit_in_decimal?: string[],
>   ending_unit_in_decimal?: string[],
>   price_in_decimal?: string[],
>   pricing_type?: (per_unit | flat_fee | package)[],
>   package_size?: number[]
> }
> ```

> [accordion] tax\_providers\_fields full type
>
> ```ts theme={null}
> {
>   provider_name: string[],
>   field_id: string[],
>   field_value: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `item_price` | `object \| null` | No | An item price is a price point for an item. It defines the currency, pricing model, price, billing period and other attributes for an [item](https://docs.corsair.dev/docs/api/items). For example, consider a cloud storage service as an item. Then each of the following defines an item price: \* The cloud storage sold at USD 10 per month. \* The same service sold at AUD 100 per year. \* The service sold at a monthly rate determined by the following [stairstep](https://www.chargebee.com/docs/2.0/plans.html#pricing-models) pricing model: \* 1-10 users for EUR 10 \* 11-25 users for EUR 20 \* 26-50 users for EUR 45 \* 51 and above for EUR 100 Types of item prices -------------------- The type of an item price corresponds to the [type of the item](https://docs.corsair.dev/docs/api/items) that the item price belongs to. In other words, item prices can be of the following types: \* Plan-item prices \* Addon-item prices \* Charge-item prices Billing periods for item prices ------------------------------- The **billing period** of an item price (applicable only to plan-item prices and addon-item prices) is the [`period`](https://docs.corsair.dev/docs/api/item_prices/item-price-object#period) of the item price in [`period_unit`](https://docs.corsair.dev/docs/api/item_prices/item-price-object#period_unit)s. \* When [price variants](https://docs.corsair.dev/docs/api/price_variants) are **not** enabled, an item can have only one item price for a given currency and billing period. \* When price variants **are** enabled, an item can have multiple item prices for the same currency and billing period, as long as each has a distinct [`price_variant_id`](https://docs.corsair.dev/docs/api/item_prices/item-price-object#price_variant_id). An item price created without a `price_variant_id` is treated as the default ("no variant"), and only one such default item price can exist for a given currency and billing period. |

> [accordion] item\_price full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   item_family_id?: string | null,
>   item_id?: string | null,
>   description?: string | null,
>   status?: string | null,
>   external_name?: string | null,
>   price_variant_id?: string | null,
>   price_ramp_id?: string | null,
>   proration_type?: string | null,
>   pricing_model?: string | null,
>   price?: number | null,
>   price_in_decimal?: string | null,
>   period?: number | null,
>   currency_code?: string | null,
>   period_unit?: string | null,
>   trial_period?: number | null,
>   trial_period_unit?: string | null,
>   trial_end_action?: string | null,
>   shipping_period?: number | null,
>   shipping_period_unit?: string | null,
>   billing_cycles?: number | null,
>   free_quantity?: number | null,
>   free_quantity_in_decimal?: string | null,
>   channel?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   usage_accumulation_reset_frequency?: string | null,
>   archived_at?: number | null,
>   invoice_notes?: string | null,
>   is_taxable?: boolean | null,
>   metadata?: {
>   } | null,
>   item_type?: string | null,
>   show_description_in_invoices?: boolean | null,
>   show_description_in_quotes?: boolean | null,
>   deleted?: boolean | null,
>   business_entity_id?: string | null,
>   tiers?: {
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   tax_detail?: {
>     tax_profile_id?: string | null,
>     avalara_sale_type?: string | null,
>     avalara_transaction_type?: number | null,
>     avalara_service_type?: number | null,
>     avalara_tax_code?: string | null,
>     hsn_code?: string | null,
>     taxjar_product_code?: string | null
>   } | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   accounting_detail?: {
>     sku?: string | null,
>     accounting_code?: string | null,
>     accounting_category1?: string | null,
>     accounting_category2?: string | null,
>     accounting_category3?: string | null,
>     accounting_category4?: string | null
>   } | null
> } | null
> ```

***

## Items

### create

`items.create`

Create an item. Creates a new item. (POST /items)

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.items.create({
	id: 'cust_8gsnbYfsMLds',
	item_family_id: 'example',
	name: 'example',
	type: 'plan',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `id` | `string` | Yes | The identifier for the item. Must be unique and is immutable once set. |
| `name` | `string` | Yes | A unique display name for the item. Must be unique. This is visible only in Chargebee and not to customers. |
| `type` | `plan \| addon \| charge` | Yes | The type of the item. \* plan - An essential component of a subscription. Every subscription has exactly one plan. It has a recurring charge and its period defines the billing period of the subscription. \* charge - A non-recurring component that can be added to a subscription in addition to its plan. An charge can also be applied to a customer [directly](https://docs.corsair.dev/docs/api/v2/pcv-1/invoices/create-invoice-for-a-one-time-charge) without being applied to a subscription. \* addon - A recurring component that can be added to a subscription in addition to its plan. |
| `description` | `string` | No | Description of the item. This is visible only in Chargebee and not to customers. |
| `item_family_id` | `string` | Yes | The `id` of the [Item family](https://docs.corsair.dev/docs/api/item_families) that the item belongs to. Is mandatory when [Product Families](https://www.chargebee.com/docs/2.0/product-families.html) have been enabled. |
| `is_giftable` | `boolean` | No | Specifies if gift subscriptions can be created for this item. |
| `is_shippable` | `boolean` | No | Indicates that the item is a physical product. If Orders are enabled in Chargebee, subscriptions created for this item will have orders associated with them. |
| `external_name` | `string` | No | A unique display name for the item. |
| `enabled_in_portal` | `boolean` | No | Allow customers to change their subscription to this plan via the [Self-Serve Portal](https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html). Applies only for plan-items. This requires the Portal configuration to [allow changing subscriptions](https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html#allow-change-subscription). Only the in-app version of the Portal is supported for Product Catalog v2. |
| `redirect_url` | `string` | No | If `enabled_for_checkout` , then the URL to be redirected to once the checkout is complete. This attribute is only available for plan-items. |
| `enabled_for_checkout` | `boolean` | No | Allow the plan to subscribed to via Checkout. Applies only for plan-items. **Note:** Only the in-app layout of Checkout is supported. |
| `item_applicability` | `all \| restricted` | No | Indicates which addon-items and charge-items can be applied to the item. Only possible for plan-items. Other details of attaching items such as whether to attach as a mandatory item or to attach on a certain event, can be specified using the [Create](https://docs.corsair.dev/docs/api/attached_items/create-an-attached-item) or [Update an attached item](https://docs.corsair.dev/docs/api/attached_items/update-an-attached-item) API. \* all - all addon-items and charge-items are applicable to this plan-item. \* restricted - only the addon-items or charge-items provided in `applicable_items` can be applied to this plan-item. |
| `applicable_items` | `string[]` | No | The list of ids of addon-items and charge-items that can be applied to the plan-item. This parameter can be provided only for plan-items and that too when item\_applicability is restricted. Other details of attaching items can be specified using the [Create](https://docs.corsair.dev/docs/api/attached_items/create-an-attached-item) or [Update an attached item](https://docs.corsair.dev/docs/api/attached_items/update-an-attached-item) API. |
| `unit` | `string` | No | The unit of measure for a quantity-based item. This is displayed on the Chargebee UI and on customer facing documents/pages. The latter includes [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages) , [invoices](https://docs.corsair.dev/docs/api/invoices) and [quotes](https://docs.corsair.dev/docs/api/quotes). Examples follow: \* "user" for a cloud-collaboration platform. \* "GB" for a data service. \* "issue" for a magazine. |
| `gift_claim_redirect_url` | `string` | No | The URL to redirect to once the gift has been claimed by the receiver. |
| `included_in_mrr` | `boolean` | No | The item is included in MRR calculations for your site. This attribute is only applicable for items of `type = charge` and when the feature is enabled in Chargebee. Note: If the site-level setting is to exclude charge-items from MRR calculations, this value is always returned `false` . |
| `metered` | `boolean` | No | Specifies whether the item undergoes usage-based or metered billing. [Usage Based Billing](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/understanding-usages) or [Metered Billing](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing) must be enabled on your site to set `metered` to `true`. **Usage Based Billing** When Usage Based Billing is enabled, `metered` is applicable only for items of `type` `addon`. When `true`, the quantity is calculated from [usage events](https://docs.corsair.dev/docs/api/usage_events/create-a-usage-event). When `false`, you must provide the quantity when adding an [item price](https://docs.corsair.dev/docs/api/item_prices) that belongs to this item to a subscription (for example, when [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items#subscription_items_quantity) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#subscription_items_quantity) the subscription). **Metered Billing** When Metered Billing is enabled, `metered` is applicable only for items of `type` `plan` or `addon`. When `true`, the quantity is calculated from [usage records](https://docs.corsair.dev/docs/api/usages). When `false`, you must provide the quantity when adding an [item price](https://docs.corsair.dev/docs/api/item_prices) that belongs to this item to a subscription (for example, when [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items#subscription_items_quantity) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#subscription_items_quantity) the subscription). |
| `usage_calculation` | `sum_of_usages \| last_usage \| max_usage` | No | How the quantity is calculated from usage data for the item prices belonging to this item. Only applicable when the item is `metered`. This value overrides the one [set at the site level](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing). . \* sum\_of\_usages - the net quantity is the sum of the `quantity` of all usages for the current term. \* last\_usage - from among the usage records for the [item price](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#subscription_items_item_price_id) with `usage_date` within the relevant billing period, the `quantity` of the usage record with the most recent `usage_date` is taken as the net quantity consumed. \* max\_usage - from among the usage records for the [item price](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#subscription_items_item_price_id) with `usage_date` within the relevant billing period, the `quantity` of the usage record with the maximum value is taken as the net quantity consumed. |
| `is_percentage_pricing` | `boolean` | No | Indicates whether the pricing is percentage-based. |
| `metadata` | `object` | No | A collection of key-value pairs that provides extra information about the item. **Note:** There's a character limit of 65,535. [Learn more](https://docs.corsair.dev/docs/api/advanced-features#metadata). |
| `business_entity_id` | `string` | No | The unique ID of the [business entity](https://docs.corsair.dev/docs/api/business_entities) for this `item`. This is applicable only when multiple business entities have been created for the site. When provided, the operation will read or write data associated with the specified business entity. If not provided, the resource will be created at the site level, and the `business_entity_id` will not be included in the API response. **Note** An alternative way of passing this parameter is by means of a [custom HTTP header](https://docs.corsair.dev/docs/api/advanced-features#mbe-header-main). |
| `bundle_configuration` | `object` | No | Parameters of `bundle_configuration` |
| `bundle_items_to_add` | `object` | No | Parameters for `bundle_items_to_add` |

> [accordion] metadata full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] bundle\_configuration full type
>
> ```ts theme={null}
> {
>   type?: fixed
> }
> ```

> [accordion] bundle\_items\_to\_add full type
>
> ```ts theme={null}
> {
>   item_id?: string[],
>   item_type?: (plan | addon | charge)[],
>   quantity?: number[],
>   price_allocation?: number[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `item` | `object \| null` | No | When offering subscriptions of products or services, each entity that is made available for sale is represented by an "item" object. Items therefore represent the various plans, addons or charges that you offer as part of your product catalog. Non-`metered` items are charged upfront in Chargebee, while `metered` items are charged at the end of the billing cycle, based on usage. ### Types of Items There are three types of items and they're listed and explained here. Examples for each type are provided in the table that follows. #### Plan-items or Plans Plan-items are items that have a recurring charge and are an essential component of any [subscription](https://docs.corsair.dev/docs/api/subscriptions). Typically, plans represent a principal or key product or service in your catalog. They are charged at recurring intervals and often have other products or services offered along with them as addons and charges. #### Addon-items or Addons Addon-items are items that are sold along with a plan and are charged for at recurring intervals. #### Charge-items or Charges Charge-items are items that are sold along with a plan but charged once (or each time) a specified event occurs. A charge can also be [applied to a customer](https://docs.corsair.dev/docs/api/v2/pcv-1/invoices/create-invoice-for-a-one-time-charge) without attaching to a subscription. #### Examples To help understand each type of item better, listed below are some examples of items from different business domains: ##### Non-Metered (SaaS) \* **Item Family:** A project management solution. \* **Plans:** \* A "basic" plan offering a small set of features. \* A "business" plan offering a larger set of features. \* **Addons:** \* An analytics plugin that is available only with the "business" plan. \* A reporting plugin, available with both the above plans. \* **Charges:** \* Implementation charges. \* Trial charges. ##### Non-Metered (E-commerce) \* **Item Family:** A printed news magazine. \* **Plans:** \* Periodic issues of the magazine. \* Periodic issues of the magazine, with digital content. \* **Addons:** \* Supplementary online content. \* Access to a year's worth of back issues. \* Searchable access to all back issues. \* **Charges:** \* Special edition books that are published every so often. ##### Metered \* **Item Family:** SMS delivery services. \* **Plans:** \* A basic plan of up to 100K messages @ $0.03 per message. * A volume plan of 2M messages @ $0.01 per message. \* **Addons:** \* An addon of 50K MMS messages @ \$0.1 per message. \* Instant messaging. \* **Charges:** \* Automated Metered Billing is not applicable for charges. |

> [accordion] item full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   external_name?: string | null,
>   description?: string | null,
>   status?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   item_family_id?: string | null,
>   type?: string | null,
>   is_shippable?: boolean | null,
>   is_giftable?: boolean | null,
>   redirect_url?: string | null,
>   enabled_for_checkout?: boolean | null,
>   enabled_in_portal?: boolean | null,
>   included_in_mrr?: boolean | null,
>   item_applicability?: string | null,
>   gift_claim_redirect_url?: string | null,
>   unit?: string | null,
>   metered?: boolean | null,
>   usage_calculation?: string | null,
>   is_percentage_pricing?: boolean | null,
>   archived_at?: number | null,
>   channel?: string | null,
>   metadata?: {
>   } | null,
>   deleted?: boolean | null,
>   business_entity_id?: string | null,
>   applicable_items?: {
>     id?: string | null
>   }[] | null,
>   bundle_items?: {
>     item_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     price_allocation?: number | null
>   }[] | null,
>   bundle_configuration?: {
>     type?: string | null
>   } | null
> } | null
> ```

***

### createAttachedItem

`items.createAttachedItem`

Create an attached item. Creates an attached addon or a charge item for a plan.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.items.createAttachedItem({ itemId: 'silver', item_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `itemId` | `string` | Yes | — |
| `item_id` | `string` | Yes | The id of the addon or charge that is being attached to the plan-item. |
| `type` | `recommended \| mandatory \| optional` | No | The type of attachment for the addon. Only applicable for addon-items and is a required parameter as well for addon-items. \* recommended - The addon is recommended to go with the plan-item when using [Checkout](https://www.chargebee.com/docs/2.0/configure-inapp.html#fundamental-settings_recommending-addons-in-checkout) or [Portal](https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html#allow-change-subscription) . \* optional - The addon is neither mandatory, nor recommended. This allows you to attach an addon so you can specify a `quantity` and `billing_cycles` for the addon, for when it is applied to subscriptions with the plan. \* mandatory - The addon is attached automatically to the subscription for the plan-item unless [explicitly removed](https://docs.corsair.dev/docs/api/subscriptions) via API. |
| `billing_cycles` | `number` | No | The number of subscription billing cycles for which this item is attached when applied to a subscription. Applicable only for items of type addon. Requires [addon billing cycles](https://www.chargebee.com/docs/2.0/addons-billingcycle.html) to be enabled for the site. The value set explicitly for `billing_cycles` while [applying the addon to a subscription](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#subscription_items) takes precedence over this parameter. This parameter, in turn, has a higher precedence than [the value set for the addon-item price](https://docs.corsair.dev/docs/api/item_prices) . |
| `quantity` | `number` | No | The default quantity of the addon to be attached when the quantity is not specified while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) /[updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) the subscription. |
| `quantity_in_decimal` | `string` | No | The decimal representation of the quantity of the addon. Returned for quantity-based addons when [multi-decimal pricing](https://docs.corsair.dev/docs/api/getting-started) is enabled. |
| `charge_on_event` | `subscription_creation \| subscription_trial_start \| plan_activation \| subscription_activation \| contract_termination \| on_demand` | No | Indicates when the item is charged. This parameter only applies to charge-items. \* contract\_termination - when a contract term is [terminated](https://docs.corsair.dev/docs/api/subscriptions/cancel-subscription-for-items#contract_term_cancel_option) . \* subscription\_creation - the time of creation of the subscription. \* subscription\_trial\_start - the time when the trial period of the subscription begins. \* on\_demand - Item can be charged on demand \* 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. |
| `charge_once` | `boolean` | No | 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. |
| `business_entity_id` | `string` | No | The unique ID of the [business entity](https://docs.corsair.dev/docs/api/business_entities) for this `attached_item`. This is applicable only when multiple business entities have been created for the site. When provided, the operation will read or write data associated with the specified business entity. If not provided, the resource will be created at the site level, and the `business_entity_id` will not be included in the API response. **Note** : An alternative way of passing this parameter is by using a [custom HTTP header](https://docs.corsair.dev/docs/api/advanced-features) or [query string parameter](https://docs.corsair.dev/docs/api/advanced-features#mbe-alternative). |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `attached_item` | `object \| null` | No | Addon-item and charge-item prices are purchased with plan-item prices in subscriptions. You can automate this process by configuring certain addons and charges as "attached" to certain plans. This is done at the "item" level. In other words, addon- and charge-items can be attached to plan-items. Once the attachment is defined, while creating or updating a subscription, the addon- or charge-item prices are selected automatically based on the plan-item price selected . Let's look at the details: ### Addons Addons can be attached to plans as `recommended`, `mandatory` or `optional`. \* When an addon is attached as `recommended` for a plan, the addon is suggested to be applied to subscriptions for the plan in [Checkout](https://www.chargebee.com/docs/2.0/configure-inapp.html#fundamental-settings_recommending-addons-in-checkout) and [Self-Serve Portal](https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html#allow-change-subscription). Alternatively, if you build your own payment pages or have a sales team, you can suggest recommended addons to your customers or salespeople on your website or CRM respectively \* When an addon is attached as `mandatory` for a plan, the addon gets applied to subscriptions for the plan compulsorily, unless [removed explicitly](https://docs.corsair.dev/docs/api/subscriptions). If you do not pass an item price for a mandatory addon when including the plan in a subscription, an addon-item price is automatically applied as explained below. \* Attaching an addon as `optional` neither marks it as recommended or mandatory but allows you a way to set a `quantity` and `billing_cycles` for the addon, for when it is applied to subscriptions with the plan. How auto-selection of the addon-item price works ------------------------------------------------ Once an addon has been attached as mandatory, the addon-item price to be applied to the plan-item price is selected based on the following rule: The addon-item price with the same currency as that of the plan-item price and the longest compatible period is selected. Here's an example: Consider a plan **Standard Cloud Storage** has an addon **Extra Storage** attached to it. Note that each of the two are items. Now consider that they have item prices with the following periods and currencies: **Item price for "Standard Cloud Storage" plan-item:** \* Standard Cloud Storage, 3 years, AUD. **Item prices for "Extra Storage" addon-item:** \* Extra Storage, 1 year, EUR. \* Extra Storage, 1 year, USD. \* Extra Storage, 1 year, AUD. \* Extra Storage, 18 months, AUD. \* Extra Storage, 2 years, AUD. \* Extra Storage, 30 months, AUD. For the plan-item price (Standard Cloud Storage, 3 years, AUD), the addon-item prices with matching currencies are the last 4 from the above list: \* Extra Storage, 1 year, AUD. \* Extra Storage, 18 months, AUD. \* Extra Storage, 2 years, AUD. \* Extra Storage, 30 months, AUD. From among them, the last two have periods that are incompatible with the plan-item price period of 3 years. From the remaining 2 addon-item prices, the one with the longest period is of 18 months. So, "Extra Storage, 18 months, AUD" is selected for mandatory application to the plan item price. ### Charges Charges can also be attached to plans. When doing so, you specify [the event](https://docs.corsair.dev/docs/api/attached_items/attached_item-object#charge_on_event) at which the charge is to be applied to the subscription. For some events that can occur multiple times in a subscription lifetime, you can also set whether to apply the charge each time the event occurs or just once. There may be multiple item prices for a given attached charge. The item price that matches the currency of the plan-item price is automatically selected for application. Here's an example: Consider a plan **Standard Cloud Storage** has a charge named **Implementation Fee** attached to it. Now consider their item prices below, with the following periods and currencies: **Item price for "Standard Cloud Storage" plan-item:** \* Standard Cloud Storage, 3 years, AUD. **Item prices for "Implementation Fee" charge-item:** \* Implementation Fee, USD. \* Implementation Fee, AUD. \* Implementation Fee, EUR. From among the charge-item prices above, the one compatible with the plan-item price is "Implementation Fee, AUD" since it has the same currency as the plan-item price. |

> [accordion] attached\_item full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   parent_item_id?: string | null,
>   item_id?: string | null,
>   type?: string | null,
>   status?: string | null,
>   quantity?: number | null,
>   quantity_in_decimal?: string | null,
>   billing_cycles?: number | null,
>   charge_on_event?: string | null,
>   charge_once?: boolean | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null
> } | null
> ```

***

### delete

`items.delete`

Delete an item. Deletes an item, marking its status as deleted. This is not allowed if there are active or archived item prices under the item. Once deleted, the id and name of the item can be reused.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.items.delete({ itemId: 'silver' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `itemId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `item` | `object \| null` | No | When offering subscriptions of products or services, each entity that is made available for sale is represented by an "item" object. Items therefore represent the various plans, addons or charges that you offer as part of your product catalog. Non-`metered` items are charged upfront in Chargebee, while `metered` items are charged at the end of the billing cycle, based on usage. ### Types of Items There are three types of items and they're listed and explained here. Examples for each type are provided in the table that follows. #### Plan-items or Plans Plan-items are items that have a recurring charge and are an essential component of any [subscription](https://docs.corsair.dev/docs/api/subscriptions). Typically, plans represent a principal or key product or service in your catalog. They are charged at recurring intervals and often have other products or services offered along with them as addons and charges. #### Addon-items or Addons Addon-items are items that are sold along with a plan and are charged for at recurring intervals. #### Charge-items or Charges Charge-items are items that are sold along with a plan but charged once (or each time) a specified event occurs. A charge can also be [applied to a customer](https://docs.corsair.dev/docs/api/v2/pcv-1/invoices/create-invoice-for-a-one-time-charge) without attaching to a subscription. #### Examples To help understand each type of item better, listed below are some examples of items from different business domains: ##### Non-Metered (SaaS) \* **Item Family:** A project management solution. \* **Plans:** \* A "basic" plan offering a small set of features. \* A "business" plan offering a larger set of features. \* **Addons:** \* An analytics plugin that is available only with the "business" plan. \* A reporting plugin, available with both the above plans. \* **Charges:** \* Implementation charges. \* Trial charges. ##### Non-Metered (E-commerce) \* **Item Family:** A printed news magazine. \* **Plans:** \* Periodic issues of the magazine. \* Periodic issues of the magazine, with digital content. \* **Addons:** \* Supplementary online content. \* Access to a year's worth of back issues. \* Searchable access to all back issues. \* **Charges:** \* Special edition books that are published every so often. ##### Metered \* **Item Family:** SMS delivery services. \* **Plans:** \* A basic plan of up to 100K messages @ $0.03 per message. * A volume plan of 2M messages @ $0.01 per message. \* **Addons:** \* An addon of 50K MMS messages @ \$0.1 per message. \* Instant messaging. \* **Charges:** \* Automated Metered Billing is not applicable for charges. |

> [accordion] item full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   external_name?: string | null,
>   description?: string | null,
>   status?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   item_family_id?: string | null,
>   type?: string | null,
>   is_shippable?: boolean | null,
>   is_giftable?: boolean | null,
>   redirect_url?: string | null,
>   enabled_for_checkout?: boolean | null,
>   enabled_in_portal?: boolean | null,
>   included_in_mrr?: boolean | null,
>   item_applicability?: string | null,
>   gift_claim_redirect_url?: string | null,
>   unit?: string | null,
>   metered?: boolean | null,
>   usage_calculation?: string | null,
>   is_percentage_pricing?: boolean | null,
>   archived_at?: number | null,
>   channel?: string | null,
>   metadata?: {
>   } | null,
>   deleted?: boolean | null,
>   business_entity_id?: string | null,
>   applicable_items?: {
>     id?: string | null
>   }[] | null,
>   bundle_items?: {
>     item_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     price_allocation?: number | null
>   }[] | null,
>   bundle_configuration?: {
>     type?: string | null
>   } | null
> } | null
> ```

***

### get

`items.get`

Retrieve an item. resource. (GET /items/\{item-id})

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.items.get({ itemId: 'silver' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `itemId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `item` | `object \| null` | No | When offering subscriptions of products or services, each entity that is made available for sale is represented by an "item" object. Items therefore represent the various plans, addons or charges that you offer as part of your product catalog. Non-`metered` items are charged upfront in Chargebee, while `metered` items are charged at the end of the billing cycle, based on usage. ### Types of Items There are three types of items and they're listed and explained here. Examples for each type are provided in the table that follows. #### Plan-items or Plans Plan-items are items that have a recurring charge and are an essential component of any [subscription](https://docs.corsair.dev/docs/api/subscriptions). Typically, plans represent a principal or key product or service in your catalog. They are charged at recurring intervals and often have other products or services offered along with them as addons and charges. #### Addon-items or Addons Addon-items are items that are sold along with a plan and are charged for at recurring intervals. #### Charge-items or Charges Charge-items are items that are sold along with a plan but charged once (or each time) a specified event occurs. A charge can also be [applied to a customer](https://docs.corsair.dev/docs/api/v2/pcv-1/invoices/create-invoice-for-a-one-time-charge) without attaching to a subscription. #### Examples To help understand each type of item better, listed below are some examples of items from different business domains: ##### Non-Metered (SaaS) \* **Item Family:** A project management solution. \* **Plans:** \* A "basic" plan offering a small set of features. \* A "business" plan offering a larger set of features. \* **Addons:** \* An analytics plugin that is available only with the "business" plan. \* A reporting plugin, available with both the above plans. \* **Charges:** \* Implementation charges. \* Trial charges. ##### Non-Metered (E-commerce) \* **Item Family:** A printed news magazine. \* **Plans:** \* Periodic issues of the magazine. \* Periodic issues of the magazine, with digital content. \* **Addons:** \* Supplementary online content. \* Access to a year's worth of back issues. \* Searchable access to all back issues. \* **Charges:** \* Special edition books that are published every so often. ##### Metered \* **Item Family:** SMS delivery services. \* **Plans:** \* A basic plan of up to 100K messages @ $0.03 per message. * A volume plan of 2M messages @ $0.01 per message. \* **Addons:** \* An addon of 50K MMS messages @ \$0.1 per message. \* Instant messaging. \* **Charges:** \* Automated Metered Billing is not applicable for charges. |

> [accordion] item full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   external_name?: string | null,
>   description?: string | null,
>   status?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   item_family_id?: string | null,
>   type?: string | null,
>   is_shippable?: boolean | null,
>   is_giftable?: boolean | null,
>   redirect_url?: string | null,
>   enabled_for_checkout?: boolean | null,
>   enabled_in_portal?: boolean | null,
>   included_in_mrr?: boolean | null,
>   item_applicability?: string | null,
>   gift_claim_redirect_url?: string | null,
>   unit?: string | null,
>   metered?: boolean | null,
>   usage_calculation?: string | null,
>   is_percentage_pricing?: boolean | null,
>   archived_at?: number | null,
>   channel?: string | null,
>   metadata?: {
>   } | null,
>   deleted?: boolean | null,
>   business_entity_id?: string | null,
>   applicable_items?: {
>     id?: string | null
>   }[] | null,
>   bundle_items?: {
>     item_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     price_allocation?: number | null
>   }[] | null,
>   bundle_configuration?: {
>     type?: string | null
>   } | null
> } | null
> ```

***

### list

`items.list`

List items. Returns a list of items satisfying all the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order. ### Use Cases ##### Filter by custom fields Note: Custom field filters are turned off by default.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.items.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `id` | `object` | No | optional, string filter Filter items based on item id. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *id\\\[is\\] = "basic"* |
| `item_family_id` | `object` | No | optional, string filter Filter items based on `item_family_id` . **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *item\_family\_id\\\[is\\] = "acme"* |
| `type` | `object` | No | optional, enumerated string filter Filter items based on item `type`. Possible values are : plan, addon, charge. **Supported operators :** is, is\_not, in, not\_in **Example →** *type\\\[is\\] = "plan"* |
| `name` | `object` | No | optional, string filter Filter items based on item `name` . **Supported operators :** is, is\_not, starts\_with **Example →** *name\\\[is\_not\\] = "basic"* |
| `item_applicability` | `object` | No | optional, enumerated string filter Filter items based on `item_applicability`. Possible values are : all, restricted. **Supported operators :** is, is\_not, in, not\_in **Example →** *item\_applicability\\\[is\_not\\] = "all"* |
| `status` | `object` | No | optional, enumerated string filter Filter items based on item `status`. Possible values are : active, archived. **Supported operators :** is, is\_not, in, not\_in **Example →** *status\\\[is\\] = "active"* |
| `is_giftable` | `object` | No | optional, boolean filter Specifies if gift subscriptions can be created for this item. Possible values are : *true, false* **Supported operators :** is **Example →** *is\_giftable\\\[is\\] = "true"* |
| `updated_at` | `object` | No | optional, timestamp(UTC) in seconds filter Filter items based on when the items were last updated. **Supported operators :** after, before, on, between **Example →** *updated\_at\\\[after\\] = "1243545465"* |
| `enabled_for_checkout` | `object` | No | optional, boolean filter Allow the plan to subscribed to via Checkout. Applies only for plan-items. **Note:** Only the in-app layout of Checkout is supported. Possible values are : *true, false* **Supported operators :** is **Example →** *enabled\_for\_checkout\\\[is\\] = "null"* |
| `enabled_in_portal` | `object` | No | optional, boolean filter Allow customers to change their subscription to this plan via the [Self-Serve Portal](https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html). Applies only for plan-items. This requires the Portal configuration to [allow changing subscriptions](https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html#allow-change-subscription). Possible values are : *true, false* **Supported operators :** is **Example →** *enabled\_in\_portal\\\[is\\] = "null"* |
| `metered` | `object` | No | optional, boolean filter Specifies whether the item undergoes metered billing. When `true`, the quantity is calculated from [usage records](https://docs.corsair.dev/docs/api/usages). When `false`, the `quantity` is as determined while adding an item price to the subscription. Applicable only for items of `type` `plan` or `addon` and when [Metered Billing](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing) is enabled. The value of this attribute cannot be changed. Possible values are : *true, false* **Supported operators :** is **Example →** *metered\\\[is\\] = "true"* |
| `usage_calculation` | `object` | No | optional, enumerated string filter How the quantity is calculated from usage data for the item prices belonging to this item. Only applicable when the item is `metered`. This value overrides the one [set at the site level](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing). Possible values are : sum\_of\_usages, last\_usage, max\_usage. **Supported operators :** is, is\_not, in, not\_in **Example →** *usage\_calculation\\\[is\_not\\] = "SUM\_OF\_USAGES"* |
| `channel` | `object` | No | optional, enumerated string filter The subscription channel this object originated from and is maintained in. Possible values are : web, app\_store, play\_store. **Supported operators :** is, is\_not, in, not\_in **Example →** *channel\\\[is\\] = "APP STORE"* |
| `business_entity_id` | `object` | No | optional, string filter The unique ID of the [business entity](https://docs.corsair.dev/docs/api/business_entities) of this `item`. [Learn more](https://docs.corsair.dev/docs/api/using_business_entity_filters_in_product_catalog_list_apis) about all the scenarios before using this filter. **Supported operators :** is, is\_present **Example →** *business\_entity\_id\\\[is\_present\\] = "true"* |
| `include_site_level_resources` | `object` | No | optional, boolean filter Default value is `true` . To exclude site-level resources in [specific cases](), set this parameter to `false`. Possible values are : *true, false* **Supported operators :** is **Example →** *include\_site\_level\_resources\\\[is\\] = "null"* |
| `sort_by` | `object` | No | optional, string filter Sorts based on the specified attribute. **Supported attributes :** name, id, updated\_at **Supported sort-orders :** asc, desc **Example →** *sort\_by\\\[asc\\] = "name"* This will sort the result based on the 'name' attribute in ascending(earliest first) order. |
| `bundle_configuration` | `object` | No | Parameters of `bundle_configuration` |

> [accordion] id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] item\_family\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] type full type
>
> ```ts theme={null}
> {
>   is?: plan | addon | charge,
>   is_not?: plan | addon | charge,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] name full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string
> }
> ```

> [accordion] item\_applicability full type
>
> ```ts theme={null}
> {
>   is?: all | restricted,
>   is_not?: all | restricted,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] status full type
>
> ```ts theme={null}
> {
>   is?: active | archived | deleted,
>   is_not?: active | archived | deleted,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] is\_giftable full type
>
> ```ts theme={null}
> {
>   is?: true | false
> }
> ```

> [accordion] updated\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] enabled\_for\_checkout full type
>
> ```ts theme={null}
> {
>   is?: true | false
> }
> ```

> [accordion] enabled\_in\_portal full type
>
> ```ts theme={null}
> {
>   is?: true | false
> }
> ```

> [accordion] metered full type
>
> ```ts theme={null}
> {
>   is?: true | false
> }
> ```

> [accordion] usage\_calculation full type
>
> ```ts theme={null}
> {
>   is?: sum_of_usages | last_usage | max_usage,
>   is_not?: sum_of_usages | last_usage | max_usage,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] channel full type
>
> ```ts theme={null}
> {
>   is?: web | app_store | play_store,
>   is_not?: web | app_store | play_store,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] business\_entity\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_present?: true | false
> }
> ```

> [accordion] include\_site\_level\_resources full type
>
> ```ts theme={null}
> {
>   is?: true | false
> }
> ```

> [accordion] sort\_by full type
>
> ```ts theme={null}
> {
>   asc?: name | id | updated_at,
>   desc?: name | id | updated_at
> }
> ```

> [accordion] bundle\_configuration full type
>
> ```ts theme={null}
> {
>   type?: {
>     is?: fixed,
>     is_not?: fixed,
>     in?: string,
>     not_in?: string
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   item?: {
>     id?: string | null,
>     name?: string | null,
>     external_name?: string | null,
>     description?: string | null,
>     status?: string | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     item_family_id?: string | null,
>     type?: string | null,
>     is_shippable?: boolean | null,
>     is_giftable?: boolean | null,
>     redirect_url?: string | null,
>     enabled_for_checkout?: boolean | null,
>     enabled_in_portal?: boolean | null,
>     included_in_mrr?: boolean | null,
>     item_applicability?: string | null,
>     gift_claim_redirect_url?: string | null,
>     unit?: string | null,
>     metered?: boolean | null,
>     usage_calculation?: string | null,
>     is_percentage_pricing?: boolean | null,
>     archived_at?: number | null,
>     channel?: string | null,
>     metadata?: {
>     } | null,
>     deleted?: boolean | null,
>     business_entity_id?: string | null,
>     applicable_items?: {
>       id?: string | null
>     }[] | null,
>     bundle_items?: {
>       item_id?: string | null,
>       item_type?: string | null,
>       quantity?: number | null,
>       price_allocation?: number | null
>     }[] | null,
>     bundle_configuration?: {
>       type?: string | null
>     } | null
>   } | null
> }[] | null
> ```

***

### listAttachedItems

`items.listAttachedItems`

List attached items. Returns a list of attached items satisfying all the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order (latest first).

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.items.listAttachedItems({ itemId: 'silver' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `itemId` | `string` | Yes | — |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `id` | `object` | No | optional, string filter Filter attached items based on their id. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *id\\\[is\\] = "bec0c324-adb6-44d3-ad4f-694f449be97c"* |
| `item_id` | `object` | No | optional, string filter Filter attached items based on the `item_id` of the item being attached. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *item\_id\\\[is\\] = "basic"* |
| `type` | `object` | No | optional, enumerated string filter Filter attached items based on the `type` of attached item. Possible values are : `recommended` , `mandatory` , `optional`. Possible values are : recommended, mandatory, optional. **Supported operators :** is, is\_not, in, not\_in **Example →** *type\\\[is\\] = "mandatory"* |
| `item_type` | `object` | No | optional, enumerated string filter To filter based on the type of of the attached item. Possible values are : `addon` , `charge`. Possible values are : plan, addon, charge. **Supported operators :** is, is\_not, in, not\_in **Example →** *item\_type\\\[is\_not\\] = "plan"* |
| `charge_on_event` | `object` | No | optional, enumerated string filter Indicates when the item is charged. This attribute only applies to charge-items. Possible values are : subscription\_creation, subscription\_trial\_start, plan\_activation, subscription\_activation, contract\_termination, on\_demand. **Supported operators :** is, is\_not, in, not\_in **Example →** *charge\_on\_event\\\[is\\] = "subscription\_creation"* |
| `updated_at` | `object` | No | optional, timestamp(UTC) in seconds filter Filter attached items based on when the attached items were last updated. **Supported operators :** after, before, on, between **Example →** *updated\_at\\\[after\\] = "1243545465"* |

> [accordion] id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] item\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] type full type
>
> ```ts theme={null}
> {
>   is?: recommended | mandatory | optional,
>   is_not?: recommended | mandatory | optional,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] item\_type full type
>
> ```ts theme={null}
> {
>   is?: plan | addon | charge,
>   is_not?: plan | addon | charge,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] charge\_on\_event full type
>
> ```ts theme={null}
> {
>   is?: subscription_creation | subscription_trial_start | plan_activation | subscription_activation | contract_termination | on_demand,
>   is_not?: subscription_creation | subscription_trial_start | plan_activation | subscription_activation | contract_termination | on_demand,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] updated\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   attached_item?: {
>     id?: string | null,
>     parent_item_id?: string | null,
>     item_id?: string | null,
>     type?: string | null,
>     status?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     billing_cycles?: number | null,
>     charge_on_event?: string | null,
>     charge_once?: boolean | null,
>     created_at?: number | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     channel?: string | null,
>     business_entity_id?: string | null,
>     deleted?: boolean | null
>   } | null
> }[] | null
> ```

***

### listItemEntitlements

`items.listItemEntitlements`

List item entitlements for an item. Deprecated This operation is deprecated and no longer maintained. Migrate your integration to List entitlements. Retrieves a list of all the item\_entitlements for the item specified.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.items.listItemEntitlements({ itemId: 'silver' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `itemId` | `string` | Yes | — |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   item_entitlement?: {
>     id?: string | null,
>     item_id?: string | null,
>     item_type?: string | null,
>     feature_id?: string | null,
>     feature_name?: string | null,
>     value?: string | null,
>     name?: string | null
>   } | null
> }[] | null
> ```

***

### update

`items.update`

Update an item. Updates an item with the changes specified. Unspecified item parameters are not modified.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.items.update({ itemId: 'silver' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `itemId` | `string` | Yes | — |
| `name` | `string` | No | The display name for the item. Must be unique. This is visible only in Chargebee and not to customers. |
| `description` | `string` | No | Description of the item. This is visible only in Chargebee and not to customers. **Note**: \* The description field supports up to 2000 characters, including HTML tags. The inner text (excluding HTML tags) must not exceed 500 characters. For example: `- testing - desc `. Total with tags: 38 characters, inner text: 'testing desc' (12 characters). \* If your input includes characters requiring sanitization, such as incomplete HTML tags, the sanitization process may alter the input and increase its length. If the sanitized content exceeds the allowed limit, the request will be rejected. |
| `is_shippable` | `boolean` | No | Indicates that the item is a physical product. If Orders are enabled in Chargebee, subscriptions created for this item will have orders associated with them. |
| `external_name` | `string` | No | A unique display name for the item. |
| `item_family_id` | `string` | No | The `id` of the [Item family](https://docs.corsair.dev/docs/api/item_families) that the item belongs to. Is mandatory when [Product Families](https://www.chargebee.com/docs/2.0/product-families.html) have been enabled. |
| `enabled_in_portal` | `boolean` | No | Allow customers to change their subscription to this plan via the [Self-Serve Portal](https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html). Applies only for plan-items. This requires the Portal configuration to [allow changing subscriptions](https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html#allow-change-subscription) . |
| `redirect_url` | `string` | No | If `enabled_for_checkout` , then the URL to be redirected to once the checkout is complete. This parameter is only meant for plan-items. |
| `enabled_for_checkout` | `boolean` | No | Allow the plan to subscribed to via Checkout. Applies only for plan-items. **Note:** Only the in-app layout of Checkout is supported. |
| `item_applicability` | `all \| restricted` | No | Indicates which addon-items and charge-items can be applied to the item. Only possible for plan-items. Other details of attaching items such as whether to attach as a mandatory item or to attach on a certain event, can be specified using the [Create](https://docs.corsair.dev/docs/api/attached_items/create-an-attached-item) or [Update an attached item](https://docs.corsair.dev/docs/api/attached_items/update-an-attached-item) API. \* all - all addon-items and charge-items are applicable to this plan-item. \* restricted - only the addon-items or charge-items provided in `applicable_items` can be applied to this plan-item. |
| `applicable_items` | `string[]` | No | The list of ids of addon-items and charge-items that can be applied to the plan-item. This parameter can be provided only for plan-items and that too when item\_applicability is restricted. Other details of attaching items can be specified using the [Create](https://docs.corsair.dev/docs/api/attached_items/create-an-attached-item) or [Update an attached item](https://docs.corsair.dev/docs/api/attached_items/update-an-attached-item) API. |
| `unit` | `string` | No | The unit of measure for a quantity-based item. This is displayed on the Chargebee UI and on customer facing documents/pages. The latter includes [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages) , [invoices](https://docs.corsair.dev/docs/api/invoices) and [quotes](https://docs.corsair.dev/docs/api/quotes). Examples follow: \* "user" for a cloud-collaboration platform. \* "GB" for a data service. \* "issue" for a magazine. |
| `gift_claim_redirect_url` | `string` | No | The URL to redirect to once the gift has been claimed by the receiver. |
| `metadata` | `object` | No | A collection of key-value pairs that provides extra information about the item. [Learn more](https://docs.corsair.dev/docs/api/advanced-features#metadata) . |
| `included_in_mrr` | `boolean` | No | The item is included in MRR calculations for your site. This attribute is only applicable for items of `type = charge` and when the feature is enabled in Chargebee. Note: If the site-level setting is to exclude charge-items from MRR calculations, this value is always returned `false` . |
| `status` | `active \| archived` | No | The status of the item. \* active - The item can be used to create new item prices. \* archived - The item is no longer active and no new item prices can be created |
| `is_percentage_pricing` | `boolean` | No | Indicates whether the pricing is percentage-based. |
| `bundle_configuration` | `object` | No | Parameters of `bundle_configuration` |
| `bundle_items_to_add` | `object` | No | Parameters for `bundle_items_to_add` |
| `bundle_items_to_update` | `object` | No | Parameters for bundle\_items\_to\_update |
| `bundle_items_to_remove` | `object` | No | Parameters for bundle\_items\_to\_remove |

> [accordion] metadata full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] bundle\_configuration full type
>
> ```ts theme={null}
> {
>   type?: fixed
> }
> ```

> [accordion] bundle\_items\_to\_add full type
>
> ```ts theme={null}
> {
>   item_id?: string[],
>   item_type?: (plan | addon | charge)[],
>   quantity?: number[],
>   price_allocation?: number[]
> }
> ```

> [accordion] bundle\_items\_to\_update full type
>
> ```ts theme={null}
> {
>   item_id?: string[],
>   item_type?: (plan | addon | charge)[],
>   quantity?: number[],
>   price_allocation?: number[]
> }
> ```

> [accordion] bundle\_items\_to\_remove full type
>
> ```ts theme={null}
> {
>   item_id?: string[],
>   item_type?: (plan | addon | charge)[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `item` | `object \| null` | No | When offering subscriptions of products or services, each entity that is made available for sale is represented by an "item" object. Items therefore represent the various plans, addons or charges that you offer as part of your product catalog. Non-`metered` items are charged upfront in Chargebee, while `metered` items are charged at the end of the billing cycle, based on usage. ### Types of Items There are three types of items and they're listed and explained here. Examples for each type are provided in the table that follows. #### Plan-items or Plans Plan-items are items that have a recurring charge and are an essential component of any [subscription](https://docs.corsair.dev/docs/api/subscriptions). Typically, plans represent a principal or key product or service in your catalog. They are charged at recurring intervals and often have other products or services offered along with them as addons and charges. #### Addon-items or Addons Addon-items are items that are sold along with a plan and are charged for at recurring intervals. #### Charge-items or Charges Charge-items are items that are sold along with a plan but charged once (or each time) a specified event occurs. A charge can also be [applied to a customer](https://docs.corsair.dev/docs/api/v2/pcv-1/invoices/create-invoice-for-a-one-time-charge) without attaching to a subscription. #### Examples To help understand each type of item better, listed below are some examples of items from different business domains: ##### Non-Metered (SaaS) \* **Item Family:** A project management solution. \* **Plans:** \* A "basic" plan offering a small set of features. \* A "business" plan offering a larger set of features. \* **Addons:** \* An analytics plugin that is available only with the "business" plan. \* A reporting plugin, available with both the above plans. \* **Charges:** \* Implementation charges. \* Trial charges. ##### Non-Metered (E-commerce) \* **Item Family:** A printed news magazine. \* **Plans:** \* Periodic issues of the magazine. \* Periodic issues of the magazine, with digital content. \* **Addons:** \* Supplementary online content. \* Access to a year's worth of back issues. \* Searchable access to all back issues. \* **Charges:** \* Special edition books that are published every so often. ##### Metered \* **Item Family:** SMS delivery services. \* **Plans:** \* A basic plan of up to 100K messages @ $0.03 per message. * A volume plan of 2M messages @ $0.01 per message. \* **Addons:** \* An addon of 50K MMS messages @ \$0.1 per message. \* Instant messaging. \* **Charges:** \* Automated Metered Billing is not applicable for charges. |

> [accordion] item full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   external_name?: string | null,
>   description?: string | null,
>   status?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   item_family_id?: string | null,
>   type?: string | null,
>   is_shippable?: boolean | null,
>   is_giftable?: boolean | null,
>   redirect_url?: string | null,
>   enabled_for_checkout?: boolean | null,
>   enabled_in_portal?: boolean | null,
>   included_in_mrr?: boolean | null,
>   item_applicability?: string | null,
>   gift_claim_redirect_url?: string | null,
>   unit?: string | null,
>   metered?: boolean | null,
>   usage_calculation?: string | null,
>   is_percentage_pricing?: boolean | null,
>   archived_at?: number | null,
>   channel?: string | null,
>   metadata?: {
>   } | null,
>   deleted?: boolean | null,
>   business_entity_id?: string | null,
>   applicable_items?: {
>     id?: string | null
>   }[] | null,
>   bundle_items?: {
>     item_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     price_allocation?: number | null
>   }[] | null,
>   bundle_configuration?: {
>     type?: string | null
>   } | null
> } | null
> ```

***

### upsertItemEntitlements

`items.upsertItemEntitlements`

Upsert or remove item entitlements for an item. Deprecated This operation is deprecated and no longer maintained. Migrate your integration to Manage entitlements. Warning This operation is not supported when grandfathering is enabled. Upserts or removes a set of item\_entitlements for an item depending on the action specified.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.items.upsertItemEntitlements({ itemId: 'silver', action: 'upsert' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `itemId` | `string` | Yes | — |
| `action` | `upsert \| remove` | Yes | The specific action to be performed for each `item_entitlement` specified. \* remove - Deletes the `item_entitlement` for the `feature_id` and `item_id` combination, if it exists. \* upsert - If the `item_entitlement` already exists for the `feature_id` and `item_id` combination, the `value` of the `item_entitlement` is updated. If it doesn't exist, a new `item_entitelment` is created. |
| `item_entitlements` | `object` | No | Parameters for item\_entitlements |

> [accordion] item\_entitlements full type
>
> ```ts theme={null}
> {
>   feature_id: string[],
>   value?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   item_entitlement?: {
>     id?: string | null,
>     item_id?: string | null,
>     item_type?: string | null,
>     feature_id?: string | null,
>     feature_name?: string | null,
>     value?: string | null,
>     name?: string | null
>   } | null
> }[] | null
> ```

***

## Ledger Account Balances

### list

`ledgerAccountBalances.list`

List ledger account balances. Returns a paginated list of real-time credit balance snapshots for a subscription. Each item in the list is a ledger\_account\_balance object, identified by a unique combination of subscription\_id, unit\_id, unit\_type.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.ledgerAccountBalances.list({
	subscription_id: {},
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | Specifies the maximum number of resources to return per page. **Default and Hard Cap** \* Optional parameter; if omitted, a server-defined default is applied. \* Values exceeding the server's maximum limit are capped (clamped) to the allowed maximum. **Example →** *limit = "50"* |
| `offset` | `string` | No | Opaque cursor indicating the current position in the result set for pagination. **Behavior** \* To fetch the next page, pass the `next_offset` value returned in the previous response. \* The value is opaque and must not be parsed, modified, or constructed manually. **Example →** *offset = "\\\["1771176208000","96000000006"\\]"* |
| `subscription_id` | `object` | Yes | required, string filter Filters results by subscription identifier. This is the subscription whose credit grant balances you are listing. **Supported operators :** is **Example →** *subscription\_id\\\[is\\] = "1mGETgZVF2umUZq"* |
| `unit_id` | `object` | No | optional, string filter Filters results by unit identifier. For example, a credit unit id such as `ai_credits`. **Supported operators :** is **Example →** *unit\_id\\\[is\\] = "ai\_credits"* |

> [accordion] subscription\_id full type
>
> ```ts theme={null}
> {
>   is?: string
> }
> ```

> [accordion] unit\_id full type
>
> ```ts theme={null}
> {
>   is?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   ledger_account_balance?: {
>     subscription_id?: string | null,
>     unit_id?: string | null,
>     unit_type?: string | null,
>     created_at?: number | null,
>     modified_at?: number | null,
>     resource_version?: number | null,
>     provisioned_balance?: {
>       total_balance?: string | null,
>       usable_balance?: string | null,
>       hold_amount?: string | null
>     } | null,
>     overdraft_balance?: {
>       is_unlimited?: boolean | null,
>       limit?: string | null,
>       total_balance?: string | null,
>       usable_balance?: string | null,
>       used_amount?: string | null,
>       hold_amount?: string | null
>     } | null
>   } | null
> }[] | null
> ```

***

### updateOverdraftLimit

`ledgerAccountBalances.updateOverdraftLimit`

Update the overdraft limit. Updates the overdraft limit for a subscription and credit unit. By default, the overdraft limit for a credit unit is a single, site-wide value applied to every subscription.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.ledgerAccountBalances.updateOverdraftLimit({ is_unlimited: true, subscription_id: 'example', unit_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscription_id` | `string` | Yes | A unique, immutable identifier for the [subscription](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#id) whose overdraft limit is being changed. |
| `unit_id` | `string` | Yes | Identifier of the [credit unit](https://docs.corsair.dev/docs/api/credit_units) linked to the subscription. For example, a credit unit id such as `ai_credits`. **Prerequisites** An [overdraft balance](https://docs.corsair.dev/docs/api/ledger_account_balances#overdraft_balance) must already exist for this `(subscription_id, unit_id)` pair. |
| `is_unlimited` | `boolean` | Yes | Whether the overdraft limit for this credit unit is unlimited. **Behavior** \* When `true`, requests unlimited overdraft and [`limit`](#limit) must not be passed. \* When `false`, requests a finite overdraft and [`limit`](#limit) is required. |
| `limit` | `string` | No | The new maximum overdraft allowed for this credit unit. Pass this value as a decimal string. **Required if** [`is_unlimited`](#is_unlimited) is `false`. **Constraints** \* Must not be passed when [`is_unlimited`](#is_unlimited) is `true`. \* Must be zero or a positive value; negative values are not allowed. \* Maximum supported value: `9999999999999999999999999.9999999999` (up to 25 digits before the decimal and up to 10 digits after). \* Must be greater than or equal to the sum of `used_amount` and `hold_amount` on the active [overdraft balance](https://docs.corsair.dev/docs/api/ledger_account_balances#overdraft_balance). Any limit that would drop below the already committed amount is rejected. |
| `change_reason` | `string` | No | The reason for this overdraft limit change, for your reference. Recorded for audit purposes. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `subscription_id` | `string \| null` | No | A unique, immutable identifier for the [subscription](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#id) whose overdraft limit was changed. Echoes the value passed in the request. |
| `unit_id` | `string \| null` | No | Identifier of the [credit unit](https://docs.corsair.dev/docs/api/credit_units) linked to the subscription. Echoes the value passed in the request. |
| `change_reason` | `string \| null` | No | The reason for this overdraft limit change. Echoes the value passed in the request. This field is omitted from the response when the request does not include it. |
| `overdraft_balance` | `object \| null` | No | The resulting [`overdraft_balance`](https://docs.corsair.dev/docs/api/ledger_account_balances#overdraft_balance) for the subscription and credit unit, reflecting the newly applied limit. |

> [accordion] overdraft\_balance full type
>
> ```ts theme={null}
> {
> } | null
> ```

***

## Ledger Operations

### allocate

`ledgerOperations.allocate`

Allocate. The allocate operation allocates credit grants to a subscription's provisioned balance. Behavior \* Allocates the specified amount to the subscription's provisioned balance for the given unit\_id.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.ledgerOperations.allocate({
	amount: 'example',
	expires_at: 1,
	subscription_id: 'example',
	unit_id: 'example',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscription_id` | `string` | Yes | A unique, immutable identifier for the [subscription](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#id) to which the allocated credit grants are applied. |
| `unit_id` | `string` | Yes | Identifier of the credit unit for which credit grants are allocated. For example, a credit unit id such as `ai_credits`. |
| `id` | `string` | No | Optional client-supplied identifier for this allocate operation. **Behavior** \* When provided, must uniquely identify this operation across the entire ledger. \* Should not conflict with any other operation, regardless of type. \* Reusing the same value is treated as a replay of the original allocation rather than a conflict, so a retry does not create a second grant block. **Constraints** \* Maximum length: 50 characters. **Default value** \* When omitted, Chargebee generates an identifier for the operation. **Usage** \* Supply a value that you can reproduce, such as your own allocation reference, and send that same value when retrying after an unexpected response. |
| `amount` | `string` | Yes | The number of credit grants to allocate as part of this operation. Pass this value as a decimal string. **Constraints** Maximum supported value: `9999999999999999999999999.9999999999` (up to 25 digits before the decimal and up to 10 digits after). **Behavior** \* Must be a positive value greater than zero. \* Allocated to the subscription's provisioned balance for the given `unit_id`. **Example** If `amount = "500"`, then 500 credit grants are added to the subscription's total as well as usable balance and recorded as a new grant block. |
| `effective_from` | `number` | No | Optional Unix timestamp (in seconds) at which the allocated credit grants become usable. Sets [`effective_from`](https://docs.corsair.dev/docs/api/grant_blocks#effective_from) on the grant block created by this allocation. **Behavior** \* When set to a future timestamp, the grant block is created with [`status`](https://docs.corsair.dev/docs/api/grant_blocks#status) `scheduled` and its credit grants stay out of the usable balance until that time. \* At `effective_from`, the grant block becomes `available` and its credit grants are included in the usable balance. **Default value** \* When omitted, the credit grants become usable at the time of the request. **Note** `effective_from` is inclusive. A capture operation with a timestamp exactly equal to `effective_from` is eligible to consume credit grants from this grant block. |
| `expires_at` | `number` | Yes | Unix timestamp (in seconds) at which the allocated credit grants expire and become unavailable for consumption. **Behavior** \* Once expired, the remaining balance in the associated grant block moves to `expired_amount`. **Constraints** \* `expires_at` must be a future timestamp. |
| `metadata` | `object` | No | Optional opaque JSON object carrying additional business context for this allocation. **Behavior** \* Stored as-is and returned verbatim by the system. \* Not interpreted, validated, or indexed by the system. |

> [accordion] metadata full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `ledger_account_balance` | `object \| null` | No | Credit Grants ------------- A credit grant is a quantified allocation of credits given to a subscription through a configured [item price](https://docs.corsair.dev/docs/api/item_prices) or via the [allocate](https://docs.corsair.dev/docs/api/ledger_operations/allocate) operation, consumed over time through ledger operations. **Example** A subscription receives a credit grant of 100 AI credits as a balance. As the customer uses AI features (e.g., Image Generation), the provisioned balance is consumed first. Once exhausted, further consumption is deducted from the overdraft balance until its limit is reached. The Ledger Account Balance object --------------------------------- The `ledger_account_balance` object is a real-time snapshot of credit grants for a single combination of subscription\_id, unit\_id and unit\_type. The ledger tracks two balances: \* [**provisioned\_balance**](#provisioned_balance): Reflects the credit grants given through the configured item price or allocate operations. These are prepaid credit grants for which the customer has already paid. Any ledger operation will prioritize consuming this balance first. \* [**overdraft\_balance**](#overdraft_balance): Reflects the extra limit provided to a subscription in case it exhausts all credit grants before they are renewed or refreshed. Any ledger operation will consume this balance only when the provisioned balance has been exhausted. **Note** These two balances are always tracked together for a subscription with credit grants. **Example** A subscription has a credit grant of 100 AI credits, added to its provisioned balance. Once the provisioned balance is exhausted, further consumption is drawn from the overdraft balance up to its configured limit. screenshot\\\|/images/account\_balance.png **Returned by** \* [List ledger account balances](https://docs.corsair.dev/docs/api/ledger_account_balances/list-ledger-account-balances) API. \* Ledger [operations](https://docs.corsair.dev/docs/api/ledger_operations) such as [allocate](https://docs.corsair.dev/docs/api/ledger_operations/allocate), [capture](https://docs.corsair.dev/docs/api/ledger_operations/capture), and [authorize](https://docs.corsair.dev/docs/api/ledger_operations/authorize). |
| `ledger_operations` | `object[] \| null` | No | The resulting [`ledger_operations`](https://docs.corsair.dev/docs/api/ledger_operations) resource for this allocate operation. Has `type` `allocation` and reflects the movement of credit grants into the subscription's provisioned balance. |
| `grant_blocks` | `object[] \| null` | No | The [`grant_blocks`](https://docs.corsair.dev/docs/api/grant_blocks) created for this allocation, each tracking the issued credit grants, remaining balance, holds, expiry, and rollover state for the subscription. |
| `ledger_entries` | `object[] \| null` | No | The [`ledger_entries`](https://docs.corsair.dev/docs/api/ledger_entries) recorded by this operation --- immutable, per-grant-block movements of type `credit` that make up this allocation. |

> [accordion] ledger\_account\_balance full type
>
> ```ts theme={null}
> {
>   subscription_id?: string | null,
>   unit_id?: string | null,
>   unit_type?: string | null,
>   created_at?: number | null,
>   modified_at?: number | null,
>   resource_version?: number | null,
>   provisioned_balance?: {
>     total_balance?: string | null,
>     usable_balance?: string | null,
>     hold_amount?: string | null
>   } | null,
>   overdraft_balance?: {
>     is_unlimited?: boolean | null,
>     limit?: string | null,
>     total_balance?: string | null,
>     usable_balance?: string | null,
>     used_amount?: string | null,
>     hold_amount?: string | null
>   } | null
> } | null
> ```

> [accordion] ledger\_operations full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   subscription_id?: string | null,
>   unit_id?: string | null,
>   unit_type?: string | null,
>   type?: string | null,
>   amount?: string | null,
>   provisioned_start_balance?: string | null,
>   provisioned_end_balance?: string | null,
>   overdraft_start_balance?: string | null,
>   overdraft_end_balance?: string | null,
>   parent_ledger_operation_id?: string | null,
>   ledger_operation_timestamp?: number | null,
>   auto_release_timestamp?: number | null,
>   created_at?: number | null,
>   modified_at?: number | null,
>   metadata?: {
>   } | null
> }[] | null
> ```

> [accordion] grant\_blocks full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   subscription_id?: string | null,
>   unit_id?: string | null,
>   unit_type?: string | null,
>   account_type?: string | null,
>   effective_from?: number | null,
>   expires_at?: number | null,
>   origin_grant_block_id?: string | null,
>   status?: string | null,
>   grant_source?: string | null,
>   created_at?: number | null,
>   modified_at?: number | null,
>   resource_version?: number | null,
>   metadata?: {
>   } | null,
>   provisioned_block_balance?: {
>     granted_amount?: string | null,
>     total_balance?: string | null,
>     usable_balance?: string | null,
>     hold_amount?: string | null,
>     used_amount?: string | null,
>     expired_amount?: string | null,
>     rolled_over_amount?: string | null,
>     voided_amount?: string | null
>   } | null,
>   overdraft_block_balance?: {
>     is_unlimited?: boolean | null,
>     limit?: string | null,
>     total_balance?: string | null,
>     usable_balance?: string | null,
>     used_amount?: string | null
>   } | null,
>   billing_metadata?: {
>     item_price_id?: string | null,
>     line_items?: {
>       id?: string | null,
>       invoice_number?: string | null,
>       quantity?: number | null
>     }[] | null
>   } | null
> }[] | null
> ```

> [accordion] ledger\_entries full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   subscription_id?: string | null,
>   unit_id?: string | null,
>   unit_type?: string | null,
>   account_type?: string | null,
>   amount?: string | null,
>   grant_block_start_balance?: string | null,
>   grant_block_end_balance?: string | null,
>   account_start_balance?: string | null,
>   account_end_balance?: string | null,
>   type?: string | null,
>   ledger_operation_id?: string | null,
>   grant_block_id?: string | null,
>   created_at?: number | null,
>   modified_at?: number | null
> }[] | null
> ```

***

### authorize

`ledgerOperations.authorize`

Authorize. Reserves credit grants at the time of request for later finalization via capture\_authorization or release\_authorization. Use this operation when the final amount is unknown while a job is in progress, or when multiple concurrent operations or users draw from the same credit pool.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.ledgerOperations.authorize({
	amount: 'example',
	ledger_operation_timestamp: 1,
	subscription_id: 'example',
	unit_id: 'example',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `id` | `string` | No | Optional client-supplied identifier for this authorize operation. **Behavior** \* When provided, must uniquely identify this operation across the entire ledger. \* Should not conflict with any other operation, regardless of type. **Usage** \* Identifies the specific reservation of credits created by this request. \* Used as the reference for subsequent operations: \* `capture_authorization`: to finalize (consume) the held credits. \* `release_authorization`: to release the held credits back to usable balance. |
| `subscription_id` | `string` | Yes | A unique, immutable identifier for the [subscription](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#id) against which credit grants are tracked. |
| `unit_id` | `string` | Yes | Identifier of the credit unit for which credit grants are tracked. For example, a credit unit id such as `ai_credits`. |
| `amount` | `string` | Yes | The number of credit grants to reserve from the usable balance. While held, this amount is unavailable for other operations, helping prevent concurrent requests from spending the same credits. Pass this value as a decimal string. **Constraints** Maximum supported value: `9999999999999999999999999.9999999999` (up to 25 digits before the decimal and up to 10 digits after). **Behavior** \* On `authorize`, this amount is moved from `usable_balance` to `hold_amount`. It is not consumed yet. \* The held amount can later be: \* Captured via `capture_authorization`. \* Released via `release_authorization`. \* Auto-released when the hold expires. **Example** If `amount = "50"`, the ledger reserves 50 credits immediately, if available. A later `capture_authorization` can consume all or part of that hold. Any unused remainder is released back to the usable balance. |
| `ledger_operation_timestamp` | `number` | Yes | Unix timestamp (in seconds) representing when the business operation occurred in the upstream system. **Usage** Used for period attribution, grace-period eligibility, and reporting accuracy. **Note** Late or out-of-order submissions appear in arrival order, while attribution and eligibility logic rely on `ledger_operation_timestamp`. **Constraints** \* The `ledger_operation_timestamp` must be within the last 10 minutes from the time of the request. \* Grant blocks outside their active window (including those in the grace period) are not eligible for authorization and are excluded from balance checks for this ledger operation. |
| `auto_release_timestamp` | `number` | No | Unix timestamp (in seconds) indicating when an unfinalized hold will be automatically released back to the usable balance. **Behavior** \* Applies only to authorize operations. \* If not explicitly provided, the system assigns a default expiry. Defaults to approximately 10 minutes after the authorize request is processed. **Usage** Ensures held credits are not locked indefinitely by abandoned or unfinalized authorizations. **Note** \* By default, the value reflects what is provided in the request. \* If the specified timestamp exceeds the end of the block's grace period, it is adjusted (clamped) to the grace period end and returned in the response. |
| `metadata` | `object` | No | Optional opaque JSON object carrying additional business context **Behavior** \* Stored as-is and returned verbatim by the system. \* Not interpreted, validated, or indexed by the system. |

> [accordion] metadata full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `ledger_operation` | `object \| null` | No | A ledger operation represents a single action recorded in the ledger that results in a state change. Each ledger operation corresponds to one atomic event, whether initiated externally or internally. **Behavior** \* Ledger Operations are immutable once recorded. \* They provide traceability, idempotency, and a complete audit trail of all state transitions. **Usage** Serves as the fundamental unit for representing, tracking, and reconciling all changes within the system. |
| `ledger_operations` | `object[] \| null` | No | The resulting [`ledger_operations`](https://docs.corsair.dev/docs/api/ledger_operations) for this capture\_authorization. Array of one or more ledger operations. |
| `ledger_account_balance` | `object \| null` | No | Credit Grants ------------- A credit grant is a quantified allocation of credits given to a subscription through a configured [item price](https://docs.corsair.dev/docs/api/item_prices) or via the [allocate](https://docs.corsair.dev/docs/api/ledger_operations/allocate) operation, consumed over time through ledger operations. **Example** A subscription receives a credit grant of 100 AI credits as a balance. As the customer uses AI features (e.g., Image Generation), the provisioned balance is consumed first. Once exhausted, further consumption is deducted from the overdraft balance until its limit is reached. The Ledger Account Balance object --------------------------------- The `ledger_account_balance` object is a real-time snapshot of credit grants for a single combination of subscription\_id, unit\_id and unit\_type. The ledger tracks two balances: \* [**provisioned\_balance**](#provisioned_balance): Reflects the credit grants given through the configured item price or allocate operations. These are prepaid credit grants for which the customer has already paid. Any ledger operation will prioritize consuming this balance first. \* [**overdraft\_balance**](#overdraft_balance): Reflects the extra limit provided to a subscription in case it exhausts all credit grants before they are renewed or refreshed. Any ledger operation will consume this balance only when the provisioned balance has been exhausted. **Note** These two balances are always tracked together for a subscription with credit grants. **Example** A subscription has a credit grant of 100 AI credits, added to its provisioned balance. Once the provisioned balance is exhausted, further consumption is drawn from the overdraft balance up to its configured limit. screenshot\\\|/images/account\_balance.png **Returned by** \* [List ledger account balances](https://docs.corsair.dev/docs/api/ledger_account_balances/list-ledger-account-balances) API. \* Ledger [operations](https://docs.corsair.dev/docs/api/ledger_operations) such as [allocate](https://docs.corsair.dev/docs/api/ledger_operations/allocate), [capture](https://docs.corsair.dev/docs/api/ledger_operations/capture), and [authorize](https://docs.corsair.dev/docs/api/ledger_operations/authorize). |
| `grant_blocks` | `object[] \| null` | No | The [`grant_blocks`](https://docs.corsair.dev/docs/api/grant_blocks) affected by this operation, each reflecting its updated balances after the operation. |
| `ledger_entries` | `object[] \| null` | No | The [`ledger_entries`](https://docs.corsair.dev/docs/api/ledger_entries) recorded by this operation --- immutable, per-grant-block movements (typically `debit`, and `unhold` when releasing any unused hold) that make up this capture\_authorization. |

> [accordion] ledger\_operation full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   subscription_id?: string | null,
>   unit_id?: string | null,
>   unit_type?: string | null,
>   type?: string | null,
>   amount?: string | null,
>   provisioned_start_balance?: string | null,
>   provisioned_end_balance?: string | null,
>   overdraft_start_balance?: string | null,
>   overdraft_end_balance?: string | null,
>   parent_ledger_operation_id?: string | null,
>   ledger_operation_timestamp?: number | null,
>   auto_release_timestamp?: number | null,
>   created_at?: number | null,
>   modified_at?: number | null,
>   metadata?: {
>   } | null
> } | null
> ```

> [accordion] ledger\_operations full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   subscription_id?: string | null,
>   unit_id?: string | null,
>   unit_type?: string | null,
>   type?: string | null,
>   amount?: string | null,
>   provisioned_start_balance?: string | null,
>   provisioned_end_balance?: string | null,
>   overdraft_start_balance?: string | null,
>   overdraft_end_balance?: string | null,
>   parent_ledger_operation_id?: string | null,
>   ledger_operation_timestamp?: number | null,
>   auto_release_timestamp?: number | null,
>   created_at?: number | null,
>   modified_at?: number | null,
>   metadata?: {
>   } | null
> }[] | null
> ```

> [accordion] ledger\_account\_balance full type
>
> ```ts theme={null}
> {
>   subscription_id?: string | null,
>   unit_id?: string | null,
>   unit_type?: string | null,
>   created_at?: number | null,
>   modified_at?: number | null,
>   resource_version?: number | null,
>   provisioned_balance?: {
>     total_balance?: string | null,
>     usable_balance?: string | null,
>     hold_amount?: string | null
>   } | null,
>   overdraft_balance?: {
>     is_unlimited?: boolean | null,
>     limit?: string | null,
>     total_balance?: string | null,
>     usable_balance?: string | null,
>     used_amount?: string | null,
>     hold_amount?: string | null
>   } | null
> } | null
> ```

> [accordion] grant\_blocks full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   subscription_id?: string | null,
>   unit_id?: string | null,
>   unit_type?: string | null,
>   account_type?: string | null,
>   effective_from?: number | null,
>   expires_at?: number | null,
>   origin_grant_block_id?: string | null,
>   status?: string | null,
>   grant_source?: string | null,
>   created_at?: number | null,
>   modified_at?: number | null,
>   resource_version?: number | null,
>   metadata?: {
>   } | null,
>   provisioned_block_balance?: {
>     granted_amount?: string | null,
>     total_balance?: string | null,
>     usable_balance?: string | null,
>     hold_amount?: string | null,
>     used_amount?: string | null,
>     expired_amount?: string | null,
>     rolled_over_amount?: string | null,
>     voided_amount?: string | null
>   } | null,
>   overdraft_block_balance?: {
>     is_unlimited?: boolean | null,
>     limit?: string | null,
>     total_balance?: string | null,
>     usable_balance?: string | null,
>     used_amount?: string | null
>   } | null,
>   billing_metadata?: {
>     item_price_id?: string | null,
>     line_items?: {
>       id?: string | null,
>       invoice_number?: string | null,
>       quantity?: number | null
>     }[] | null
>   } | null
> }[] | null
> ```

> [accordion] ledger\_entries full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   subscription_id?: string | null,
>   unit_id?: string | null,
>   unit_type?: string | null,
>   account_type?: string | null,
>   amount?: string | null,
>   grant_block_start_balance?: string | null,
>   grant_block_end_balance?: string | null,
>   account_start_balance?: string | null,
>   account_end_balance?: string | null,
>   type?: string | null,
>   ledger_operation_id?: string | null,
>   grant_block_id?: string | null,
>   created_at?: number | null,
>   modified_at?: number | null
> }[] | null
> ```

***

### capture

`ledgerOperations.capture`

Capture. The capture operation immediately consumes credits for a completed action. Behavior \* Credits are directly moved from usable → consumed. \* No intermediate hold or reservation is created.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.ledgerOperations.capture({
	amount: 'example',
	ledger_operation_timestamp: 1,
	subscription_id: 'example',
	unit_id: 'example',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `id` | `string` | No | Optional client-supplied identifier for this capture operation. **Behavior** \* When provided, must uniquely identify this operation across the entire ledger. \* Should not conflict with any other operation, regardless of type. |
| `subscription_id` | `string` | Yes | A unique, immutable identifier for the [subscription](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#id) against which credit grants are tracked. |
| `unit_id` | `string` | Yes | Identifier of the credit unit for which credit grants are tracked. For example, a credit unit id such as `ai_credits`. |
| `amount` | `string` | Yes | The number of credits to immediately consume from the usable balance. Pass this value as a decimal string. **Constraints** Maximum supported value: `9999999999999999999999999.9999999999` (up to 25 digits before the decimal and up to 10 digits after). **Behavior** Credits are directly moved from usable → consumed as part of this operation. **Constraints** \* Must be a positive value. \* Evaluated against the current usable balance at the time of processing. **Example** If `amount = "50"`, then 50 credits are immediately deducted from the usable balance and recorded as consumed. |
| `ledger_operation_timestamp` | `number` | Yes | Unix timestamp (in seconds) representing when the business operation occurred in the upstream system. **Usage** Used for period attribution, grace-period eligibility, and reporting accuracy. **Note** Late or out-of-order submissions appear in arrival order, while attribution and eligibility logic rely on `ledger_operation_timestamp`. |
| `metadata` | `object` | No | Optional opaque JSON object carrying additional business context **Behavior** \* Stored as-is and returned verbatim by the system. \* Not interpreted, validated, or indexed by the system. |

> [accordion] metadata full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `ledger_operation` | `object \| null` | No | A ledger operation represents a single action recorded in the ledger that results in a state change. Each ledger operation corresponds to one atomic event, whether initiated externally or internally. **Behavior** \* Ledger Operations are immutable once recorded. \* They provide traceability, idempotency, and a complete audit trail of all state transitions. **Usage** Serves as the fundamental unit for representing, tracking, and reconciling all changes within the system. |
| `ledger_operations` | `object[] \| null` | No | The resulting [`ledger_operations`](https://docs.corsair.dev/docs/api/ledger_operations) for this capture\_authorization. Array of one or more ledger operations. |
| `ledger_account_balance` | `object \| null` | No | Credit Grants ------------- A credit grant is a quantified allocation of credits given to a subscription through a configured [item price](https://docs.corsair.dev/docs/api/item_prices) or via the [allocate](https://docs.corsair.dev/docs/api/ledger_operations/allocate) operation, consumed over time through ledger operations. **Example** A subscription receives a credit grant of 100 AI credits as a balance. As the customer uses AI features (e.g., Image Generation), the provisioned balance is consumed first. Once exhausted, further consumption is deducted from the overdraft balance until its limit is reached. The Ledger Account Balance object --------------------------------- The `ledger_account_balance` object is a real-time snapshot of credit grants for a single combination of subscription\_id, unit\_id and unit\_type. The ledger tracks two balances: \* [**provisioned\_balance**](#provisioned_balance): Reflects the credit grants given through the configured item price or allocate operations. These are prepaid credit grants for which the customer has already paid. Any ledger operation will prioritize consuming this balance first. \* [**overdraft\_balance**](#overdraft_balance): Reflects the extra limit provided to a subscription in case it exhausts all credit grants before they are renewed or refreshed. Any ledger operation will consume this balance only when the provisioned balance has been exhausted. **Note** These two balances are always tracked together for a subscription with credit grants. **Example** A subscription has a credit grant of 100 AI credits, added to its provisioned balance. Once the provisioned balance is exhausted, further consumption is drawn from the overdraft balance up to its configured limit. screenshot\\\|/images/account\_balance.png **Returned by** \* [List ledger account balances](https://docs.corsair.dev/docs/api/ledger_account_balances/list-ledger-account-balances) API. \* Ledger [operations](https://docs.corsair.dev/docs/api/ledger_operations) such as [allocate](https://docs.corsair.dev/docs/api/ledger_operations/allocate), [capture](https://docs.corsair.dev/docs/api/ledger_operations/capture), and [authorize](https://docs.corsair.dev/docs/api/ledger_operations/authorize). |
| `grant_blocks` | `object[] \| null` | No | The [`grant_blocks`](https://docs.corsair.dev/docs/api/grant_blocks) affected by this operation, each reflecting its updated balances after the operation. |
| `ledger_entries` | `object[] \| null` | No | The [`ledger_entries`](https://docs.corsair.dev/docs/api/ledger_entries) recorded by this operation --- immutable, per-grant-block movements (typically `debit`, and `unhold` when releasing any unused hold) that make up this capture\_authorization. |

> [accordion] ledger\_operation full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   subscription_id?: string | null,
>   unit_id?: string | null,
>   unit_type?: string | null,
>   type?: string | null,
>   amount?: string | null,
>   provisioned_start_balance?: string | null,
>   provisioned_end_balance?: string | null,
>   overdraft_start_balance?: string | null,
>   overdraft_end_balance?: string | null,
>   parent_ledger_operation_id?: string | null,
>   ledger_operation_timestamp?: number | null,
>   auto_release_timestamp?: number | null,
>   created_at?: number | null,
>   modified_at?: number | null,
>   metadata?: {
>   } | null
> } | null
> ```

> [accordion] ledger\_operations full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   subscription_id?: string | null,
>   unit_id?: string | null,
>   unit_type?: string | null,
>   type?: string | null,
>   amount?: string | null,
>   provisioned_start_balance?: string | null,
>   provisioned_end_balance?: string | null,
>   overdraft_start_balance?: string | null,
>   overdraft_end_balance?: string | null,
>   parent_ledger_operation_id?: string | null,
>   ledger_operation_timestamp?: number | null,
>   auto_release_timestamp?: number | null,
>   created_at?: number | null,
>   modified_at?: number | null,
>   metadata?: {
>   } | null
> }[] | null
> ```

> [accordion] ledger\_account\_balance full type
>
> ```ts theme={null}
> {
>   subscription_id?: string | null,
>   unit_id?: string | null,
>   unit_type?: string | null,
>   created_at?: number | null,
>   modified_at?: number | null,
>   resource_version?: number | null,
>   provisioned_balance?: {
>     total_balance?: string | null,
>     usable_balance?: string | null,
>     hold_amount?: string | null
>   } | null,
>   overdraft_balance?: {
>     is_unlimited?: boolean | null,
>     limit?: string | null,
>     total_balance?: string | null,
>     usable_balance?: string | null,
>     used_amount?: string | null,
>     hold_amount?: string | null
>   } | null
> } | null
> ```

> [accordion] grant\_blocks full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   subscription_id?: string | null,
>   unit_id?: string | null,
>   unit_type?: string | null,
>   account_type?: string | null,
>   effective_from?: number | null,
>   expires_at?: number | null,
>   origin_grant_block_id?: string | null,
>   status?: string | null,
>   grant_source?: string | null,
>   created_at?: number | null,
>   modified_at?: number | null,
>   resource_version?: number | null,
>   metadata?: {
>   } | null,
>   provisioned_block_balance?: {
>     granted_amount?: string | null,
>     total_balance?: string | null,
>     usable_balance?: string | null,
>     hold_amount?: string | null,
>     used_amount?: string | null,
>     expired_amount?: string | null,
>     rolled_over_amount?: string | null,
>     voided_amount?: string | null
>   } | null,
>   overdraft_block_balance?: {
>     is_unlimited?: boolean | null,
>     limit?: string | null,
>     total_balance?: string | null,
>     usable_balance?: string | null,
>     used_amount?: string | null
>   } | null,
>   billing_metadata?: {
>     item_price_id?: string | null,
>     line_items?: {
>       id?: string | null,
>       invoice_number?: string | null,
>       quantity?: number | null
>     }[] | null
>   } | null
> }[] | null
> ```

> [accordion] ledger\_entries full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   subscription_id?: string | null,
>   unit_id?: string | null,
>   unit_type?: string | null,
>   account_type?: string | null,
>   amount?: string | null,
>   grant_block_start_balance?: string | null,
>   grant_block_end_balance?: string | null,
>   account_start_balance?: string | null,
>   account_end_balance?: string | null,
>   type?: string | null,
>   ledger_operation_id?: string | null,
>   grant_block_id?: string | null,
>   created_at?: number | null,
>   modified_at?: number | null
> }[] | null
> ```

***

### captureAuthorization

`ledgerOperations.captureAuthorization`

Capture authorization. The capture\_authorization operation finalizes a previously created hold by converting reserved credits into consumed credits. API Behavior \* Completes an earlier authorize operation. \* Moves credits from held (reserved) → consumed (debited).

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.ledgerOperations.captureAuthorization({ amount: 'example', authorization_id: 'example', ledger_operation_timestamp: 1 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `authorization_id` | `string` | Yes | Identifier of the original `authorize` operation whose hold is being captured. **Behavior** \* Must reference a valid and active hold created via an `authorize` request. \* Must match the `ledger_operation_id` used in the original `authorize` call. |
| `id` | `string` | No | Optional client-supplied identifier for this capture\_authorization operation. **Behavior** \* When provided, must uniquely identify this operation across the entire ledger. \* Should not conflict with any other operation, regardless of type. |
| `amount` | `string` | Yes | The number of credits to finalize as consumption from a previously authorized (held) amount. Pass this value as a decimal string. **Constraints** Maximum supported value: `9999999999999999999999999.9999999999` (up to 25 digits before the decimal and up to 10 digits after). **Behavior** \* Must be less than or equal to the current held amount for the specified authorization\_id. \* The specified amount is moved from held → consumed. **Constraints** Cannot exceed the total credits currently on hold for the authorization. **Example** Step 1: Authorize (hold created): `amount = "100"` results in 100 credits moved from usable to held. Step 2: Capture authorization (partial consumption): `amount = "70"` results in 70 credits moved from held to consumed; remaining 30 credits auto-released back to usable balance (via internal release operation) **Ledger Effect Summary** \* Consumed: 70 \* Released: 30 \* Remaining Hold: 0 (hold closed) |
| `ledger_operation_timestamp` | `number` | Yes | Unix timestamp (in seconds) representing when the capture\_authorization occurred in the upstream system. **Usage** Used for period attribution, grace-period eligibility, and reporting accuracy. **Note** Late or out-of-order submissions appear in arrival order, while attribution and eligibility logic rely on `ledger_operation_timestamp`. |
| `metadata` | `object` | No | Optional opaque JSON object carrying additional business context. **Behavior** \* Stored as-is and returned verbatim by the system. \* Not interpreted, validated, or indexed by the system. |

> [accordion] metadata full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `ledger_operation` | `object \| null` | No | A ledger operation represents a single action recorded in the ledger that results in a state change. Each ledger operation corresponds to one atomic event, whether initiated externally or internally. **Behavior** \* Ledger Operations are immutable once recorded. \* They provide traceability, idempotency, and a complete audit trail of all state transitions. **Usage** Serves as the fundamental unit for representing, tracking, and reconciling all changes within the system. |
| `ledger_operations` | `object[] \| null` | No | The resulting [`ledger_operations`](https://docs.corsair.dev/docs/api/ledger_operations) for this capture\_authorization. Array of one or more ledger operations. |
| `ledger_account_balance` | `object \| null` | No | Credit Grants ------------- A credit grant is a quantified allocation of credits given to a subscription through a configured [item price](https://docs.corsair.dev/docs/api/item_prices) or via the [allocate](https://docs.corsair.dev/docs/api/ledger_operations/allocate) operation, consumed over time through ledger operations. **Example** A subscription receives a credit grant of 100 AI credits as a balance. As the customer uses AI features (e.g., Image Generation), the provisioned balance is consumed first. Once exhausted, further consumption is deducted from the overdraft balance until its limit is reached. The Ledger Account Balance object --------------------------------- The `ledger_account_balance` object is a real-time snapshot of credit grants for a single combination of subscription\_id, unit\_id and unit\_type. The ledger tracks two balances: \* [**provisioned\_balance**](#provisioned_balance): Reflects the credit grants given through the configured item price or allocate operations. These are prepaid credit grants for which the customer has already paid. Any ledger operation will prioritize consuming this balance first. \* [**overdraft\_balance**](#overdraft_balance): Reflects the extra limit provided to a subscription in case it exhausts all credit grants before they are renewed or refreshed. Any ledger operation will consume this balance only when the provisioned balance has been exhausted. **Note** These two balances are always tracked together for a subscription with credit grants. **Example** A subscription has a credit grant of 100 AI credits, added to its provisioned balance. Once the provisioned balance is exhausted, further consumption is drawn from the overdraft balance up to its configured limit. screenshot\\\|/images/account\_balance.png **Returned by** \* [List ledger account balances](https://docs.corsair.dev/docs/api/ledger_account_balances/list-ledger-account-balances) API. \* Ledger [operations](https://docs.corsair.dev/docs/api/ledger_operations) such as [allocate](https://docs.corsair.dev/docs/api/ledger_operations/allocate), [capture](https://docs.corsair.dev/docs/api/ledger_operations/capture), and [authorize](https://docs.corsair.dev/docs/api/ledger_operations/authorize). |
| `grant_blocks` | `object[] \| null` | No | The [`grant_blocks`](https://docs.corsair.dev/docs/api/grant_blocks) affected by this operation, each reflecting its updated balances after the operation. |
| `ledger_entries` | `object[] \| null` | No | The [`ledger_entries`](https://docs.corsair.dev/docs/api/ledger_entries) recorded by this operation --- immutable, per-grant-block movements (typically `debit`, and `unhold` when releasing any unused hold) that make up this capture\_authorization. |

> [accordion] ledger\_operation full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   subscription_id?: string | null,
>   unit_id?: string | null,
>   unit_type?: string | null,
>   type?: string | null,
>   amount?: string | null,
>   provisioned_start_balance?: string | null,
>   provisioned_end_balance?: string | null,
>   overdraft_start_balance?: string | null,
>   overdraft_end_balance?: string | null,
>   parent_ledger_operation_id?: string | null,
>   ledger_operation_timestamp?: number | null,
>   auto_release_timestamp?: number | null,
>   created_at?: number | null,
>   modified_at?: number | null,
>   metadata?: {
>   } | null
> } | null
> ```

> [accordion] ledger\_operations full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   subscription_id?: string | null,
>   unit_id?: string | null,
>   unit_type?: string | null,
>   type?: string | null,
>   amount?: string | null,
>   provisioned_start_balance?: string | null,
>   provisioned_end_balance?: string | null,
>   overdraft_start_balance?: string | null,
>   overdraft_end_balance?: string | null,
>   parent_ledger_operation_id?: string | null,
>   ledger_operation_timestamp?: number | null,
>   auto_release_timestamp?: number | null,
>   created_at?: number | null,
>   modified_at?: number | null,
>   metadata?: {
>   } | null
> }[] | null
> ```

> [accordion] ledger\_account\_balance full type
>
> ```ts theme={null}
> {
>   subscription_id?: string | null,
>   unit_id?: string | null,
>   unit_type?: string | null,
>   created_at?: number | null,
>   modified_at?: number | null,
>   resource_version?: number | null,
>   provisioned_balance?: {
>     total_balance?: string | null,
>     usable_balance?: string | null,
>     hold_amount?: string | null
>   } | null,
>   overdraft_balance?: {
>     is_unlimited?: boolean | null,
>     limit?: string | null,
>     total_balance?: string | null,
>     usable_balance?: string | null,
>     used_amount?: string | null,
>     hold_amount?: string | null
>   } | null
> } | null
> ```

> [accordion] grant\_blocks full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   subscription_id?: string | null,
>   unit_id?: string | null,
>   unit_type?: string | null,
>   account_type?: string | null,
>   effective_from?: number | null,
>   expires_at?: number | null,
>   origin_grant_block_id?: string | null,
>   status?: string | null,
>   grant_source?: string | null,
>   created_at?: number | null,
>   modified_at?: number | null,
>   resource_version?: number | null,
>   metadata?: {
>   } | null,
>   provisioned_block_balance?: {
>     granted_amount?: string | null,
>     total_balance?: string | null,
>     usable_balance?: string | null,
>     hold_amount?: string | null,
>     used_amount?: string | null,
>     expired_amount?: string | null,
>     rolled_over_amount?: string | null,
>     voided_amount?: string | null
>   } | null,
>   overdraft_block_balance?: {
>     is_unlimited?: boolean | null,
>     limit?: string | null,
>     total_balance?: string | null,
>     usable_balance?: string | null,
>     used_amount?: string | null
>   } | null,
>   billing_metadata?: {
>     item_price_id?: string | null,
>     line_items?: {
>       id?: string | null,
>       invoice_number?: string | null,
>       quantity?: number | null
>     }[] | null
>   } | null
> }[] | null
> ```

> [accordion] ledger\_entries full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   subscription_id?: string | null,
>   unit_id?: string | null,
>   unit_type?: string | null,
>   account_type?: string | null,
>   amount?: string | null,
>   grant_block_start_balance?: string | null,
>   grant_block_end_balance?: string | null,
>   account_start_balance?: string | null,
>   account_end_balance?: string | null,
>   type?: string | null,
>   ledger_operation_id?: string | null,
>   grant_block_id?: string | null,
>   created_at?: number | null,
>   modified_at?: number | null
> }[] | null
> ```

***

### get

`ledgerOperations.get`

Retrieve ledger operation. Returns the details of a specific ledger operation by its unique identifier.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.ledgerOperations.get({ ledgerOperationId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `ledgerOperationId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `ledger_operation` | `object \| null` | No | A ledger operation represents a single action recorded in the ledger that results in a state change. Each ledger operation corresponds to one atomic event, whether initiated externally or internally. **Behavior** \* Ledger Operations are immutable once recorded. \* They provide traceability, idempotency, and a complete audit trail of all state transitions. **Usage** Serves as the fundamental unit for representing, tracking, and reconciling all changes within the system. |

> [accordion] ledger\_operation full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   subscription_id?: string | null,
>   unit_id?: string | null,
>   unit_type?: string | null,
>   type?: string | null,
>   amount?: string | null,
>   provisioned_start_balance?: string | null,
>   provisioned_end_balance?: string | null,
>   overdraft_start_balance?: string | null,
>   overdraft_end_balance?: string | null,
>   parent_ledger_operation_id?: string | null,
>   ledger_operation_timestamp?: number | null,
>   auto_release_timestamp?: number | null,
>   created_at?: number | null,
>   modified_at?: number | null,
>   metadata?: {
>   } | null
> } | null
> ```

***

### list

`ledgerOperations.list`

List ledger operations. Returns a list of operations meeting all the conditions specified in the filter parameters below.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.ledgerOperations.list({
	subscription_id: {},
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | Specifies the maximum number of resources to return per page. **Default and Hard Cap** \* Optional parameter; if omitted, a server-defined default is applied. \* Values exceeding the server's maximum limit are capped (clamped) to the allowed maximum. **Example →** *limit = "50"* |
| `offset` | `string` | No | Opaque cursor indicating the current position in the result set for pagination. **Behavior** \* To fetch the next page, pass the next\_offset value returned in the previous response. \* The value is opaque and must not be parsed, modified, or constructed manually. **Example →** *offset = "\\\["1771176208000","96000000006"\\]"* |
| `subscription_id` | `object` | Yes | required, string filter Filters results by subscription identifier. This is the subscription whose operations you are listing. **Supported operators :** is **Example →** *subscription\_id\\\[is\\] = "1mGETgZVF2umUZq"* |
| `unit_id` | `object` | No | optional, string filter Filters results by unit identifier. For example, a credit unit id such as `ai_credits`. **Supported operators :** is **Example →** *unit\_id\\\[is\\] = "ai\_credits"* |
| `created_at` | `object` | No | optional, timestamp(UTC) in seconds filter Filter by when the operation was recorded (`created_at`). **Supported operators :** after, before, on, between (per [List operations](https://docs.corsair.dev/docs/api/list-ops)). **Example →** *created\_at\\\[between\\] = "\\\[1771175750, 1771175800\\]"* |
| `type` | `object` | No | optional, string filter Filters results by operation type. **Supported operators :** is, in **Example →** *type\\\[is\\] = "capture"* |
| `sort_by` | `object` | No | optional, string filter Specifies the field used to sort the result set. **Supported attributes** \* `created_at` **Sort Order** \* `asc` (ascending order) \* `desc` (descending order) **Example →** *sort\_by\\\[desc\\] = "created\_at"* This sorts operations by `created_at` in descending order (most recent first). |

> [accordion] subscription\_id full type
>
> ```ts theme={null}
> {
>   is?: string
> }
> ```

> [accordion] unit\_id full type
>
> ```ts theme={null}
> {
>   is?: string
> }
> ```

> [accordion] created\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] type full type
>
> ```ts theme={null}
> {
>   is?: allocation | capture | authorize | release_authorization | capture_authorization | expiry | void | rollover | adjustment | overdraft_settlement,
>   in?: string
> }
> ```

> [accordion] sort\_by full type
>
> ```ts theme={null}
> {
>   asc?: created_at,
>   desc?: created_at
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   ledger_operation?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     unit_id?: string | null,
>     unit_type?: string | null,
>     type?: string | null,
>     amount?: string | null,
>     provisioned_start_balance?: string | null,
>     provisioned_end_balance?: string | null,
>     overdraft_start_balance?: string | null,
>     overdraft_end_balance?: string | null,
>     parent_ledger_operation_id?: string | null,
>     ledger_operation_timestamp?: number | null,
>     auto_release_timestamp?: number | null,
>     created_at?: number | null,
>     modified_at?: number | null,
>     metadata?: {
>     } | null
>   } | null
> }[] | null
> ```

***

### releaseAuthorization

`ledgerOperations.releaseAuthorization`

Release authorization. The release\_authorization operation releases previously held credits back to the usable balance, effectively canceling an existing authorization (hold). API Behavior \* Reverses an earlier authorize operation. \* Moves credits from held (reserved) → usable balance.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.ledgerOperations.releaseAuthorization({ authorization_id: 'example', ledger_operation_timestamp: 1 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `authorization_id` | `string` | Yes | Identifier of the original `authorize` operation whose hold is being released. **Behavior** \* Must reference a valid and active hold created via an `authorize` request. \* Must match the `ledger_operation_id` used in the original `authorize` call. |
| `id` | `string` | No | Optional client-supplied identifier for this release\_authorization operation. **Behavior** \* When provided, must uniquely identify this operation across the entire ledger. \* Should not conflict with any other operation, regardless of type. |
| `ledger_operation_timestamp` | `number` | Yes | Unix timestamp (in seconds) representing when the release\_authorization occurred in the upstream system. **Usage** \* Used for period attribution, grace-period eligibility, and reporting accuracy. **Note** Late or out-of-order submissions appear in arrival order, while attribution and eligibility logic rely on `ledger_operation_timestamp`. |
| `metadata` | `object` | No | Optional opaque JSON object carrying additional business context. **Behavior** \* Stored as-is and returned verbatim by the system. \* Not interpreted, validated, or indexed by the system. |

> [accordion] metadata full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `ledger_operation` | `object \| null` | No | A ledger operation represents a single action recorded in the ledger that results in a state change. Each ledger operation corresponds to one atomic event, whether initiated externally or internally. **Behavior** \* Ledger Operations are immutable once recorded. \* They provide traceability, idempotency, and a complete audit trail of all state transitions. **Usage** Serves as the fundamental unit for representing, tracking, and reconciling all changes within the system. |
| `ledger_operations` | `object[] \| null` | No | The resulting [`ledger_operations`](https://docs.corsair.dev/docs/api/ledger_operations) for this capture\_authorization. Array of one or more ledger operations. |
| `ledger_account_balance` | `object \| null` | No | Credit Grants ------------- A credit grant is a quantified allocation of credits given to a subscription through a configured [item price](https://docs.corsair.dev/docs/api/item_prices) or via the [allocate](https://docs.corsair.dev/docs/api/ledger_operations/allocate) operation, consumed over time through ledger operations. **Example** A subscription receives a credit grant of 100 AI credits as a balance. As the customer uses AI features (e.g., Image Generation), the provisioned balance is consumed first. Once exhausted, further consumption is deducted from the overdraft balance until its limit is reached. The Ledger Account Balance object --------------------------------- The `ledger_account_balance` object is a real-time snapshot of credit grants for a single combination of subscription\_id, unit\_id and unit\_type. The ledger tracks two balances: \* [**provisioned\_balance**](#provisioned_balance): Reflects the credit grants given through the configured item price or allocate operations. These are prepaid credit grants for which the customer has already paid. Any ledger operation will prioritize consuming this balance first. \* [**overdraft\_balance**](#overdraft_balance): Reflects the extra limit provided to a subscription in case it exhausts all credit grants before they are renewed or refreshed. Any ledger operation will consume this balance only when the provisioned balance has been exhausted. **Note** These two balances are always tracked together for a subscription with credit grants. **Example** A subscription has a credit grant of 100 AI credits, added to its provisioned balance. Once the provisioned balance is exhausted, further consumption is drawn from the overdraft balance up to its configured limit. screenshot\\\|/images/account\_balance.png **Returned by** \* [List ledger account balances](https://docs.corsair.dev/docs/api/ledger_account_balances/list-ledger-account-balances) API. \* Ledger [operations](https://docs.corsair.dev/docs/api/ledger_operations) such as [allocate](https://docs.corsair.dev/docs/api/ledger_operations/allocate), [capture](https://docs.corsair.dev/docs/api/ledger_operations/capture), and [authorize](https://docs.corsair.dev/docs/api/ledger_operations/authorize). |
| `grant_blocks` | `object[] \| null` | No | The [`grant_blocks`](https://docs.corsair.dev/docs/api/grant_blocks) affected by this operation, each reflecting its updated balances after the operation. |
| `ledger_entries` | `object[] \| null` | No | The [`ledger_entries`](https://docs.corsair.dev/docs/api/ledger_entries) recorded by this operation --- immutable, per-grant-block movements (typically `debit`, and `unhold` when releasing any unused hold) that make up this capture\_authorization. |

> [accordion] ledger\_operation full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   subscription_id?: string | null,
>   unit_id?: string | null,
>   unit_type?: string | null,
>   type?: string | null,
>   amount?: string | null,
>   provisioned_start_balance?: string | null,
>   provisioned_end_balance?: string | null,
>   overdraft_start_balance?: string | null,
>   overdraft_end_balance?: string | null,
>   parent_ledger_operation_id?: string | null,
>   ledger_operation_timestamp?: number | null,
>   auto_release_timestamp?: number | null,
>   created_at?: number | null,
>   modified_at?: number | null,
>   metadata?: {
>   } | null
> } | null
> ```

> [accordion] ledger\_operations full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   subscription_id?: string | null,
>   unit_id?: string | null,
>   unit_type?: string | null,
>   type?: string | null,
>   amount?: string | null,
>   provisioned_start_balance?: string | null,
>   provisioned_end_balance?: string | null,
>   overdraft_start_balance?: string | null,
>   overdraft_end_balance?: string | null,
>   parent_ledger_operation_id?: string | null,
>   ledger_operation_timestamp?: number | null,
>   auto_release_timestamp?: number | null,
>   created_at?: number | null,
>   modified_at?: number | null,
>   metadata?: {
>   } | null
> }[] | null
> ```

> [accordion] ledger\_account\_balance full type
>
> ```ts theme={null}
> {
>   subscription_id?: string | null,
>   unit_id?: string | null,
>   unit_type?: string | null,
>   created_at?: number | null,
>   modified_at?: number | null,
>   resource_version?: number | null,
>   provisioned_balance?: {
>     total_balance?: string | null,
>     usable_balance?: string | null,
>     hold_amount?: string | null
>   } | null,
>   overdraft_balance?: {
>     is_unlimited?: boolean | null,
>     limit?: string | null,
>     total_balance?: string | null,
>     usable_balance?: string | null,
>     used_amount?: string | null,
>     hold_amount?: string | null
>   } | null
> } | null
> ```

> [accordion] grant\_blocks full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   subscription_id?: string | null,
>   unit_id?: string | null,
>   unit_type?: string | null,
>   account_type?: string | null,
>   effective_from?: number | null,
>   expires_at?: number | null,
>   origin_grant_block_id?: string | null,
>   status?: string | null,
>   grant_source?: string | null,
>   created_at?: number | null,
>   modified_at?: number | null,
>   resource_version?: number | null,
>   metadata?: {
>   } | null,
>   provisioned_block_balance?: {
>     granted_amount?: string | null,
>     total_balance?: string | null,
>     usable_balance?: string | null,
>     hold_amount?: string | null,
>     used_amount?: string | null,
>     expired_amount?: string | null,
>     rolled_over_amount?: string | null,
>     voided_amount?: string | null
>   } | null,
>   overdraft_block_balance?: {
>     is_unlimited?: boolean | null,
>     limit?: string | null,
>     total_balance?: string | null,
>     usable_balance?: string | null,
>     used_amount?: string | null
>   } | null,
>   billing_metadata?: {
>     item_price_id?: string | null,
>     line_items?: {
>       id?: string | null,
>       invoice_number?: string | null,
>       quantity?: number | null
>     }[] | null
>   } | null
> }[] | null
> ```

> [accordion] ledger\_entries full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   subscription_id?: string | null,
>   unit_id?: string | null,
>   unit_type?: string | null,
>   account_type?: string | null,
>   amount?: string | null,
>   grant_block_start_balance?: string | null,
>   grant_block_end_balance?: string | null,
>   account_start_balance?: string | null,
>   account_end_balance?: string | null,
>   type?: string | null,
>   ledger_operation_id?: string | null,
>   grant_block_id?: string | null,
>   created_at?: number | null,
>   modified_at?: number | null
> }[] | null
> ```

***

## Metered Features

### archive

`meteredFeatures.archive`

Archive a metered feature. Archives a metered feature and its associated meter. The sample responses show metered features with and without group-by attributes. ### Prerequisites & Constraints \* The metered feature must be active.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.meteredFeatures.archive({ meteredFeatureId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `meteredFeatureId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `meter` | `object \| null` | No | A **meter** captures the usage measurement configuration of a [metered feature](https://docs.corsair.dev/docs/api/metered_features). ### Meter configuration examples The following response excerpts show how `query`, `column_definitions`, and `group_by` represent the metering configuration. When `query` includes a `GROUP BY` clause, the response includes `group_by` as an ordered list of the group-by attributes. Their order matches the order in the `GROUP BY` clause. The `group_by` attribute is not returned when the query does not include a `GROUP BY` clause. #### Without group-by attributes `json { "query": "SELECT SUM(request_count) FROM events WHERE status = 'completed'", "column_definitions": [ { "column_name": "request_count", "data_type": "number" }, { "column_name": "status", "data_type": "string" } ] } ` #### With group-by attributes `json { "query": "SELECT SUM(hours) FROM events WHERE status = 'completed' GROUP BY gpu_type, region", "column_definitions": [ { "column_name": "hours", "data_type": "number" }, { "column_name": "status", "data_type": "string" } ], "group_by": [ "gpu_type", "region" ] } ` Group-by attributes used only in the `GROUP BY` clause are returned in `group_by` and do not require `column_definitions` entries. |

> [accordion] meter full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   type?: string | null,
>   status?: string | null,
>   query?: string | null,
>   created_at?: number | null,
>   updated_at?: number | null,
>   group_by?: string[] | null,
>   column_definitions?: {
>     column_name?: string | null,
>     data_type?: string | null
>   }[] | null,
>   features?: {
>     id?: string | null,
>     name?: string | null,
>     description?: string | null,
>     status?: string | null,
>     type?: string | null,
>     unit?: string | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     created_at?: number | null,
>     metered?: boolean | null,
>     levels?: {
>       name?: string | null,
>       value?: string | null,
>       level?: number | null,
>       is_unlimited?: boolean | null
>     }[] | null
>   }[] | null
> } | null
> ```

***

### create

`meteredFeatures.create`

Create a metered feature. Creates a metered feature. Use query to define how Chargebee measures usage for the metered feature. The result is a single aggregate across all matching usage events. To report grouped usage, include attributes in a GROUP BY clause. Each distinct set of values forms one usage group.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.meteredFeatures.create({ feature_unit: 'example', name: 'example', query: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `name` | `string` | Yes | A case-sensitive name for the metered feature. For example: `API Calls`, `Input Tokens`. |
| `description` | `string` | No | A brief description of the metered feature. |
| `feature_unit` | `string` | Yes | Unit of measure for the metered feature, in singular form. It is pluralized automatically as needed. For example, `request` or `token`. |
| `query` | `string` | Yes | The SQL query used to calculate usage from [`usage_event`](https://docs.corsair.dev/docs/api/usage_events) properties. For example: `SELECT SUM(api_calls) FROM events WHERE status = 'completed'`. To group usage by attribute values, include a `GROUP BY` clause. Each distinct set of group-by attribute values forms a separate usage group. For example: `SELECT SUM(hours) FROM events WHERE status = 'completed' GROUP BY gpu_type, region`. The response returns the group-by attribute names in [`group_by`](https://docs.corsair.dev/docs/api/metered_features/metered-feature-object#group_by), in the same order. **Constraints** \* Properties used in the aggregate expression or `WHERE` clause must be listed in `column_definitions.column_name`. \* A group-by attribute used only in the `GROUP BY` clause does not require a `column_definitions` entry. Its value is treated as a string. \* The `GROUP BY` clause can contain up to 5 group-by attributes. \* Exact duplicate group-by attribute names are not allowed. Names are case-sensitive, so `region, region` is invalid, while `region, Region` identifies two different attributes. **Usage reporting and subscription billing** For a metered feature whose `query` includes a `GROUP BY` clause, grouped usage is available in [Retrieve usage summary for a subscription](https://docs.corsair.dev/docs/api/usage_summary/retrieve-usage-summary-for-a-subscription) and [Retrieve usages for an invoice as PDF](https://docs.corsair.dev/docs/api/usages/retrieve-usages-for-an-invoice-as-pdf). These groups are for reporting only. Subscription billing uses the overall aggregate for the metered feature and does not bill each group separately. For example, a `SUM` query can return 60 hours for `region=us-east` and 40 hours for `region=eu-west`. The reporting operations can display both groups. Subscription billing uses the overall aggregate of 100 hours. |
| `column_definitions` | `object` | No | Definitions of the columns or properties referenced by the `query`. |

> [accordion] column\_definitions full type
>
> ```ts theme={null}
> {
>   column_name: string[],
>   data_type: (number | string)[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `meter` | `object \| null` | No | A **meter** captures the usage measurement configuration of a [metered feature](https://docs.corsair.dev/docs/api/metered_features). ### Meter configuration examples The following response excerpts show how `query`, `column_definitions`, and `group_by` represent the metering configuration. When `query` includes a `GROUP BY` clause, the response includes `group_by` as an ordered list of the group-by attributes. Their order matches the order in the `GROUP BY` clause. The `group_by` attribute is not returned when the query does not include a `GROUP BY` clause. #### Without group-by attributes `json { "query": "SELECT SUM(request_count) FROM events WHERE status = 'completed'", "column_definitions": [ { "column_name": "request_count", "data_type": "number" }, { "column_name": "status", "data_type": "string" } ] } ` #### With group-by attributes `json { "query": "SELECT SUM(hours) FROM events WHERE status = 'completed' GROUP BY gpu_type, region", "column_definitions": [ { "column_name": "hours", "data_type": "number" }, { "column_name": "status", "data_type": "string" } ], "group_by": [ "gpu_type", "region" ] } ` Group-by attributes used only in the `GROUP BY` clause are returned in `group_by` and do not require `column_definitions` entries. |

> [accordion] meter full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   type?: string | null,
>   status?: string | null,
>   query?: string | null,
>   created_at?: number | null,
>   updated_at?: number | null,
>   group_by?: string[] | null,
>   column_definitions?: {
>     column_name?: string | null,
>     data_type?: string | null
>   }[] | null,
>   features?: {
>     id?: string | null,
>     name?: string | null,
>     description?: string | null,
>     status?: string | null,
>     type?: string | null,
>     unit?: string | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     created_at?: number | null,
>     metered?: boolean | null,
>     levels?: {
>       name?: string | null,
>       value?: string | null,
>       level?: number | null,
>       is_unlimited?: boolean | null
>     }[] | null
>   }[] | null
> } | null
> ```

***

### delete

`meteredFeatures.delete`

Delete a metered feature. Permanently deletes a metered feature. The sample responses show metered features with and without group-by attributes. ### Prerequisites & Constraints \* The metered feature status must not be active.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.meteredFeatures.delete({ meteredFeatureId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `meteredFeatureId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `meter` | `object \| null` | No | A **meter** captures the usage measurement configuration of a [metered feature](https://docs.corsair.dev/docs/api/metered_features). ### Meter configuration examples The following response excerpts show how `query`, `column_definitions`, and `group_by` represent the metering configuration. When `query` includes a `GROUP BY` clause, the response includes `group_by` as an ordered list of the group-by attributes. Their order matches the order in the `GROUP BY` clause. The `group_by` attribute is not returned when the query does not include a `GROUP BY` clause. #### Without group-by attributes `json { "query": "SELECT SUM(request_count) FROM events WHERE status = 'completed'", "column_definitions": [ { "column_name": "request_count", "data_type": "number" }, { "column_name": "status", "data_type": "string" } ] } ` #### With group-by attributes `json { "query": "SELECT SUM(hours) FROM events WHERE status = 'completed' GROUP BY gpu_type, region", "column_definitions": [ { "column_name": "hours", "data_type": "number" }, { "column_name": "status", "data_type": "string" } ], "group_by": [ "gpu_type", "region" ] } ` Group-by attributes used only in the `GROUP BY` clause are returned in `group_by` and do not require `column_definitions` entries. |

> [accordion] meter full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   type?: string | null,
>   status?: string | null,
>   query?: string | null,
>   created_at?: number | null,
>   updated_at?: number | null,
>   group_by?: string[] | null,
>   column_definitions?: {
>     column_name?: string | null,
>     data_type?: string | null
>   }[] | null,
>   features?: {
>     id?: string | null,
>     name?: string | null,
>     description?: string | null,
>     status?: string | null,
>     type?: string | null,
>     unit?: string | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     created_at?: number | null,
>     metered?: boolean | null,
>     levels?: {
>       name?: string | null,
>       value?: string | null,
>       level?: number | null,
>       is_unlimited?: boolean | null
>     }[] | null
>   }[] | null
> } | null
> ```

***

### reactivate

`meteredFeatures.reactivate`

Reactivate a metered feature. Restores a previously archived metered feature status back to active. The sample responses show metered features with and without group-by attributes. ### Prerequisites & Constraints \* The metered feature status must be archived.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.meteredFeatures.reactivate({ meteredFeatureId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `meteredFeatureId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `meter` | `object \| null` | No | A **meter** captures the usage measurement configuration of a [metered feature](https://docs.corsair.dev/docs/api/metered_features). ### Meter configuration examples The following response excerpts show how `query`, `column_definitions`, and `group_by` represent the metering configuration. When `query` includes a `GROUP BY` clause, the response includes `group_by` as an ordered list of the group-by attributes. Their order matches the order in the `GROUP BY` clause. The `group_by` attribute is not returned when the query does not include a `GROUP BY` clause. #### Without group-by attributes `json { "query": "SELECT SUM(request_count) FROM events WHERE status = 'completed'", "column_definitions": [ { "column_name": "request_count", "data_type": "number" }, { "column_name": "status", "data_type": "string" } ] } ` #### With group-by attributes `json { "query": "SELECT SUM(hours) FROM events WHERE status = 'completed' GROUP BY gpu_type, region", "column_definitions": [ { "column_name": "hours", "data_type": "number" }, { "column_name": "status", "data_type": "string" } ], "group_by": [ "gpu_type", "region" ] } ` Group-by attributes used only in the `GROUP BY` clause are returned in `group_by` and do not require `column_definitions` entries. |

> [accordion] meter full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   type?: string | null,
>   status?: string | null,
>   query?: string | null,
>   created_at?: number | null,
>   updated_at?: number | null,
>   group_by?: string[] | null,
>   column_definitions?: {
>     column_name?: string | null,
>     data_type?: string | null
>   }[] | null,
>   features?: {
>     id?: string | null,
>     name?: string | null,
>     description?: string | null,
>     status?: string | null,
>     type?: string | null,
>     unit?: string | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     created_at?: number | null,
>     metered?: boolean | null,
>     levels?: {
>       name?: string | null,
>       value?: string | null,
>       level?: number | null,
>       is_unlimited?: boolean | null
>     }[] | null
>   }[] | null
> } | null
> ```

***

## Meters

### list

`meters.list`

List all available meters. Retrieves the list of meters configured for the site. The sample responses show meters with and without group-by attributes.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.meters.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `name` | `object` | No | optional, string filter Filter meters based on `name`. **Supported operators :** is, starts\_with **Example →** *name\\\[starts\_with\\] = "API"* |
| `sort_by` | `object` | No | optional, string filter Sorts based on the specified attribute. **Supported attributes :** id, name, created\_at, updated\_at **Supported sort-orders :** asc, desc **Example →** *sort\_by\\\[desc\\] = "updated\_at"* This sorts the result based on the `updated_at` attribute in descending order (most recently updated first). |

> [accordion] name full type
>
> ```ts theme={null}
> {
>   is?: string,
>   starts_with?: string
> }
> ```

> [accordion] sort\_by full type
>
> ```ts theme={null}
> {
>   asc?: id | name | created_at | updated_at,
>   desc?: id | name | created_at | updated_at
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   meter?: {
>     id?: string | null,
>     name?: string | null,
>     description?: string | null,
>     type?: string | null,
>     status?: string | null,
>     query?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     group_by?: string[] | null,
>     column_definitions?: {
>       column_name?: string | null,
>       data_type?: string | null
>     }[] | null,
>     features?: {
>       id?: string | null,
>       name?: string | null,
>       description?: string | null,
>       status?: string | null,
>       type?: string | null,
>       unit?: string | null,
>       resource_version?: number | null,
>       updated_at?: number | null,
>       created_at?: number | null,
>       metered?: boolean | null,
>       levels?: {
>         name?: string | null,
>         value?: string | null,
>         level?: number | null,
>         is_unlimited?: boolean | null
>       }[] | null
>     }[] | null
>   } | null
> }[] | null
> ```

***

## Non Subscriptions

### oneTimePurchase

`nonSubscriptions.oneTimePurchase`

One time purchase. This API is used to sync consumable, non-consumable, and non-renewing product payments in Chargebee.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.nonSubscriptions.oneTimePurchase({ nonSubscriptionAppId: 'example', receipt: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `nonSubscriptionAppId` | `string` | Yes | — |
| `receipt` | `string` | Yes | **Google Play Store** : The purchase `token` taken from the Android device after successful creation of the in-app purchase. **Apple App Store** : The Base64 encoded [App Store in-app purchase receipt](https://developer.apple.com/documentation/storekit/original_api_for_in-app_purchase/validating_receipts_with_the_app_store?language=objc#overview) taken from the Apple device after successful creation of the in-app purchase. |
| `product` | `object` | No | Parameters for product |
| `customer` | `object` | No | Parameters for customer |

> [accordion] product full type
>
> ```ts theme={null}
> {
>   id: string,
>   currency_code: string,
>   price: number,
>   type: consumable | non_consumable | non_renewing_subscription,
>   name?: string,
>   price_in_decimal?: string
> }
> ```

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string,
>   email?: string,
>   first_name?: string,
>   last_name?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `non_subscription` | `object \| null` | No | **Important:** \* We've stopped giving access to the legacy solution due to the limitations mentioned [here](https://www.chargebee.com/docs/billing/2.0/mobile-subscriptions/mobile-subscriptions-limitations). Please [request access](https://app.chargebee.com/login?forward=https://app.chargebee.com/request_access/omnichannel-subscription\&ref=feature) for enabling the new [Omnichannel Subscriptions](https://docs.corsair.dev/docs/api/recorded_purchases/recorded-purchase-object) solution. \* These APIs operate asynchronously. When you receive a successful response code from an API call, it indicates only the successful submission of your request, not the completion of the operation. Using the Non-Subscription resource, you can track one-time payments made for consumable, non-consumable, and non-renewing products in Chargebee. Call this API to notify Chargebee of non-subscription purchases made at stores. |

> [accordion] non\_subscription full type
>
> ```ts theme={null}
> {
>   invoice_id?: string | null,
>   customer_id?: string | null,
>   charge_id?: string | null
> } | null
> ```

***

## Offer Events

### create

`offerEvents.create`

Create an offer event. The Create Offer Event API records user interactions with an offer for tracking and analytics purposes. Use this API to log user-triggered engagement events such as: \* viewed - when an offer is displayed to the user. \* dismissed - when the user closes or ignores the offer.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.offerEvents.create({ personalized_offer_id: 'example', type: 'viewed' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `personalized_offer_id` | `string` | Yes | The ID of the personalized offer the event pertains to. |
| `type` | `viewed \| dismissed` | Yes | The type of engagement event to be recorded. \* dismissed - Logged when the user closes or ignores the offer without accepting \* viewed - Logged when the user's UI renders or displays the offer |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `success` | `true` | Yes | Chargebee accepted the call; it answered with no body. |

***

## Offer Fulfillments

### create

`offerFulfillments.create`

Create an offer fulfillment. This API notifies that a user has accepted an offer, logs an accepted event immediately for reporting, and triggers a backend processing depending on the offer's processing\_type. You can call this API when a user accepts an offer (e.g., the user clicked Accept Offer or a similar confirmation).

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.offerFulfillments.create({ option_id: 'example', personalized_offer_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `personalized_offer_id` | `string` | Yes | ID of the personalized offer that was accepted. |
| `option_id` | `string` | Yes | ID of the Offer Option that the user accepted. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `offer_fulfillment` | `object \| null` | No | Offer fulfillment allows you to initiate, update, and retrieve the lifecycle of an offer fulfillment, after a personalized offer has been accepted. Whether the personalized offer triggers a direct billing change, a hosted checkout flow, or a redirect-based workflow, these APIs track acceptance, execution status, and completion, providing a consistent interface for fulfillment tracking and notifications. **Features of this object:** \* Records fulfillment IDs for tracking and reference. \* Captures status (`in_progress`, `completed`, `failed`). \* Stores redirect/checkout URLs as needed. \* Contains timestamps for creation, completion, or failure. \* Includes error codes and messages for failure analysis. |
| `hosted_page` | `object \| null` | No | Hosted pages are the easiest way to integrate Chargebee with your website. For card payment methods, they help meet most of your PCI DSS compliance requirements. Chargebee offers hosted pages where your customers can perform the following actions: \* [Checkout a new subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription) \* [Checkout changes to an existing subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription) \* [Manage payment sources](https://docs.corsair.dev/docs/api/hosted_pages/manage-payment-sources) \* [Make payments for all due invoices](https://docs.corsair.dev/docs/api/hosted_pages/collect-now) \* [Extending a subscription](https://docs.corsair.dev/docs/api/hosted_pages/extend-subscription) When you create a hosted page, it is available at a secure and unique URL. This URL can then be provided to your customer on your website or by other means such as email. On successful completion of the hosted page workflow by the customer, they are redirected to the `redirect_url` with the hosted page `id` and `state` passed as query string parameters. As soon as the redirection happens, [retrieve the hosted page](https://docs.corsair.dev/docs/api/hosted_pages/retrieve-a-hosted-page) to get details of the customer, subscription, invoice etc. #### Embedding a hosted page Only the [Checkout](https://docs.corsair.dev/docs/api/hosted_pages/hosted-page-object#type) hosted page with the full-page [layout](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-for-a-new-subscription#layout) supports embedding. To embed checkout in your website or application, use [embedded checkout](https://www.chargebee.com/docs/billing/2.0/hosted-capabilities/embedded-checkout.html) with Chargebee.js to mount checkout in a container on your page. Do not place hosted page URLs in your own [iframe](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe) elements---Chargebee.js creates and manages the iframe for you. |

> [accordion] offer\_fulfillment full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   personalized_offer_id?: string | null,
>   option_id?: string | null,
>   processing_type?: string | null,
>   status?: string | null,
>   redirect_url?: string | null,
>   failed_at?: number | null,
>   created_at?: number | null,
>   completed_at?: number | null,
>   error?: {
>     code?: string | null,
>     message?: string | null
>   } | null
> } | null
> ```

> [accordion] hosted\_page full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   type?: string | null,
>   url?: string | null,
>   state?: string | null,
>   pass_thru_content?: string | null,
>   created_at?: number | null,
>   expires_at?: number | null,
>   layout?: string | null,
>   content?: {
>   } | null,
>   updated_at?: number | null,
>   resource_version?: number | null,
>   checkout_info?: {
>   } | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null
> } | null
> ```

***

### get

`offerFulfillments.get`

Retrieve an offer fulfillment. This API is used to retrieve the fulfillment record. This is typically used to check the latest status of an asynchronous offer fulfillment. You can use this after creating an offer fulfillment (billing update or checkout).

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.offerFulfillments.get({ offerFulfillmentId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `offerFulfillmentId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `offer_fulfillment` | `object \| null` | No | Offer fulfillment allows you to initiate, update, and retrieve the lifecycle of an offer fulfillment, after a personalized offer has been accepted. Whether the personalized offer triggers a direct billing change, a hosted checkout flow, or a redirect-based workflow, these APIs track acceptance, execution status, and completion, providing a consistent interface for fulfillment tracking and notifications. **Features of this object:** \* Records fulfillment IDs for tracking and reference. \* Captures status (`in_progress`, `completed`, `failed`). \* Stores redirect/checkout URLs as needed. \* Contains timestamps for creation, completion, or failure. \* Includes error codes and messages for failure analysis. |

> [accordion] offer\_fulfillment full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   personalized_offer_id?: string | null,
>   option_id?: string | null,
>   processing_type?: string | null,
>   status?: string | null,
>   redirect_url?: string | null,
>   failed_at?: number | null,
>   created_at?: number | null,
>   completed_at?: number | null,
>   error?: {
>     code?: string | null,
>     message?: string | null
>   } | null
> } | null
> ```

***

### update

`offerFulfillments.update`

Update an offer fulfillment. This API is used to update the status of offer fulfillment for the processing types url\_redirect, webhook and email as Chargebee cannot automatically fulfill these offers. If status = failed, you must include a failure\_reason to explain why the fulfillment did not succeed.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.offerFulfillments.update({ offerFulfillmentId: 'example', id: 'cust_8gsnbYfsMLds', status: 'completed' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `offerFulfillmentId` | `string` | Yes | — |
| `id` | `string` | Yes | ID of the fulfillment that is being updated. |
| `status` | `completed \| failed` | Yes | Final state of the fulfillment. \* failed - Pass this if the fulfillment is failed. \* completed - Pass this if the fulfillment is completed. |
| `failure_reason` | `string` | No | Explanation for failure; required when `status` = `failed` . |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `offer_fulfillment` | `object \| null` | No | Offer fulfillment allows you to initiate, update, and retrieve the lifecycle of an offer fulfillment, after a personalized offer has been accepted. Whether the personalized offer triggers a direct billing change, a hosted checkout flow, or a redirect-based workflow, these APIs track acceptance, execution status, and completion, providing a consistent interface for fulfillment tracking and notifications. **Features of this object:** \* Records fulfillment IDs for tracking and reference. \* Captures status (`in_progress`, `completed`, `failed`). \* Stores redirect/checkout URLs as needed. \* Contains timestamps for creation, completion, or failure. \* Includes error codes and messages for failure analysis. |

> [accordion] offer\_fulfillment full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   personalized_offer_id?: string | null,
>   option_id?: string | null,
>   processing_type?: string | null,
>   status?: string | null,
>   redirect_url?: string | null,
>   failed_at?: number | null,
>   created_at?: number | null,
>   completed_at?: number | null,
>   error?: {
>     code?: string | null,
>     message?: string | null
>   } | null
> } | null
> ```

***

## Omnichannel One Time Orders

### get

`omnichannelOneTimeOrders.get`

Retrieve a one time order. Retrieves an omnichannel\_one\_time\_order by its Chargebee id. You can obtain the ID from: \* A successful record a purchase response (linked\_omnichannel\_one\_time\_orders) \* The list omnichannel one-time orders API \* Omnichannel webhook events such as omnichannel\_one\_time\_order\_created.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.omnichannelOneTimeOrders.get({ omnichannelOneTimeOrderId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `omnichannelOneTimeOrderId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `omnichannel_one_time_order` | `object \| null` | No | Represents a one-time in-app product purchase from Apple App Store or Google Play Store, normalized into Chargebee's omnichannel model. Omnichannel one-time orders are typically created when you [record a purchase](https://docs.corsair.dev/docs/api/recorded_purchases/record-a-purchase) and may be updated via store notifications (for example, refunds). Unlike subscriptions, one-time order items do not carry a recurring `status` field; cancellation is expressed via item `cancelled_at` / `cancellation_reason`. **Apple App Store** : Parent `id_at_source` is the **Transaction ID** . Nested `purchase_transaction.id_at_source` is the same Transaction ID for the purchase row. **Google Play Store** : Parent `id_at_source` is the **purchase token** . Nested `purchase_transaction.id_at_source` is the **Order ID** (`GPA....`). See [omnichannel events](https://docs.corsair.dev/docs/api/omnichannel_events) for recording and cancel mappings, and [`omnichannel_transaction`](https://docs.corsair.dev/docs/api/omnichannel_transactions) for price / `transacted_at` guidance. **Note:** This resource specifically represents in-app product purchases made via the Apple App Store and Google Play Store. |

> [accordion] omnichannel\_one\_time\_order full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   app_id?: string | null,
>   customer_id?: string | null,
>   id_at_source?: string | null,
>   origin?: string | null,
>   source?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   omnichannel_one_time_order_items?: {
>     id?: string | null,
>     item_id_at_source?: string | null,
>     item_type_at_source?: string | null,
>     quantity?: number | null,
>     cancelled_at?: number | null,
>     cancellation_reason?: string | null,
>     created_at?: number | null,
>     resource_version?: number | null
>   }[] | null,
>   purchase_transaction?: {
>     id?: string | null,
>     id_at_source?: string | null,
>     app_id?: string | null,
>     price_currency?: string | null,
>     price_units?: number | null,
>     price_nanos?: number | null,
>     type?: string | null,
>     transacted_at?: number | null,
>     created_at?: number | null,
>     resource_version?: number | null,
>     linked_omnichannel_subscriptions?: {
>       omnichannel_subscription_id?: string | null
>     }[] | null,
>     linked_omnichannel_one_time_orders?: {
>       omnichannel_one_time_order_id?: string | null
>     }[] | null
>   } | null
> } | null
> ```

***

### list

`omnichannelOneTimeOrders.list`

List omnichannel one time orders. Returns a list of omnichannel\_one\_time\_order objects. Filter by customer\_id or source (apple\_app\_store / google\_play\_store). Use this together with record a purchase and webhook events such as omnichannel\_one\_time\_order\_created to reconcile one-time purchases.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.omnichannelOneTimeOrders.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `source` | `object` | No | optional, enumerated string filter To filter based on OmnichannelOneTimeOrder Source. Possible values are : apple\_app\_store, google\_play\_store. **Supported operators :** is, is\_not, in, not\_in **Example →** *source\\\[is\_not\\] = "apple\_app\_store"* |
| `customer_id` | `object` | No | optional, string filter Chargebee Customer External Identifier. **Supported operators :** is, is\_not, starts\_with **Example →** *customer\_id\\\[is\\] = "8gsnbYfsMLds"* |

> [accordion] source full type
>
> ```ts theme={null}
> {
>   is?: apple_app_store | google_play_store | roku | amazon_app_store,
>   is_not?: apple_app_store | google_play_store | roku | amazon_app_store,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] customer\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   omnichannel_one_time_order?: {
>     id?: string | null,
>     app_id?: string | null,
>     customer_id?: string | null,
>     id_at_source?: string | null,
>     origin?: string | null,
>     source?: string | null,
>     created_at?: number | null,
>     resource_version?: number | null,
>     omnichannel_one_time_order_items?: {
>       id?: string | null,
>       item_id_at_source?: string | null,
>       item_type_at_source?: string | null,
>       quantity?: number | null,
>       cancelled_at?: number | null,
>       cancellation_reason?: string | null,
>       created_at?: number | null,
>       resource_version?: number | null
>     }[] | null,
>     purchase_transaction?: {
>       id?: string | null,
>       id_at_source?: string | null,
>       app_id?: string | null,
>       price_currency?: string | null,
>       price_units?: number | null,
>       price_nanos?: number | null,
>       type?: string | null,
>       transacted_at?: number | null,
>       created_at?: number | null,
>       resource_version?: number | null,
>       linked_omnichannel_subscriptions?: {
>         omnichannel_subscription_id?: string | null
>       }[] | null,
>       linked_omnichannel_one_time_orders?: {
>         omnichannel_one_time_order_id?: string | null
>       }[] | null
>     } | null
>   } | null
> }[] | null
> ```

***

## Omnichannel Subscription Items

### listScheduledChanges

`omnichannelSubscriptionItems.listScheduledChanges`

List scheduled changes for omnichannel subscription item. Returns scheduled changes for the specified omnichannel\_subscription\_item. Scheduled changes are created when the store will apply a product or pause change later (typically at term end), for example: \* Apple App Store : Scheduled downgrade within the same subscription group.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.omnichannelSubscriptionItems.listScheduledChanges({ omnichannelSubscriptionItemId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `omnichannelSubscriptionItemId` | `string` | Yes | — |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   omnichannel_subscription_item_scheduled_change?: {
>     id?: string | null,
>     omnichannel_subscription_item_id?: string | null,
>     scheduled_at?: number | null,
>     change_type?: string | null,
>     created_at?: number | null,
>     modified_at?: number | null,
>     resource_version?: number | null,
>     current_state?: {
>       item_id_at_source?: string | null
>     } | null,
>     scheduled_state?: {
>       item_id_at_source?: string | null
>     } | null
>   } | null
> }[] | null
> ```

***

## Omnichannel Subscriptions

### get

`omnichannelSubscriptions.get`

Retrieve an omnichannel subscription. Retrieves an omnichannel\_subscription by its Chargebee id. You can obtain the ID from: \* A successful record a purchase response (linked\_omnichannel\_subscriptions) \* The list omnichannel subscriptions API \* Omnichannel webhook events such as omnichannel\_subscription\_created.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.omnichannelSubscriptions.get({ omnichannelSubscriptionId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `omnichannelSubscriptionId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `omnichannel_subscription` | `object \| null` | No | Represents a subscription purchased and managed in an external app marketplace (`apple_app_store` or `google_play_store`), normalized into Chargebee's omnichannel model. Omnichannel subscriptions are typically created when you [record a purchase](https://docs.corsair.dev/docs/api/recorded_purchases/record-a-purchase) and are kept in sync via store server notifications. They are store-managed: lifecycle changes come from Apple or Google, not from the Chargebee Subscriptions API. Use [omnichannel statuses](https://docs.corsair.dev/docs/api/omnichannel_statuses) for how store statuses map to `omnichannel_subscription_item.status`, and [omnichannel events](https://docs.corsair.dev/docs/api/omnichannel_events) for notification-to-webhook mappings. Chargebee records introductory and promotional offers on [`omnichannel_subscription_item_offers`](https://docs.corsair.dev/docs/api/omnichannel_subscriptions/omnichannel_subscription-object#omnichannel_subscription_items_omnichannel_subscription_item_offers). Win-back offers and offer codes are not supported. **Identifier tip:** Parent `id_at_source` is the Apple **Transaction ID** or Google **purchase token** . Nested `initial_purchase_transaction.id_at_source` is the Apple **Transaction ID** or Google **Order ID** (`GPA....`). See attribute descriptions below. **Note:** This resource represents in-app subscriptions made on Apple App Store and Google Play Store. |

> [accordion] omnichannel\_subscription full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   id_at_source?: string | null,
>   app_id?: string | null,
>   source?: string | null,
>   customer_id?: string | null,
>   origin?: string | null,
>   created_at?: number | null,
>   purchased_at?: number | null,
>   updated_at?: number | null,
>   resource_version?: number | null,
>   omnichannel_subscription_items?: {
>     id?: string | null,
>     item_id_at_source?: string | null,
>     item_parent_id_at_source?: string | null,
>     status?: string | null,
>     auto_renew_status?: string | null,
>     current_term_start?: number | null,
>     current_term_end?: number | null,
>     expired_at?: number | null,
>     expiration_reason?: string | null,
>     expiration_reason_at_source?: string | null,
>     cancelled_at?: number | null,
>     cancellation_reason?: string | null,
>     cancellation_reason_at_source?: string | null,
>     grace_period_expires_at?: number | null,
>     resumes_at?: number | null,
>     has_scheduled_changes?: boolean | null,
>     updated_at?: number | null,
>     resource_version?: number | null,
>     omnichannel_subscription_item_offers?: {
>       id?: string | null,
>       offer_id_at_source?: string | null,
>       category?: string | null,
>       category_at_source?: string | null,
>       type?: string | null,
>       type_at_source?: string | null,
>       discount_type?: string | null,
>       duration?: string | null,
>       percentage?: number | null,
>       price_currency?: string | null,
>       price_units?: number | null,
>       price_nanos?: number | null,
>       offer_term_start?: number | null,
>       offer_term_end?: number | null,
>       resource_version?: number | null
>     }[] | null,
>     upcoming_renewal?: {
>       price_currency?: string | null,
>       price_units?: number | null,
>       price_nanos?: number | null
>     } | null,
>     linked_item?: {
>       id?: string | null,
>       linked_at?: number | null
>     } | null
>   }[] | null,
>   initial_purchase_transaction?: {
>     id?: string | null,
>     id_at_source?: string | null,
>     app_id?: string | null,
>     price_currency?: string | null,
>     price_units?: number | null,
>     price_nanos?: number | null,
>     type?: string | null,
>     transacted_at?: number | null,
>     created_at?: number | null,
>     resource_version?: number | null,
>     linked_omnichannel_subscriptions?: {
>       omnichannel_subscription_id?: string | null
>     }[] | null,
>     linked_omnichannel_one_time_orders?: {
>       omnichannel_one_time_order_id?: string | null
>     }[] | null
>   } | null
> } | null
> ```

***

### list

`omnichannelSubscriptions.list`

List omnichannel subscriptions. Returns a list of omnichannel\_subscription objects. Filter by Chargebee id, store-native id\_at\_source, customer\_id, source, purchase/update timestamps, or nested item attributes. Apple App Store : Filter id\_at\_source with the original purchase Transaction ID.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.omnichannelSubscriptions.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `source` | `object` | No | optional, enumerated string filter To filter based on OmnichannelSubscription Source. Possible values are : apple\_app\_store, google\_play\_store. **Supported operators :** is, is\_not, in, not\_in **Example →** *source\\\[is\_not\\] = "apple\_app\_store"* |
| `customer_id` | `object` | No | optional, string filter Chargebee Customer External Identifier. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *customer\_id\\\[is\\] = "8gsnbYfsMLds"* |
| `id` | `object` | No | optional, string filter A unique and immutable identifier for the omnichannel subscription. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *id\\\[is\\] = "os\_1mG9tGuVIecbkzR"* |
| `id_at_source` | `object` | No | optional, string filter The identifier of the subscription in the [`source`](omnichannel_subscriptions#omnichannel_subscriptions_source). **Apple App Store** : The original purchase **Transaction ID**. **Google Play Store** : The subscription **purchase token** . Google may issue a new token after certain subscription changes; Chargebee updates `id_at_source` to the latest token. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *id\_at\_source\\\[is\\] = "2000000123456789"* |
| `updated_at` | `object` | No | optional, timestamp(UTC) in seconds filter Timestamp (UTC) indicating when the subscription was last updated. **Supported operators :** after, before, on, between **Example →** *updated\_at\\\[after\\] = "1777902633"* |
| `purchased_at` | `object` | No | optional, timestamp(UTC) in seconds filter Timestamp (UTC) when the subscription was originally purchased in the respective marketplace (initial purchase). **Supported operators :** after, before, on, between **Example →** *purchased\_at\\\[after\\] = "1777559357"* |
| `sort_by` | `object` | No | optional, string filter Sorts based on the specified attribute. **Supported attributes :** created\_at, updated\_at **Supported sort-orders :** asc, desc **Example →** *sort\_by\\\[asc\\] = "created\_at"* This will sort the result based on the 'created\_at' attribute in ascending(earliest first) order. |
| `omnichannel_subscription_item` | `object` | No | Parameters for omnichannel\_subscription\_item |

> [accordion] source full type
>
> ```ts theme={null}
> {
>   is?: apple_app_store | google_play_store | roku | amazon_app_store,
>   is_not?: apple_app_store | google_play_store | roku | amazon_app_store,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] customer\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] id\_at\_source full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] updated\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   between?: string,
>   before?: string,
>   on?: string
> }
> ```

> [accordion] purchased\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   between?: string,
>   before?: string,
>   on?: string
> }
> ```

> [accordion] sort\_by full type
>
> ```ts theme={null}
> {
>   asc?: created_at | updated_at,
>   desc?: created_at | updated_at
> }
> ```

> [accordion] omnichannel\_subscription\_item full type
>
> ```ts theme={null}
> {
>   status?: {
>     is?: active | expired | cancelled | in_dunning | in_grace_period | paused,
>     is_not?: active | expired | cancelled | in_dunning | in_grace_period | paused,
>     in?: string,
>     not_in?: string
>   },
>   item_id_at_source?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   omnichannel_subscription?: {
>     id?: string | null,
>     id_at_source?: string | null,
>     app_id?: string | null,
>     source?: string | null,
>     customer_id?: string | null,
>     origin?: string | null,
>     created_at?: number | null,
>     purchased_at?: number | null,
>     updated_at?: number | null,
>     resource_version?: number | null,
>     omnichannel_subscription_items?: {
>       id?: string | null,
>       item_id_at_source?: string | null,
>       item_parent_id_at_source?: string | null,
>       status?: string | null,
>       auto_renew_status?: string | null,
>       current_term_start?: number | null,
>       current_term_end?: number | null,
>       expired_at?: number | null,
>       expiration_reason?: string | null,
>       expiration_reason_at_source?: string | null,
>       cancelled_at?: number | null,
>       cancellation_reason?: string | null,
>       cancellation_reason_at_source?: string | null,
>       grace_period_expires_at?: number | null,
>       resumes_at?: number | null,
>       has_scheduled_changes?: boolean | null,
>       updated_at?: number | null,
>       resource_version?: number | null,
>       omnichannel_subscription_item_offers?: {
>         id?: string | null,
>         offer_id_at_source?: string | null,
>         category?: string | null,
>         category_at_source?: string | null,
>         type?: string | null,
>         type_at_source?: string | null,
>         discount_type?: string | null,
>         duration?: string | null,
>         percentage?: number | null,
>         price_currency?: string | null,
>         price_units?: number | null,
>         price_nanos?: number | null,
>         offer_term_start?: number | null,
>         offer_term_end?: number | null,
>         resource_version?: number | null
>       }[] | null,
>       upcoming_renewal?: {
>         price_currency?: string | null,
>         price_units?: number | null,
>         price_nanos?: number | null
>       } | null,
>       linked_item?: {
>         id?: string | null,
>         linked_at?: number | null
>       } | null
>     }[] | null,
>     initial_purchase_transaction?: {
>       id?: string | null,
>       id_at_source?: string | null,
>       app_id?: string | null,
>       price_currency?: string | null,
>       price_units?: number | null,
>       price_nanos?: number | null,
>       type?: string | null,
>       transacted_at?: number | null,
>       created_at?: number | null,
>       resource_version?: number | null,
>       linked_omnichannel_subscriptions?: {
>         omnichannel_subscription_id?: string | null
>       }[] | null,
>       linked_omnichannel_one_time_orders?: {
>         omnichannel_one_time_order_id?: string | null
>       }[] | null
>     } | null
>   } | null
> }[] | null
> ```

***

### listTransactions

`omnichannelSubscriptions.listTransactions`

List omnichannel transactions of an omnichannel subscription. Returns the list of omnichannel\_transaction objects associated with the specified omnichannel\_subscription, including the initial purchase and subsequent renewals when available. Apple App Store : Each transaction's id\_at\_source is the App Store Transaction ID .

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.omnichannelSubscriptions.listTransactions({ omnichannelSubscriptionId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `omnichannelSubscriptionId` | `string` | Yes | — |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   omnichannel_transaction?: {
>     id?: string | null,
>     id_at_source?: string | null,
>     app_id?: string | null,
>     price_currency?: string | null,
>     price_units?: number | null,
>     price_nanos?: number | null,
>     type?: string | null,
>     transacted_at?: number | null,
>     created_at?: number | null,
>     resource_version?: number | null,
>     linked_omnichannel_subscriptions?: {
>       omnichannel_subscription_id?: string | null
>     }[] | null,
>     linked_omnichannel_one_time_orders?: {
>       omnichannel_one_time_order_id?: string | null
>     }[] | null
>   } | null
> }[] | null
> ```

***

### move

`omnichannelSubscriptions.move`

Move an omnichannel subscription. Moves an omnichannel\_subscription to another customer in Chargebee. ### Prerequisites \* The target customer must already exist in Chargebee (or be creatable via your usual customer APIs before calling this operation). \* The omnichannel subscription must already be recorded in Chargebee.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.omnichannelSubscriptions.move({ omnichannelSubscriptionId: 'example', to_customer_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `omnichannelSubscriptionId` | `string` | Yes | — |
| `to_customer_id` | `string` | Yes | Specifies the unique ID of the `customer` resource to which the subscription will be moved. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `omnichannel_subscription` | `object \| null` | No | Represents a subscription purchased and managed in an external app marketplace (`apple_app_store` or `google_play_store`), normalized into Chargebee's omnichannel model. Omnichannel subscriptions are typically created when you [record a purchase](https://docs.corsair.dev/docs/api/recorded_purchases/record-a-purchase) and are kept in sync via store server notifications. They are store-managed: lifecycle changes come from Apple or Google, not from the Chargebee Subscriptions API. Use [omnichannel statuses](https://docs.corsair.dev/docs/api/omnichannel_statuses) for how store statuses map to `omnichannel_subscription_item.status`, and [omnichannel events](https://docs.corsair.dev/docs/api/omnichannel_events) for notification-to-webhook mappings. Chargebee records introductory and promotional offers on [`omnichannel_subscription_item_offers`](https://docs.corsair.dev/docs/api/omnichannel_subscriptions/omnichannel_subscription-object#omnichannel_subscription_items_omnichannel_subscription_item_offers). Win-back offers and offer codes are not supported. **Identifier tip:** Parent `id_at_source` is the Apple **Transaction ID** or Google **purchase token** . Nested `initial_purchase_transaction.id_at_source` is the Apple **Transaction ID** or Google **Order ID** (`GPA....`). See attribute descriptions below. **Note:** This resource represents in-app subscriptions made on Apple App Store and Google Play Store. |

> [accordion] omnichannel\_subscription full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   id_at_source?: string | null,
>   app_id?: string | null,
>   source?: string | null,
>   customer_id?: string | null,
>   origin?: string | null,
>   created_at?: number | null,
>   purchased_at?: number | null,
>   updated_at?: number | null,
>   resource_version?: number | null,
>   omnichannel_subscription_items?: {
>     id?: string | null,
>     item_id_at_source?: string | null,
>     item_parent_id_at_source?: string | null,
>     status?: string | null,
>     auto_renew_status?: string | null,
>     current_term_start?: number | null,
>     current_term_end?: number | null,
>     expired_at?: number | null,
>     expiration_reason?: string | null,
>     expiration_reason_at_source?: string | null,
>     cancelled_at?: number | null,
>     cancellation_reason?: string | null,
>     cancellation_reason_at_source?: string | null,
>     grace_period_expires_at?: number | null,
>     resumes_at?: number | null,
>     has_scheduled_changes?: boolean | null,
>     updated_at?: number | null,
>     resource_version?: number | null,
>     omnichannel_subscription_item_offers?: {
>       id?: string | null,
>       offer_id_at_source?: string | null,
>       category?: string | null,
>       category_at_source?: string | null,
>       type?: string | null,
>       type_at_source?: string | null,
>       discount_type?: string | null,
>       duration?: string | null,
>       percentage?: number | null,
>       price_currency?: string | null,
>       price_units?: number | null,
>       price_nanos?: number | null,
>       offer_term_start?: number | null,
>       offer_term_end?: number | null,
>       resource_version?: number | null
>     }[] | null,
>     upcoming_renewal?: {
>       price_currency?: string | null,
>       price_units?: number | null,
>       price_nanos?: number | null
>     } | null,
>     linked_item?: {
>       id?: string | null,
>       linked_at?: number | null
>     } | null
>   }[] | null,
>   initial_purchase_transaction?: {
>     id?: string | null,
>     id_at_source?: string | null,
>     app_id?: string | null,
>     price_currency?: string | null,
>     price_units?: number | null,
>     price_nanos?: number | null,
>     type?: string | null,
>     transacted_at?: number | null,
>     created_at?: number | null,
>     resource_version?: number | null,
>     linked_omnichannel_subscriptions?: {
>       omnichannel_subscription_id?: string | null
>     }[] | null,
>     linked_omnichannel_one_time_orders?: {
>       omnichannel_one_time_order_id?: string | null
>     }[] | null
>   } | null
> } | null
> ```

***

## Orders

### assignOrderNumber

`orders.assignOrderNumber`

Assign order number. Assigns order number to the order based on the settings, if not already assigned.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.orders.assignOrderNumber({ orderId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `orderId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `order` | `object \| null` | No | **Note:** This doc is for the latest version of Chargebee Orders. If you enabled Chargebee Orders before *September-30-2018* , you may be using the legacy version of the feature and its API. For help in migrating to the current system or using the legacy API for Chargebee Orders, please [contact 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) Orders are automatically generated for an invoice when it gets paid, based on the shipping preference chosen for the invoice's product and the shipping date configuration. They can be updated either via api or merchant web console (a.k.a admin console). |

> [accordion] order full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   document_number?: string | null,
>   invoice_id?: string | null,
>   subscription_id?: string | null,
>   customer_id?: string | null,
>   status?: string | null,
>   cancellation_reason?: string | null,
>   payment_status?: string | null,
>   order_type?: string | null,
>   price_type?: string | null,
>   reference_id?: string | null,
>   fulfillment_status?: string | null,
>   order_date?: number | null,
>   shipping_date?: number | null,
>   note?: string | null,
>   tracking_id?: string | null,
>   tracking_url?: string | null,
>   batch_id?: string | null,
>   created_by?: string | null,
>   shipment_carrier?: string | null,
>   invoice_round_off_amount?: number | null,
>   tax?: number | null,
>   amount_paid?: number | null,
>   amount_adjusted?: number | null,
>   refundable_credits_issued?: number | null,
>   refundable_credits?: number | null,
>   rounding_adjustement?: number | null,
>   paid_on?: number | null,
>   shipping_cut_off_date?: number | null,
>   created_at?: number | null,
>   status_update_at?: number | null,
>   delivered_at?: number | null,
>   shipped_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   cancelled_at?: number | null,
>   resent_status?: string | null,
>   is_resent?: boolean | null,
>   original_order_id?: string | null,
>   discount?: number | null,
>   sub_total?: number | null,
>   total?: number | null,
>   deleted?: boolean | null,
>   currency_code?: string | null,
>   is_gifted?: boolean | null,
>   gift_note?: string | null,
>   gift_id?: string | null,
>   resend_reason?: string | null,
>   business_entity_id?: string | null,
>   order_line_items?: {
>     id?: string | null,
>     invoice_id?: string | null,
>     invoice_line_item_id?: string | null,
>     unit_price?: number | null,
>     description?: string | null,
>     amount?: number | null,
>     fulfillment_quantity?: number | null,
>     fulfillment_amount?: number | null,
>     tax_amount?: number | null,
>     amount_paid?: number | null,
>     amount_adjusted?: number | null,
>     refundable_credits_issued?: number | null,
>     refundable_credits?: number | null,
>     is_shippable?: boolean | null,
>     sku?: string | null,
>     status?: string | null,
>     entity_type?: string | null,
>     item_level_discount_amount?: number | null,
>     discount_amount?: number | null,
>     entity_id?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   linked_credit_notes?: {
>     amount?: number | null,
>     type?: string | null,
>     id?: string | null,
>     status?: string | null,
>     amount_adjusted?: number | null,
>     amount_refunded?: number | null
>   }[] | null,
>   resent_orders?: {
>     order_id?: string | null,
>     reason?: string | null,
>     amount?: number | null
>   }[] | null
> } | null
> ```

***

### cancel

`orders.cancel`

Cancel an order. Cancel order and create a refundable credit note for the order.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.orders.cancel({ orderId: 'example', cancellation_reason: 'shipping_cut_off_passed' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `orderId` | `string` | Yes | — |
| `cancellation_reason` | `shipping_cut_off_passed \| product_unsatisfactory \| third_party_cancellation \| product_not_required \| delivery_date_missed \| alternative_found \| invoice_written_off \| invoice_voided \| fraudulent_transaction \| payment_declined \| subscription_cancelled \| product_not_available \| others \| order_resent` | Yes | Cancellation reason. \* shipping\_cut\_off\_passed - The invoice has been paid late and Chargebee cancel's the first order for the invoice. \* alternative\_found - Alternative found. \* others - Other reason \* product\_unsatisfactory - Product unsatisfactory. \* product\_not\_required - Product not required. \* delivery\_date\_missed - Delivery date missed. \* invoice\_voided - The invoice for which the order was createed has been voided. \* payment\_declined - Payment declined. \* product\_not\_available - Product not available. \* subscription\_cancelled - The subsctiption for which the order was created has been cancelled. \* third\_party\_cancellation - Third party cancellation. \* fraudulent\_transaction - Fraudulent transaction. \* order\_resent - Order resent \* invoice\_written\_off - The invoice has been completely written off. Orders are generated by Chargebee in cancelled state. |
| `customer_notes` | `string` | No | The Customer Notes to be filled in the Credit Notes created to capture this refund detail. |
| `comment` | `string` | No | Comment, if any, on the refund. |
| `cancelled_at` | `number` | No | The time at which the order was cancelled. |
| `credit_note` | `object` | No | Parameters for credit\_note |

> [accordion] credit\_note full type
>
> ```ts theme={null}
> {
>   total?: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `order` | `object \| null` | No | **Note:** This doc is for the latest version of Chargebee Orders. If you enabled Chargebee Orders before *September-30-2018* , you may be using the legacy version of the feature and its API. For help in migrating to the current system or using the legacy API for Chargebee Orders, please [contact 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) Orders are automatically generated for an invoice when it gets paid, based on the shipping preference chosen for the invoice's product and the shipping date configuration. They can be updated either via api or merchant web console (a.k.a admin console). |

> [accordion] order full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   document_number?: string | null,
>   invoice_id?: string | null,
>   subscription_id?: string | null,
>   customer_id?: string | null,
>   status?: string | null,
>   cancellation_reason?: string | null,
>   payment_status?: string | null,
>   order_type?: string | null,
>   price_type?: string | null,
>   reference_id?: string | null,
>   fulfillment_status?: string | null,
>   order_date?: number | null,
>   shipping_date?: number | null,
>   note?: string | null,
>   tracking_id?: string | null,
>   tracking_url?: string | null,
>   batch_id?: string | null,
>   created_by?: string | null,
>   shipment_carrier?: string | null,
>   invoice_round_off_amount?: number | null,
>   tax?: number | null,
>   amount_paid?: number | null,
>   amount_adjusted?: number | null,
>   refundable_credits_issued?: number | null,
>   refundable_credits?: number | null,
>   rounding_adjustement?: number | null,
>   paid_on?: number | null,
>   shipping_cut_off_date?: number | null,
>   created_at?: number | null,
>   status_update_at?: number | null,
>   delivered_at?: number | null,
>   shipped_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   cancelled_at?: number | null,
>   resent_status?: string | null,
>   is_resent?: boolean | null,
>   original_order_id?: string | null,
>   discount?: number | null,
>   sub_total?: number | null,
>   total?: number | null,
>   deleted?: boolean | null,
>   currency_code?: string | null,
>   is_gifted?: boolean | null,
>   gift_note?: string | null,
>   gift_id?: string | null,
>   resend_reason?: string | null,
>   business_entity_id?: string | null,
>   order_line_items?: {
>     id?: string | null,
>     invoice_id?: string | null,
>     invoice_line_item_id?: string | null,
>     unit_price?: number | null,
>     description?: string | null,
>     amount?: number | null,
>     fulfillment_quantity?: number | null,
>     fulfillment_amount?: number | null,
>     tax_amount?: number | null,
>     amount_paid?: number | null,
>     amount_adjusted?: number | null,
>     refundable_credits_issued?: number | null,
>     refundable_credits?: number | null,
>     is_shippable?: boolean | null,
>     sku?: string | null,
>     status?: string | null,
>     entity_type?: string | null,
>     item_level_discount_amount?: number | null,
>     discount_amount?: number | null,
>     entity_id?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   linked_credit_notes?: {
>     amount?: number | null,
>     type?: string | null,
>     id?: string | null,
>     status?: string | null,
>     amount_adjusted?: number | null,
>     amount_refunded?: number | null
>   }[] | null,
>   resent_orders?: {
>     order_id?: string | null,
>     reason?: string | null,
>     amount?: number | null
>   }[] | null
> } | null
> ```

***

### create

`orders.create`

Create an order. #### Deprecated Chargebee no longer supports this endpoint, see here for more information. Contact Support for additional assistance or if you have concerns about this update.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.orders.create({ invoice_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `id` | `string` | No | Uniquely identifies the order. If not given, this will be auto-generated. |
| `invoice_id` | `string` | Yes | The invoice number which acts as an identifier for invoice and is generated sequentially. |
| `status` | `new \| processing \| complete \| cancelled \| voided` | No | The order status. \* cancelled - Order has been cancelled. Applicable only if you are using Chargebee's legacy order management system \* new - Order has been created. Applicable only if you are using Chargebee's legacy order management system. \* voided - Order has been voided. Applicable only if you are using Chargebee's legacy order management system \* complete - Order has been processed successfully. Applicable only if you are using Chargebee's legacy order management system \* processing - Order is being processed. Applicable only if you are using Chargebee's legacy order management system |
| `reference_id` | `string` | No | Reference id can be used to map the orders in the shipping/order management application to the orders in ChargeBee. The reference\_id generally is same as the order id in the third party application. |
| `fulfillment_status` | `string` | No | The fulfillment status of an order as reflected in the shipping/order management application. Typical statuses include Shipped,Awaiting Shipment,Not fulfilled etc;. |
| `note` | `string` | No | The custom note for the order. |
| `tracking_id` | `string` | No | The tracking id of the order. |
| `tracking_url` | `string` | No | The tracking url of the order. |
| `batch_id` | `string` | No | Unique id to identify a group of orders. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `order` | `object \| null` | No | **Note:** This doc is for the latest version of Chargebee Orders. If you enabled Chargebee Orders before *September-30-2018* , you may be using the legacy version of the feature and its API. For help in migrating to the current system or using the legacy API for Chargebee Orders, please [contact 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) Orders are automatically generated for an invoice when it gets paid, based on the shipping preference chosen for the invoice's product and the shipping date configuration. They can be updated either via api or merchant web console (a.k.a admin console). |

> [accordion] order full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   document_number?: string | null,
>   invoice_id?: string | null,
>   subscription_id?: string | null,
>   customer_id?: string | null,
>   status?: string | null,
>   cancellation_reason?: string | null,
>   payment_status?: string | null,
>   order_type?: string | null,
>   price_type?: string | null,
>   reference_id?: string | null,
>   fulfillment_status?: string | null,
>   order_date?: number | null,
>   shipping_date?: number | null,
>   note?: string | null,
>   tracking_id?: string | null,
>   tracking_url?: string | null,
>   batch_id?: string | null,
>   created_by?: string | null,
>   shipment_carrier?: string | null,
>   invoice_round_off_amount?: number | null,
>   tax?: number | null,
>   amount_paid?: number | null,
>   amount_adjusted?: number | null,
>   refundable_credits_issued?: number | null,
>   refundable_credits?: number | null,
>   rounding_adjustement?: number | null,
>   paid_on?: number | null,
>   shipping_cut_off_date?: number | null,
>   created_at?: number | null,
>   status_update_at?: number | null,
>   delivered_at?: number | null,
>   shipped_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   cancelled_at?: number | null,
>   resent_status?: string | null,
>   is_resent?: boolean | null,
>   original_order_id?: string | null,
>   discount?: number | null,
>   sub_total?: number | null,
>   total?: number | null,
>   deleted?: boolean | null,
>   currency_code?: string | null,
>   is_gifted?: boolean | null,
>   gift_note?: string | null,
>   gift_id?: string | null,
>   resend_reason?: string | null,
>   business_entity_id?: string | null,
>   order_line_items?: {
>     id?: string | null,
>     invoice_id?: string | null,
>     invoice_line_item_id?: string | null,
>     unit_price?: number | null,
>     description?: string | null,
>     amount?: number | null,
>     fulfillment_quantity?: number | null,
>     fulfillment_amount?: number | null,
>     tax_amount?: number | null,
>     amount_paid?: number | null,
>     amount_adjusted?: number | null,
>     refundable_credits_issued?: number | null,
>     refundable_credits?: number | null,
>     is_shippable?: boolean | null,
>     sku?: string | null,
>     status?: string | null,
>     entity_type?: string | null,
>     item_level_discount_amount?: number | null,
>     discount_amount?: number | null,
>     entity_id?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   linked_credit_notes?: {
>     amount?: number | null,
>     type?: string | null,
>     id?: string | null,
>     status?: string | null,
>     amount_adjusted?: number | null,
>     amount_refunded?: number | null
>   }[] | null,
>   resent_orders?: {
>     order_id?: string | null,
>     reason?: string | null,
>     amount?: number | null
>   }[] | null
> } | null
> ```

***

### createRefundableCreditNote

`orders.createRefundableCreditNote`

Create a refundable credit note. This API is used to create a refundable credit note for the order.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.orders.createRefundableCreditNote({ orderId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `orderId` | `string` | Yes | — |
| `customer_notes` | `string` | No | The Customer Notes to be filled in the Credit Notes created to capture this refund detail. |
| `comment` | `string` | No | Comment, if any, on the refund. |
| `credit_note` | `object` | No | Parameters for credit\_note |

> [accordion] credit\_note full type
>
> ```ts theme={null}
> {
>   reason_code: write_off | subscription_change | subscription_cancellation | subscription_pause | chargeback | product_unsatisfactory | service_unsatisfactory | order_change | order_cancellation | waiver | other | fraudulent,
>   total: number
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `order` | `object \| null` | No | **Note:** This doc is for the latest version of Chargebee Orders. If you enabled Chargebee Orders before *September-30-2018* , you may be using the legacy version of the feature and its API. For help in migrating to the current system or using the legacy API for Chargebee Orders, please [contact 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) Orders are automatically generated for an invoice when it gets paid, based on the shipping preference chosen for the invoice's product and the shipping date configuration. They can be updated either via api or merchant web console (a.k.a admin console). |

> [accordion] order full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   document_number?: string | null,
>   invoice_id?: string | null,
>   subscription_id?: string | null,
>   customer_id?: string | null,
>   status?: string | null,
>   cancellation_reason?: string | null,
>   payment_status?: string | null,
>   order_type?: string | null,
>   price_type?: string | null,
>   reference_id?: string | null,
>   fulfillment_status?: string | null,
>   order_date?: number | null,
>   shipping_date?: number | null,
>   note?: string | null,
>   tracking_id?: string | null,
>   tracking_url?: string | null,
>   batch_id?: string | null,
>   created_by?: string | null,
>   shipment_carrier?: string | null,
>   invoice_round_off_amount?: number | null,
>   tax?: number | null,
>   amount_paid?: number | null,
>   amount_adjusted?: number | null,
>   refundable_credits_issued?: number | null,
>   refundable_credits?: number | null,
>   rounding_adjustement?: number | null,
>   paid_on?: number | null,
>   shipping_cut_off_date?: number | null,
>   created_at?: number | null,
>   status_update_at?: number | null,
>   delivered_at?: number | null,
>   shipped_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   cancelled_at?: number | null,
>   resent_status?: string | null,
>   is_resent?: boolean | null,
>   original_order_id?: string | null,
>   discount?: number | null,
>   sub_total?: number | null,
>   total?: number | null,
>   deleted?: boolean | null,
>   currency_code?: string | null,
>   is_gifted?: boolean | null,
>   gift_note?: string | null,
>   gift_id?: string | null,
>   resend_reason?: string | null,
>   business_entity_id?: string | null,
>   order_line_items?: {
>     id?: string | null,
>     invoice_id?: string | null,
>     invoice_line_item_id?: string | null,
>     unit_price?: number | null,
>     description?: string | null,
>     amount?: number | null,
>     fulfillment_quantity?: number | null,
>     fulfillment_amount?: number | null,
>     tax_amount?: number | null,
>     amount_paid?: number | null,
>     amount_adjusted?: number | null,
>     refundable_credits_issued?: number | null,
>     refundable_credits?: number | null,
>     is_shippable?: boolean | null,
>     sku?: string | null,
>     status?: string | null,
>     entity_type?: string | null,
>     item_level_discount_amount?: number | null,
>     discount_amount?: number | null,
>     entity_id?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   linked_credit_notes?: {
>     amount?: number | null,
>     type?: string | null,
>     id?: string | null,
>     status?: string | null,
>     amount_adjusted?: number | null,
>     amount_refunded?: number | null
>   }[] | null,
>   resent_orders?: {
>     order_id?: string | null,
>     reason?: string | null,
>     amount?: number | null
>   }[] | null
> } | null
> ```

***

### delete

`orders.delete`

Delete an imported order. Deletes only Imported Order .Delete does not happen if the order was refunded. It goes through if order refund was initiated and is in "refund\_due" state.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.orders.delete({ orderId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `orderId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `order` | `object \| null` | No | **Note:** This doc is for the latest version of Chargebee Orders. If you enabled Chargebee Orders before *September-30-2018* , you may be using the legacy version of the feature and its API. For help in migrating to the current system or using the legacy API for Chargebee Orders, please [contact 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) Orders are automatically generated for an invoice when it gets paid, based on the shipping preference chosen for the invoice's product and the shipping date configuration. They can be updated either via api or merchant web console (a.k.a admin console). |

> [accordion] order full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   document_number?: string | null,
>   invoice_id?: string | null,
>   subscription_id?: string | null,
>   customer_id?: string | null,
>   status?: string | null,
>   cancellation_reason?: string | null,
>   payment_status?: string | null,
>   order_type?: string | null,
>   price_type?: string | null,
>   reference_id?: string | null,
>   fulfillment_status?: string | null,
>   order_date?: number | null,
>   shipping_date?: number | null,
>   note?: string | null,
>   tracking_id?: string | null,
>   tracking_url?: string | null,
>   batch_id?: string | null,
>   created_by?: string | null,
>   shipment_carrier?: string | null,
>   invoice_round_off_amount?: number | null,
>   tax?: number | null,
>   amount_paid?: number | null,
>   amount_adjusted?: number | null,
>   refundable_credits_issued?: number | null,
>   refundable_credits?: number | null,
>   rounding_adjustement?: number | null,
>   paid_on?: number | null,
>   shipping_cut_off_date?: number | null,
>   created_at?: number | null,
>   status_update_at?: number | null,
>   delivered_at?: number | null,
>   shipped_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   cancelled_at?: number | null,
>   resent_status?: string | null,
>   is_resent?: boolean | null,
>   original_order_id?: string | null,
>   discount?: number | null,
>   sub_total?: number | null,
>   total?: number | null,
>   deleted?: boolean | null,
>   currency_code?: string | null,
>   is_gifted?: boolean | null,
>   gift_note?: string | null,
>   gift_id?: string | null,
>   resend_reason?: string | null,
>   business_entity_id?: string | null,
>   order_line_items?: {
>     id?: string | null,
>     invoice_id?: string | null,
>     invoice_line_item_id?: string | null,
>     unit_price?: number | null,
>     description?: string | null,
>     amount?: number | null,
>     fulfillment_quantity?: number | null,
>     fulfillment_amount?: number | null,
>     tax_amount?: number | null,
>     amount_paid?: number | null,
>     amount_adjusted?: number | null,
>     refundable_credits_issued?: number | null,
>     refundable_credits?: number | null,
>     is_shippable?: boolean | null,
>     sku?: string | null,
>     status?: string | null,
>     entity_type?: string | null,
>     item_level_discount_amount?: number | null,
>     discount_amount?: number | null,
>     entity_id?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   linked_credit_notes?: {
>     amount?: number | null,
>     type?: string | null,
>     id?: string | null,
>     status?: string | null,
>     amount_adjusted?: number | null,
>     amount_refunded?: number | null
>   }[] | null,
>   resent_orders?: {
>     order_id?: string | null,
>     reason?: string | null,
>     amount?: number | null
>   }[] | null
> } | null
> ```

***

### get

`orders.get`

Retrieve an order. Retrieves an order corresponding to the order id passed.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.orders.get({ orderId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `orderId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `order` | `object \| null` | No | **Note:** This doc is for the latest version of Chargebee Orders. If you enabled Chargebee Orders before *September-30-2018* , you may be using the legacy version of the feature and its API. For help in migrating to the current system or using the legacy API for Chargebee Orders, please [contact 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) Orders are automatically generated for an invoice when it gets paid, based on the shipping preference chosen for the invoice's product and the shipping date configuration. They can be updated either via api or merchant web console (a.k.a admin console). |

> [accordion] order full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   document_number?: string | null,
>   invoice_id?: string | null,
>   subscription_id?: string | null,
>   customer_id?: string | null,
>   status?: string | null,
>   cancellation_reason?: string | null,
>   payment_status?: string | null,
>   order_type?: string | null,
>   price_type?: string | null,
>   reference_id?: string | null,
>   fulfillment_status?: string | null,
>   order_date?: number | null,
>   shipping_date?: number | null,
>   note?: string | null,
>   tracking_id?: string | null,
>   tracking_url?: string | null,
>   batch_id?: string | null,
>   created_by?: string | null,
>   shipment_carrier?: string | null,
>   invoice_round_off_amount?: number | null,
>   tax?: number | null,
>   amount_paid?: number | null,
>   amount_adjusted?: number | null,
>   refundable_credits_issued?: number | null,
>   refundable_credits?: number | null,
>   rounding_adjustement?: number | null,
>   paid_on?: number | null,
>   shipping_cut_off_date?: number | null,
>   created_at?: number | null,
>   status_update_at?: number | null,
>   delivered_at?: number | null,
>   shipped_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   cancelled_at?: number | null,
>   resent_status?: string | null,
>   is_resent?: boolean | null,
>   original_order_id?: string | null,
>   discount?: number | null,
>   sub_total?: number | null,
>   total?: number | null,
>   deleted?: boolean | null,
>   currency_code?: string | null,
>   is_gifted?: boolean | null,
>   gift_note?: string | null,
>   gift_id?: string | null,
>   resend_reason?: string | null,
>   business_entity_id?: string | null,
>   order_line_items?: {
>     id?: string | null,
>     invoice_id?: string | null,
>     invoice_line_item_id?: string | null,
>     unit_price?: number | null,
>     description?: string | null,
>     amount?: number | null,
>     fulfillment_quantity?: number | null,
>     fulfillment_amount?: number | null,
>     tax_amount?: number | null,
>     amount_paid?: number | null,
>     amount_adjusted?: number | null,
>     refundable_credits_issued?: number | null,
>     refundable_credits?: number | null,
>     is_shippable?: boolean | null,
>     sku?: string | null,
>     status?: string | null,
>     entity_type?: string | null,
>     item_level_discount_amount?: number | null,
>     discount_amount?: number | null,
>     entity_id?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   linked_credit_notes?: {
>     amount?: number | null,
>     type?: string | null,
>     id?: string | null,
>     status?: string | null,
>     amount_adjusted?: number | null,
>     amount_refunded?: number | null
>   }[] | null,
>   resent_orders?: {
>     order_id?: string | null,
>     reason?: string | null,
>     amount?: number | null
>   }[] | null
> } | null
> ```

***

### import

`orders.import`

Import an order. for an invoice with one or more line items. The import order bulk operation is to be applied on an imported invoice.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.orders.import({
	created_at: 1,
	invoice_id: 'example',
	order_date: 1,
	shipping_date: 1,
	status: 'cancelled',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `id` | `string` | No | Uniquely identifies the order. It is the api identifier for the order. \\*Order id will always be assigned incrementally from the last generated Order ID. If Orders imported has an Order ID which is a string, Chargebee will just validate if the Order ID is unique Recommendation: For orders being imported, set the same prefix and the serial number that is used for the Document number, which will make this into a string. This will ensure that imported orders don't conflict with orders created by Chargebee. Chargebee will ensure there aren't orders with duplicate Order IDs.\\* . |
| `document_number` | `string` | No | The order's serial number. *Document number passed cannot be greater than the series mentioned in the configuration. For instance, if you have set Document number series in Order Configurations with a Prefix as 'ORDER' and Starting number as '1000', orders up to the sequence number 'ORDER999' can be imported into Chargebee* *Recommendation: Set a different prefix at the Order Configuration, than the ones that are imported. If your Order Configuration has a Prefix of 'NEW', with Starting number as '1', i.e. 'NEW1', then, set Prefix for imported orders to be as 'OLD', with Starting number as '1', i.e, 'OLD1'* . |
| `invoice_id` | `string` | Yes | The invoice number which acts as an identifier for invoice and is generated sequentially. |
| `status` | `cancelled \| queued \| awaiting_shipment \| on_hold \| delivered \| shipped \| partially_delivered \| returned` | Yes | The status of this order. \* shipped - The order has moved from order management system to a shipping system. \* queued - Order is yet to be processed by any system, these are scheduled orders created by Chargebee \* on\_hold - The order is paused from being processed. \* returned - The order has been returned after delivery. \* delivered - The order has been delivered to the customer. \* awaiting\_shipment - The order has been picked up by an integration system, and synced to a shipping management platform \* cancelled - Order has been cancelled. Applicable only if you are using Chargebee's legacy order management system \* partially\_delivered - The order has been partially delivered to the customer. |
| `subscription_id` | `string` | No | The subscription for which the order is created. |
| `customer_id` | `string` | No | The customer for which the order is created. |
| `created_at` | `number` | Yes | The time at which the order was created. |
| `order_date` | `number` | Yes | The date on which the order will start getting processed. |
| `shipping_date` | `number` | Yes | This is the date on which the order has to be shipped to the customer. |
| `reference_id` | `string` | No | Reference id can be used to map the orders in the shipping/order management application to the orders in ChargeBee. The reference\_id generally is the same as the order id in the third party application. *Recommendation: If this order is in any of these statuses, awaiting\_shipment, on\_hold, delivered, shipped, partially\_delivered, returned, and has already been processed, through a 3rd party system, and you have a reference id of the entity in the 3rd party tool, pass in the entity id to this field. If not, set the same prefix and the serial number that is used for the Document number, which will make this into a string.* *If this order hasn't been processed and is in 'queued' status, do not pass any value to this field. Chargebee, when it syncs your Orders through the fulfilment integrations such as Shipstation or Shopify, would auto assign the reference id from the connected system.* . |
| `fulfillment_status` | `string` | No | The fulfillment status of an order as reflected in the shipping/order management application. Typical statuses include Shipped,Awaiting Shipment,Not fulfilled etc;. \\*If this order is in any of these statuses, awaiting\_shipment, on\_hold, delivered, shipped, partially\_delivered, returned, and has already been processed, through a 3rd party system, and you have a corresponding status from the 3rd party tool, pass in the status to this field. If this order hasn't been processed and is in 'queued' status, do not pass any value to this field. Chargebee, when it syncs your Orders through the fulfilment integrations such as Shipstation or Shopify, would auto assign the fulfilment status from the connected system.\\* . |
| `note` | `string` | No | The custom note for the order. |
| `tracking_id` | `string` | No | The tracking id of the order. |
| `tracking_url` | `string` | No | The tracking url of the order. |
| `batch_id` | `string` | No | Unique id to identify a group of orders. |
| `shipment_carrier` | `string` | No | Shipment carrier. |
| `shipping_cut_off_date` | `number` | No | The time after which an order becomes unservicable. |
| `delivered_at` | `number` | No | The time at which the order was delivered. |
| `shipped_at` | `number` | No | The time at which the order was shipped. |
| `cancelled_at` | `number` | No | The time at which the order was cancelled. |
| `cancellation_reason` | `shipping_cut_off_passed \| product_unsatisfactory \| third_party_cancellation \| product_not_required \| delivery_date_missed \| alternative_found \| invoice_written_off \| invoice_voided \| fraudulent_transaction \| payment_declined \| subscription_cancelled \| product_not_available \| others \| order_resent` | No | Cancellation reason. \* shipping\_cut\_off\_passed - The invoice has been paid late and Chargebee cancel's the first order for the invoice. \* invoice\_voided - The invoice for which the order was createed has been voided. \* alternative\_found - Alternative found. \* others - Other reason \* order\_resent - Order resent \* product\_unsatisfactory - Product unsatisfactory. \* delivery\_date\_missed - Delivery date missed. \* subscription\_cancelled - The subsctiption for which the order was created has been cancelled. \* fraudulent\_transaction - Fraudulent transaction. \* invoice\_written\_off - The invoice has been completely written off. Orders are generated by Chargebee in cancelled state. \* product\_not\_required - Product not required. \* payment\_declined - Payment declined. \* product\_not\_available - Product not available. \* third\_party\_cancellation - Third party cancellation. |
| `refundable_credits_issued` | `number` | No | If there are any credits that were issued at the order level, you can make use of the field, refundable\_credits\_issued. This will lead to Chargebee creating a Refundable Credit note against the order. When the next invoice is raised against the customer, this credit note will be utilised. |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `billing_address` | `object` | No | Parameters for billing\_address |

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] billing\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `order` | `object \| null` | No | **Note:** This doc is for the latest version of Chargebee Orders. If you enabled Chargebee Orders before *September-30-2018* , you may be using the legacy version of the feature and its API. For help in migrating to the current system or using the legacy API for Chargebee Orders, please [contact 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) Orders are automatically generated for an invoice when it gets paid, based on the shipping preference chosen for the invoice's product and the shipping date configuration. They can be updated either via api or merchant web console (a.k.a admin console). |

> [accordion] order full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   document_number?: string | null,
>   invoice_id?: string | null,
>   subscription_id?: string | null,
>   customer_id?: string | null,
>   status?: string | null,
>   cancellation_reason?: string | null,
>   payment_status?: string | null,
>   order_type?: string | null,
>   price_type?: string | null,
>   reference_id?: string | null,
>   fulfillment_status?: string | null,
>   order_date?: number | null,
>   shipping_date?: number | null,
>   note?: string | null,
>   tracking_id?: string | null,
>   tracking_url?: string | null,
>   batch_id?: string | null,
>   created_by?: string | null,
>   shipment_carrier?: string | null,
>   invoice_round_off_amount?: number | null,
>   tax?: number | null,
>   amount_paid?: number | null,
>   amount_adjusted?: number | null,
>   refundable_credits_issued?: number | null,
>   refundable_credits?: number | null,
>   rounding_adjustement?: number | null,
>   paid_on?: number | null,
>   shipping_cut_off_date?: number | null,
>   created_at?: number | null,
>   status_update_at?: number | null,
>   delivered_at?: number | null,
>   shipped_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   cancelled_at?: number | null,
>   resent_status?: string | null,
>   is_resent?: boolean | null,
>   original_order_id?: string | null,
>   discount?: number | null,
>   sub_total?: number | null,
>   total?: number | null,
>   deleted?: boolean | null,
>   currency_code?: string | null,
>   is_gifted?: boolean | null,
>   gift_note?: string | null,
>   gift_id?: string | null,
>   resend_reason?: string | null,
>   business_entity_id?: string | null,
>   order_line_items?: {
>     id?: string | null,
>     invoice_id?: string | null,
>     invoice_line_item_id?: string | null,
>     unit_price?: number | null,
>     description?: string | null,
>     amount?: number | null,
>     fulfillment_quantity?: number | null,
>     fulfillment_amount?: number | null,
>     tax_amount?: number | null,
>     amount_paid?: number | null,
>     amount_adjusted?: number | null,
>     refundable_credits_issued?: number | null,
>     refundable_credits?: number | null,
>     is_shippable?: boolean | null,
>     sku?: string | null,
>     status?: string | null,
>     entity_type?: string | null,
>     item_level_discount_amount?: number | null,
>     discount_amount?: number | null,
>     entity_id?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   linked_credit_notes?: {
>     amount?: number | null,
>     type?: string | null,
>     id?: string | null,
>     status?: string | null,
>     amount_adjusted?: number | null,
>     amount_refunded?: number | null
>   }[] | null,
>   resent_orders?: {
>     order_id?: string | null,
>     reason?: string | null,
>     amount?: number | null
>   }[] | null
> } | null
> ```

***

### list

`orders.list`

List orders. This API is used to retrieve a list of all the available orders.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.orders.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `include_deleted` | `boolean` | No | If set to true, includes the deleted resources in the response. For the deleted resources in the response, the '**deleted** ' attribute will be '**true** '. |
| `exclude_deleted_credit_notes` | `boolean` | No | Flag to indicate whether deleted credit notes should be passed or not. |
| `id` | `object` | No | optional, string filter Uniquely identifies the order. It is the api identifier for the order. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *id\\\[is\\] = "890"* |
| `invoice_id` | `object` | No | optional, string filter The invoice number which acts as an identifier for invoice and is generated sequentially. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *invoice\_id\\\[is\\] = "INVOICE\_982"* |
| `subscription_id` | `object` | No | optional, string filter The subscription for which the order is created. **Supported operators :** is, is\_not, starts\_with **Example →** *subscription\_id\\\[is\_not\\] = "null"* |
| `status` | `object` | No | optional, enumerated string filter The status of this order. Possible values are : new, processing, complete, cancelled, voided, queued, awaiting\_shipment, on\_hold, delivered, shipped, partially\_delivered, returned. **Supported operators :** is, is\_not, in, not\_in **Example →** *status\\\[is\\] = "queued"* |
| `shipping_date` | `object` | No | optional, timestamp(UTC) in seconds filter This is the date on which the order will be delivered to the customer. **Supported operators :** after, before, on, between **Example →** *shipping\_date\\\[after\\] = "1435054328"* |
| `shipped_at` | `object` | No | optional, timestamp(UTC) in seconds filter The time at which the order was shipped. **Supported operators :** after, before, on, between **Example →** *shipped\_at\\\[before\\] = "1435054328"* |
| `order_type` | `object` | No | optional, enumerated string filter Order type. Possible values are : manual, system\_generated. **Supported operators :** is, is\_not, in, not\_in **Example →** *order\_type\\\[is\_not\\] = "system\_generated"* |
| `order_date` | `object` | No | optional, timestamp(UTC) in seconds filter The date on which the order will start getting processed. **Supported operators :** after, before, on, between **Example →** *order\_date\\\[before\\] = "1435054328"* |
| `paid_on` | `object` | No | optional, timestamp(UTC) in seconds filter The timestamp indicating the date \\& time the order's invoice got paid. **Supported operators :** after, before, on, between **Example →** *paid\_on\\\[on\\] = "1435054328"* |
| `updated_at` | `object` | No | optional, timestamp(UTC) in seconds filter To filter based on updated at . **Supported operators :** after, before, on, between **Example →** *updated\_at\\\[on\\] = "1243545465"* |
| `created_at` | `object` | No | optional, timestamp(UTC) in seconds filter The time at which the order was created. **Supported operators :** after, before, on, between **Example →** *created\_at\\\[after\\] = "1435054328"* |
| `resent_status` | `object` | No | optional, enumerated string filter Resent order status. Possible values are : fully\_resent, partially\_resent. **Supported operators :** is, is\_not, in, not\_in **Example →** *resent\_status\\\[is\\] = "fully\_resent"* |
| `is_resent` | `object` | No | optional, boolean filter Order is resent order or not. Possible values are : *true, false* **Supported operators :** is **Example →** *is\_resent\\\[is\\] = "false"* |
| `original_order_id` | `object` | No | optional, string filter If resent order what is the parent order id. **Supported operators :** is, is\_not, starts\_with **Example →** *original\_order\_id\\\[is\\] = "1xRt6ifdr"* |
| `sort_by` | `object` | No | optional, string filter Sorts based on the specified attribute. **Supported attributes :** created\_at, updated\_at **Supported sort-orders :** asc, desc **Example →** *sort\_by\\\[asc\\] = "created\_at"* This will sort the result based on the 'created\_at' attribute in ascending(earliest first) order. |

> [accordion] id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] invoice\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] subscription\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string
> }
> ```

> [accordion] status full type
>
> ```ts theme={null}
> {
>   is?: new | processing | complete | cancelled | voided | queued | awaiting_shipment | on_hold | delivered | shipped | partially_delivered | returned,
>   is_not?: new | processing | complete | cancelled | voided | queued | awaiting_shipment | on_hold | delivered | shipped | partially_delivered | returned,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] shipping\_date full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] shipped\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] order\_type full type
>
> ```ts theme={null}
> {
>   is?: manual | system_generated,
>   is_not?: manual | system_generated,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] order\_date full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] paid\_on full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] updated\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] created\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] resent\_status full type
>
> ```ts theme={null}
> {
>   is?: fully_resent | partially_resent,
>   is_not?: fully_resent | partially_resent,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] is\_resent full type
>
> ```ts theme={null}
> {
>   is?: true | false
> }
> ```

> [accordion] original\_order\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string
> }
> ```

> [accordion] sort\_by full type
>
> ```ts theme={null}
> {
>   asc?: created_at | updated_at,
>   desc?: created_at | updated_at
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   order?: {
>     id?: string | null,
>     document_number?: string | null,
>     invoice_id?: string | null,
>     subscription_id?: string | null,
>     customer_id?: string | null,
>     status?: string | null,
>     cancellation_reason?: string | null,
>     payment_status?: string | null,
>     order_type?: string | null,
>     price_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     order_date?: number | null,
>     shipping_date?: number | null,
>     note?: string | null,
>     tracking_id?: string | null,
>     tracking_url?: string | null,
>     batch_id?: string | null,
>     created_by?: string | null,
>     shipment_carrier?: string | null,
>     invoice_round_off_amount?: number | null,
>     tax?: number | null,
>     amount_paid?: number | null,
>     amount_adjusted?: number | null,
>     refundable_credits_issued?: number | null,
>     refundable_credits?: number | null,
>     rounding_adjustement?: number | null,
>     paid_on?: number | null,
>     shipping_cut_off_date?: number | null,
>     created_at?: number | null,
>     status_update_at?: number | null,
>     delivered_at?: number | null,
>     shipped_at?: number | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     cancelled_at?: number | null,
>     resent_status?: string | null,
>     is_resent?: boolean | null,
>     original_order_id?: string | null,
>     discount?: number | null,
>     sub_total?: number | null,
>     total?: number | null,
>     deleted?: boolean | null,
>     currency_code?: string | null,
>     is_gifted?: boolean | null,
>     gift_note?: string | null,
>     gift_id?: string | null,
>     resend_reason?: string | null,
>     business_entity_id?: string | null,
>     order_line_items?: {
>       id?: string | null,
>       invoice_id?: string | null,
>       invoice_line_item_id?: string | null,
>       unit_price?: number | null,
>       description?: string | null,
>       amount?: number | null,
>       fulfillment_quantity?: number | null,
>       fulfillment_amount?: number | null,
>       tax_amount?: number | null,
>       amount_paid?: number | null,
>       amount_adjusted?: number | null,
>       refundable_credits_issued?: number | null,
>       refundable_credits?: number | null,
>       is_shippable?: boolean | null,
>       sku?: string | null,
>       status?: string | null,
>       entity_type?: string | null,
>       item_level_discount_amount?: number | null,
>       discount_amount?: number | null,
>       entity_id?: string | null
>     }[] | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     billing_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     linked_credit_notes?: {
>       amount?: number | null,
>       type?: string | null,
>       id?: string | null,
>       status?: string | null,
>       amount_adjusted?: number | null,
>       amount_refunded?: number | null
>     }[] | null,
>     resent_orders?: {
>       order_id?: string | null,
>       reason?: string | null,
>       amount?: number | null
>     }[] | null
>   } | null
> }[] | null
> ```

***

### reopen

`orders.reopen`

Reopen a cancelled order. This API is used to re-open a cancelled order.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.orders.reopen({ orderId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `orderId` | `string` | Yes | — |
| `void_cancellation_credit_notes` | `boolean` | No | Flag to void credit notes created for cancellation if they are unused. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `order` | `object \| null` | No | **Note:** This doc is for the latest version of Chargebee Orders. If you enabled Chargebee Orders before *September-30-2018* , you may be using the legacy version of the feature and its API. For help in migrating to the current system or using the legacy API for Chargebee Orders, please [contact 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) Orders are automatically generated for an invoice when it gets paid, based on the shipping preference chosen for the invoice's product and the shipping date configuration. They can be updated either via api or merchant web console (a.k.a admin console). |

> [accordion] order full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   document_number?: string | null,
>   invoice_id?: string | null,
>   subscription_id?: string | null,
>   customer_id?: string | null,
>   status?: string | null,
>   cancellation_reason?: string | null,
>   payment_status?: string | null,
>   order_type?: string | null,
>   price_type?: string | null,
>   reference_id?: string | null,
>   fulfillment_status?: string | null,
>   order_date?: number | null,
>   shipping_date?: number | null,
>   note?: string | null,
>   tracking_id?: string | null,
>   tracking_url?: string | null,
>   batch_id?: string | null,
>   created_by?: string | null,
>   shipment_carrier?: string | null,
>   invoice_round_off_amount?: number | null,
>   tax?: number | null,
>   amount_paid?: number | null,
>   amount_adjusted?: number | null,
>   refundable_credits_issued?: number | null,
>   refundable_credits?: number | null,
>   rounding_adjustement?: number | null,
>   paid_on?: number | null,
>   shipping_cut_off_date?: number | null,
>   created_at?: number | null,
>   status_update_at?: number | null,
>   delivered_at?: number | null,
>   shipped_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   cancelled_at?: number | null,
>   resent_status?: string | null,
>   is_resent?: boolean | null,
>   original_order_id?: string | null,
>   discount?: number | null,
>   sub_total?: number | null,
>   total?: number | null,
>   deleted?: boolean | null,
>   currency_code?: string | null,
>   is_gifted?: boolean | null,
>   gift_note?: string | null,
>   gift_id?: string | null,
>   resend_reason?: string | null,
>   business_entity_id?: string | null,
>   order_line_items?: {
>     id?: string | null,
>     invoice_id?: string | null,
>     invoice_line_item_id?: string | null,
>     unit_price?: number | null,
>     description?: string | null,
>     amount?: number | null,
>     fulfillment_quantity?: number | null,
>     fulfillment_amount?: number | null,
>     tax_amount?: number | null,
>     amount_paid?: number | null,
>     amount_adjusted?: number | null,
>     refundable_credits_issued?: number | null,
>     refundable_credits?: number | null,
>     is_shippable?: boolean | null,
>     sku?: string | null,
>     status?: string | null,
>     entity_type?: string | null,
>     item_level_discount_amount?: number | null,
>     discount_amount?: number | null,
>     entity_id?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   linked_credit_notes?: {
>     amount?: number | null,
>     type?: string | null,
>     id?: string | null,
>     status?: string | null,
>     amount_adjusted?: number | null,
>     amount_refunded?: number | null
>   }[] | null,
>   resent_orders?: {
>     order_id?: string | null,
>     reason?: string | null,
>     amount?: number | null
>   }[] | null
> } | null
> ```

***

### resend

`orders.resend`

Resend an order. Resend an existing order. This will help in resending an existing order in full or partial. Upto 5 resend operations are allowed per . When resent fully, the original order is canceled.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.orders.resend({ orderId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `orderId` | `string` | Yes | — |
| `shipping_date` | `number` | No | The date on which the order should be shipped to the customer. |
| `resend_reason` | `string` | No | Reason code for resending the order. Must be one from a list of reason codes set in the Chargebee app in **Settings \\> Configure Chargebee \\> Reason Codes \\> Orders \\> Order Resend**. Must be passed if set as mandatory in the app. The codes are case-sensitive. |
| `order_line_items` | `object` | No | Parameters for order\_line\_items |

> [accordion] order\_line\_items full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   fulfillment_quantity?: number[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `order` | `object \| null` | No | **Note:** This doc is for the latest version of Chargebee Orders. If you enabled Chargebee Orders before *September-30-2018* , you may be using the legacy version of the feature and its API. For help in migrating to the current system or using the legacy API for Chargebee Orders, please [contact 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) Orders are automatically generated for an invoice when it gets paid, based on the shipping preference chosen for the invoice's product and the shipping date configuration. They can be updated either via api or merchant web console (a.k.a admin console). |

> [accordion] order full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   document_number?: string | null,
>   invoice_id?: string | null,
>   subscription_id?: string | null,
>   customer_id?: string | null,
>   status?: string | null,
>   cancellation_reason?: string | null,
>   payment_status?: string | null,
>   order_type?: string | null,
>   price_type?: string | null,
>   reference_id?: string | null,
>   fulfillment_status?: string | null,
>   order_date?: number | null,
>   shipping_date?: number | null,
>   note?: string | null,
>   tracking_id?: string | null,
>   tracking_url?: string | null,
>   batch_id?: string | null,
>   created_by?: string | null,
>   shipment_carrier?: string | null,
>   invoice_round_off_amount?: number | null,
>   tax?: number | null,
>   amount_paid?: number | null,
>   amount_adjusted?: number | null,
>   refundable_credits_issued?: number | null,
>   refundable_credits?: number | null,
>   rounding_adjustement?: number | null,
>   paid_on?: number | null,
>   shipping_cut_off_date?: number | null,
>   created_at?: number | null,
>   status_update_at?: number | null,
>   delivered_at?: number | null,
>   shipped_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   cancelled_at?: number | null,
>   resent_status?: string | null,
>   is_resent?: boolean | null,
>   original_order_id?: string | null,
>   discount?: number | null,
>   sub_total?: number | null,
>   total?: number | null,
>   deleted?: boolean | null,
>   currency_code?: string | null,
>   is_gifted?: boolean | null,
>   gift_note?: string | null,
>   gift_id?: string | null,
>   resend_reason?: string | null,
>   business_entity_id?: string | null,
>   order_line_items?: {
>     id?: string | null,
>     invoice_id?: string | null,
>     invoice_line_item_id?: string | null,
>     unit_price?: number | null,
>     description?: string | null,
>     amount?: number | null,
>     fulfillment_quantity?: number | null,
>     fulfillment_amount?: number | null,
>     tax_amount?: number | null,
>     amount_paid?: number | null,
>     amount_adjusted?: number | null,
>     refundable_credits_issued?: number | null,
>     refundable_credits?: number | null,
>     is_shippable?: boolean | null,
>     sku?: string | null,
>     status?: string | null,
>     entity_type?: string | null,
>     item_level_discount_amount?: number | null,
>     discount_amount?: number | null,
>     entity_id?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   linked_credit_notes?: {
>     amount?: number | null,
>     type?: string | null,
>     id?: string | null,
>     status?: string | null,
>     amount_adjusted?: number | null,
>     amount_refunded?: number | null
>   }[] | null,
>   resent_orders?: {
>     order_id?: string | null,
>     reason?: string | null,
>     amount?: number | null
>   }[] | null
> } | null
> ```

***

### update

`orders.update`

Update an order. Updates an order. If the status of an order is changed while updating the order, the status\_update\_at attribute is set with the current time.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.orders.update({ orderId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `orderId` | `string` | Yes | — |
| `reference_id` | `string` | No | Reference id is the unique identifier of the order in the shipping/order management application. |
| `batch_id` | `string` | No | Unique id to identify a group of orders. |
| `note` | `string` | No | The custom note for the order. |
| `shipping_date` | `number` | No | The date on which the order should be shipped to the customer. |
| `order_date` | `number` | No | The order date. |
| `cancelled_at` | `number` | No | The time at which the order was cancelled. |
| `cancellation_reason` | `shipping_cut_off_passed \| product_unsatisfactory \| third_party_cancellation \| product_not_required \| delivery_date_missed \| alternative_found \| invoice_written_off \| invoice_voided \| fraudulent_transaction \| payment_declined \| subscription_cancelled \| product_not_available \| others \| order_resent` | No | Cancellation reason. \* shipping\_cut\_off\_passed - The invoice has been paid late and Chargebee cancel's the first order for the invoice. \* invoice\_voided - The invoice for which the order was createed has been voided. \* alternative\_found - Alternative found. \* others - Other reason \* order\_resent - Order resent \* product\_unsatisfactory - Product unsatisfactory. \* delivery\_date\_missed - Delivery date missed. \* subscription\_cancelled - The subsctiption for which the order was created has been cancelled. \* fraudulent\_transaction - Fraudulent transaction. \* invoice\_written\_off - The invoice has been completely written off. Orders are generated by Chargebee in cancelled state. \* product\_not\_required - Product not required. \* payment\_declined - Payment declined. \* product\_not\_available - Product not available. \* third\_party\_cancellation - Third party cancellation. |
| `shipped_at` | `number` | No | The time at which the order was shipped. |
| `delivered_at` | `number` | No | The time at which the order was delivered. |
| `tracking_url` | `string` | No | The tracking url of the order. |
| `tracking_id` | `string` | No | The tracking id of the order. |
| `shipment_carrier` | `string` | No | The carrier used to ship the goods to the customer. Ex:- FedEx. |
| `fulfillment_status` | `string` | No | The fulfillment status of an order as reflected in the shipping/order management application. Typical statuses include Shipped,Awaiting Shipment,Not fulfilled etc;. |
| `status` | `new \| processing \| complete \| cancelled \| voided \| queued \| awaiting_shipment \| on_hold \| delivered \| shipped \| partially_delivered \| returned` | No | The order status. \* voided - Order has been voided. Applicable only if you are using Chargebee's legacy order management system \* complete - Order has been processed successfully. Applicable only if you are using Chargebee's legacy order management system \* shipped - The order has moved from order management system to a shipping system. \* processing - Order is being processed. Applicable only if you are using Chargebee's legacy order management system \* queued - Order is yet to be processed by any system, these are scheduled orders created by Chargebee \* on\_hold - The order is paused from being processed. \* new - Order has been created. Applicable only if you are using Chargebee's legacy order management system. \* returned - The order has been returned after delivery. \* delivered - The order has been delivered to the customer. \* awaiting\_shipment - The order has been picked up by an integration system, and synced to a shipping management platform \* cancelled - Order has been cancelled. Applicable only if you are using Chargebee's legacy order management system \* partially\_delivered - The order has been partially delivered to the customer. |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `order_line_items` | `object` | No | Parameters for order\_line\_items |

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] order\_line\_items full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   status?: (queued | awaiting_shipment | on_hold | delivered | shipped | partially_delivered | returned | cancelled)[],
>   sku?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `order` | `object \| null` | No | **Note:** This doc is for the latest version of Chargebee Orders. If you enabled Chargebee Orders before *September-30-2018* , you may be using the legacy version of the feature and its API. For help in migrating to the current system or using the legacy API for Chargebee Orders, please [contact 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) Orders are automatically generated for an invoice when it gets paid, based on the shipping preference chosen for the invoice's product and the shipping date configuration. They can be updated either via api or merchant web console (a.k.a admin console). |

> [accordion] order full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   document_number?: string | null,
>   invoice_id?: string | null,
>   subscription_id?: string | null,
>   customer_id?: string | null,
>   status?: string | null,
>   cancellation_reason?: string | null,
>   payment_status?: string | null,
>   order_type?: string | null,
>   price_type?: string | null,
>   reference_id?: string | null,
>   fulfillment_status?: string | null,
>   order_date?: number | null,
>   shipping_date?: number | null,
>   note?: string | null,
>   tracking_id?: string | null,
>   tracking_url?: string | null,
>   batch_id?: string | null,
>   created_by?: string | null,
>   shipment_carrier?: string | null,
>   invoice_round_off_amount?: number | null,
>   tax?: number | null,
>   amount_paid?: number | null,
>   amount_adjusted?: number | null,
>   refundable_credits_issued?: number | null,
>   refundable_credits?: number | null,
>   rounding_adjustement?: number | null,
>   paid_on?: number | null,
>   shipping_cut_off_date?: number | null,
>   created_at?: number | null,
>   status_update_at?: number | null,
>   delivered_at?: number | null,
>   shipped_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   cancelled_at?: number | null,
>   resent_status?: string | null,
>   is_resent?: boolean | null,
>   original_order_id?: string | null,
>   discount?: number | null,
>   sub_total?: number | null,
>   total?: number | null,
>   deleted?: boolean | null,
>   currency_code?: string | null,
>   is_gifted?: boolean | null,
>   gift_note?: string | null,
>   gift_id?: string | null,
>   resend_reason?: string | null,
>   business_entity_id?: string | null,
>   order_line_items?: {
>     id?: string | null,
>     invoice_id?: string | null,
>     invoice_line_item_id?: string | null,
>     unit_price?: number | null,
>     description?: string | null,
>     amount?: number | null,
>     fulfillment_quantity?: number | null,
>     fulfillment_amount?: number | null,
>     tax_amount?: number | null,
>     amount_paid?: number | null,
>     amount_adjusted?: number | null,
>     refundable_credits_issued?: number | null,
>     refundable_credits?: number | null,
>     is_shippable?: boolean | null,
>     sku?: string | null,
>     status?: string | null,
>     entity_type?: string | null,
>     item_level_discount_amount?: number | null,
>     discount_amount?: number | null,
>     entity_id?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   linked_credit_notes?: {
>     amount?: number | null,
>     type?: string | null,
>     id?: string | null,
>     status?: string | null,
>     amount_adjusted?: number | null,
>     amount_refunded?: number | null
>   }[] | null,
>   resent_orders?: {
>     order_id?: string | null,
>     reason?: string | null,
>     amount?: number | null
>   }[] | null
> } | null
> ```

***

## Organization Details

### create

`organizationDetails.create`

Update organization details. (POST /organization\_details)

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.organizationDetails.create({
	address_line1: 'example',
	city: 'example',
	organization_name: 'example',
	phone: 'example',
	state: 'example',
	zip: 'example',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `organization_name` | `string` | Yes | — |
| `email` | `string` | No | — |
| `address_line1` | `string` | Yes | — |
| `address_line2` | `string` | No | — |
| `address_line3` | `string` | No | — |
| `city` | `string` | Yes | — |
| `state_code` | `string` | No | — |
| `state` | `string` | Yes | — |
| `zip` | `string` | Yes | — |
| `country_code` | `string` | No | — |
| `phone` | `string` | Yes | — |
| `fax` | `string` | No | — |
| `website` | `string` | No | — |
| `is_vat_number_present` | `boolean` | No | — |
| `vat_number` | `string` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `organization_detail` | `object \| null` | No | — |

> [accordion] organization\_detail full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   organization_name?: string | null,
>   email?: string | null,
>   address_line1?: string | null,
>   address_line2?: string | null,
>   address_line3?: string | null,
>   city?: string | null,
>   state_code?: string | null,
>   state?: string | null,
>   country_code?: string | null,
>   zip?: string | null,
>   phone?: string | null,
>   fax?: string | null,
>   website?: string | null,
>   is_vat_number_present?: boolean | null,
>   vat_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   business_entity_id?: string | null
> } | null
> ```

***

### get

`organizationDetails.get`

Retrieve organization details. (GET /organization\_details/\{organization-detail-id})

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.organizationDetails.get({ organizationDetailId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `organizationDetailId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `organization_detail` | `object \| null` | No | — |

> [accordion] organization\_detail full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   organization_name?: string | null,
>   email?: string | null,
>   address_line1?: string | null,
>   address_line2?: string | null,
>   address_line3?: string | null,
>   city?: string | null,
>   state_code?: string | null,
>   state?: string | null,
>   country_code?: string | null,
>   zip?: string | null,
>   phone?: string | null,
>   fax?: string | null,
>   website?: string | null,
>   is_vat_number_present?: boolean | null,
>   vat_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   business_entity_id?: string | null
> } | null
> ```

***

### list

`organizationDetails.list`

List organization details. (GET /organization\_details)

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.organizationDetails.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set 'offset' to the value of 'next\_offset' obtained in the previous iteration of the API call. |
| `business_entity_id` | `object` | No | The unique ID of the [business entity](https://docs.corsair.dev/docs/api?prod_cat_ver=2#mbe) of this subscription. This is always the same as the [business entity](https://docs.corsair.dev/docs/api/subscriptions?prod_cat_ver=2#subscription_customer_id) of the customer. The ID of the business entity created for the site. For Product Catalog 1.0, all the site data is tied to this business entity. **Note** [Multiple Business Entities](https://docs.corsair.dev/docs/api?prod_cat_ver=2#mbe) is a feature available only on Product Catalog 2.0. |

> [accordion] business\_entity\_id full type
>
> ```ts theme={null}
> {
>   is?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   organization_detail?: {
>     id?: string | null,
>     organization_name?: string | null,
>     email?: string | null,
>     address_line1?: string | null,
>     address_line2?: string | null,
>     address_line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country_code?: string | null,
>     zip?: string | null,
>     phone?: string | null,
>     fax?: string | null,
>     website?: string | null,
>     is_vat_number_present?: boolean | null,
>     vat_number?: string | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     business_entity_id?: string | null
>   } | null
> }[] | null
> ```

***

## Payment Intents

### create

`paymentIntents.create`

Create a payment intent. Creates a PaymentIntent object. This is to be used with Chargebee.js API to complete the 3DS flow for new or stored cards. While creating, specify the appropriate gateway account and amount. Exact amount can be estimated using our Estimate API.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.paymentIntents.create({ amount: 1, currency_code: 'exa' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `business_entity_id` | `string` | No | Sets the [context]() for this operation to the [business entity](https://docs.corsair.dev/docs/api/advanced-features) specified. Applicable only when multiple business entities have been created for the site. When this parameter is provided, the operation is able to read/write data associated only to the business entity specified. When not provided, the operation can read/write data for the entire site. **Note** An alternative way of passing this parameter is by means of a [custom HTTP header](https://docs.corsair.dev/docs/api/advanced-features). **See also** [Customer resource lookup and creation.](https://docs.corsair.dev/docs/api/payment_intents) |
| `brand_id` | `string` | No | The unique ID of the [brand](https://docs.corsair.dev/docs/api/brands) this payment intent should be linked to. Applicable only when multiple brands have been created for the site. An alternative way of passing this parameter is by means of the `chargebee-brand-id` custom HTTP header; when both are provided, they must specify the same brand. **Default behavior** \* When not provided, the payment intent is linked to the brand of the customer it is created for, or to the default brand defined for the site when no customer is specified. |
| `customer_id` | `string` | No | The unique identifier of the customer for whom the `payment_intent` will be created. If specified, the `payment_intent` will be used exclusively for that customer. If not specified, the `payment_intent` won't be associated with any customer and will be available for any customer. **See also** [Customer resource lookup and creation](https://docs.corsair.dev/docs/api/payment_intents) . |
| `amount` | `number` | Yes | Amount(in cents) to be authorized for 3DS flow. |
| `currency_code` | `string` | Yes | The currency code (ISO 4217 format) of the amount used in transaction. |
| `gateway_account_id` | `string` | No | The gateway account used for performing the 3DS flow. |
| `reference_id` | `string` | No | Reference for payment method at gateway. Only applicable when the PaymentIntent is created for cards stored in the gateway. |
| `defer_payment_method_type` | `boolean` | No | When set to `true`, the binding of the payment method type and related fields is deferred during intent creation. As a result, fields such as `gateway_account_id`, `gateway`, `payment_method_type`, and `reference_id` provided in this request will be ignored until the intent is updated with a selected payment method. |
| `payment_method_type` | `card \| ideal \| sofort \| bancontact \| google_pay \| dotpay \| giropay \| apple_pay \| upi \| netbanking_emandates \| paypal_express_checkout \| direct_debit \| boleto \| venmo \| amazon_payments \| pay_to \| faster_payments \| sepa_instant_transfer \| klarna_pay_now \| online_banking_poland \| payconiq_by_bancontact \| electronic_payment_standard \| kbc_payment_button \| pay_by_bank \| trustly \| stablecoin \| kakao_pay \| naver_pay \| revolut_pay \| cash_app_pay \| wechat_pay \| alipay \| twint \| go_pay \| grab_pay \| pay_co \| after_pay \| swish \| payme \| pix \| klarna \| alipay_hk \| paypay \| gcash \| south_korean_cards \| paynow \| bizum \| promptpay \| dana \| touch_n_go \| tamara \| qpay \| ovo \| momo \| mercado_pago \| nequi \| nupay \| picpay \| thai_qr \| blik \| fpx \| wero \| p24 \| affirm_pay \| rakuten_pay` | No | The payment method of this intent. \* google\_pay - google\_pay \* pay\_co - Payments made via PayCo \* tamara - Payments made via Tamara. \* alipay\_hk - Payments made via Alipay HK. \* ovo - Payments made via OVO. \* apple\_pay - apple\_pay \* cash\_app\_pay - Payments made via Cash App Pay. \* ideal - ideal \* bancontact - bancontact \* nequi - Payments made via Nequi. \* netbanking\_emandates - netbanking\_emandates \* pay\_to - PayTo \* trustly - Trustly \* venmo - Venmo \* after\_pay - Payments made via Afterpay \* alipay - Payments made via Alipay. \* picpay - Payments made via PicPay. \* dotpay - dotpay \* giropay - giropay \* fpx - Payments made via FPX. \* sofort - sofort \* momo - Payments made via MoMo. **Constraints** \* The payment intent currency must be `VND`. \* sepa\_instant\_transfer - Sepa Instant Transfer \* paypay - PayPay \* gcash - Payments made via GCash. \* mercado\_pago - Payments made via Mercado Pago. \* nupay - Payments made via NuPay. \* kakao\_pay - Payments made via Kakao Pay. \* blik - Payments made via BLIK. \* direct\_debit - direct\_debit \* dana - Payments made via Dana. \* paypal\_express\_checkout - paypal\_express\_checkout \* touch\_n\_go - Payments made via Touch 'n Go. \* boleto - boleto \* faster\_payments - Faster Payments \* rakuten\_pay - Payments made via Rakuten Pay. **Constraints** \* The payment intent currency must be `JPY`. \* pix - Pix \* qpay - Payments made via Qpay. \* klarna\_pay\_now - Klarna Pay Now \* revolut\_pay - Payments made via Revolut Pay. \* naver\_pay - Payments made via Naver Pay. \* amazon\_payments - Amazon Payments \* electronic\_payment\_standard - Electronic Payment Standard \* stablecoin - Payments made via Stablecoin. \* grab\_pay - Payments made via GrabPay \* card - card \* upi - upi \* affirm\_pay - Payments made via Affirm Pay. \* p24 - Payments made via Przelewy24 (P24). \* south\_korean\_cards - Payments made via South Korean Cards \* thai\_qr - Payments made via Thai QR. \* online\_banking\_poland - Online Banking Poland \* klarna - Payments made via Klarna. \* wero - Payments made via Wero. \* pay\_by\_bank - Pay By Bank \* go\_pay - Payments made via GoPay \* swish - Payments made via Swish \* payconiq\_by\_bancontact - Payments made via Payconiq by Bancontact. \* twint - Payments made via Twint \* payme - Payments made via PayMe \* wechat\_pay - Payments made via WeChat Pay. \* kbc\_payment\_button - KBC Payment Button |
| `success_url` | `string` | No | The URL the customer will be directed to once 3DS verification is successful. Applicable only when `payment_method_type` is `ideal` , `sofort` , `dotpay` or `giropay` . |
| `failure_url` | `string` | No | The URL the customer will be directed to when 3DS verification fails. Applicable only when `payment_method_type` is `ideal` , `sofort` , `dotpay` or `giropay` . |
| `payment_method_options` | `object` | No | Payment method-specific options for this PaymentIntent. Only `card` is supported; keys for other payment method types are ignored. \* `card`: Options for card payments. \* `three_d_secure`: Options for 3DS authentication. \* `challenge_preference`: The preferred 3DS flow. Applicable only when `payment_method_type` is `card` and 3DS is enabled for the gateway account. Supported for Stripe, Adyen, and BlueSnap; ignored for other gateways. The gateway or card issuer can override the preference. \* `no_preference`: Chargebee, the gateway, and the issuer decide the 3DS flow. \* `no_challenge`: Requests a frictionless flow without a challenge. \* `challenge`: Requests a challenge flow. |

> [accordion] payment\_method\_options full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `payment_intent` | `object \| null` | No | A `payment_intent` is created to help you navigate the 3DS flow of collecting payment from your customer. It is necessary only for implementing 3DS flow using Chargebee.js. #### Auto-expiry All `payment_intent`s with `status` as `inited`, `in_progress` or `authorized` become `expired` after an **hour** automatically. |

> [accordion] payment\_intent full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   status?: string | null,
>   currency_code?: string | null,
>   amount?: number | null,
>   gateway_account_id?: string | null,
>   expires_at?: number | null,
>   reference_id?: string | null,
>   payment_method_type?: string | null,
>   success_url?: string | null,
>   failure_url?: string | null,
>   created_at?: number | null,
>   modified_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   payment_method_options?: {
>   } | null,
>   customer_id?: string | null,
>   gateway?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   active_payment_attempt?: {
>     id?: string | null,
>     status?: string | null,
>     payment_method_type?: string | null,
>     id_at_gateway?: string | null,
>     error_code?: string | null,
>     error_text?: string | null,
>     checkout_details?: string | null,
>     created_at?: number | null,
>     modified_at?: number | null,
>     error_detail?: {
>       request_id?: string | null,
>       error_category?: string | null,
>       error_code?: string | null,
>       error_message?: string | null,
>       decline_code?: string | null,
>       decline_message?: string | null,
>       network_error_code?: string | null,
>       network_error_message?: string | null,
>       error_field?: string | null,
>       recommendation_code?: string | null,
>       recommendation_message?: string | null,
>       processor_error_code?: string | null,
>       processor_error_message?: string | null,
>       error_cause_id?: string | null,
>       processor_advice_code?: string | null
>     } | null,
>     routing_rule_id?: string | null,
>     payment_method_display_rule_id?: string | null
>   } | null,
>   payment_attempts?: {
>     id?: string | null,
>     status?: string | null,
>     payment_method_type?: string | null,
>     id_at_gateway?: string | null,
>     error_code?: string | null,
>     error_text?: string | null,
>     checkout_details?: string | null,
>     created_at?: number | null,
>     modified_at?: number | null,
>     error_detail?: {
>       request_id?: string | null,
>       error_category?: string | null,
>       error_code?: string | null,
>       error_message?: string | null,
>       decline_code?: string | null,
>       decline_message?: string | null,
>       network_error_code?: string | null,
>       network_error_message?: string | null,
>       error_field?: string | null,
>       recommendation_code?: string | null,
>       recommendation_message?: string | null,
>       processor_error_code?: string | null,
>       processor_error_message?: string | null,
>       error_cause_id?: string | null,
>       processor_advice_code?: string | null
>     } | null,
>     routing_rule_id?: string | null,
>     payment_method_display_rule_id?: string | null
>   }[] | null,
>   payment_intent_metadata?: {
>     source?: string | null,
>     client_ip_address?: string | null,
>     user_agent?: string | null,
>     created_at?: number | null
>   } | null
> } | null
> ```

***

### get

`paymentIntents.get`

Retrieve a payment intent. Retrieves the PaymentIntent resource.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.paymentIntents.get({ paymentIntentId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `paymentIntentId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `payment_intent` | `object \| null` | No | A `payment_intent` is created to help you navigate the 3DS flow of collecting payment from your customer. It is necessary only for implementing 3DS flow using Chargebee.js. #### Auto-expiry All `payment_intent`s with `status` as `inited`, `in_progress` or `authorized` become `expired` after an **hour** automatically. |

> [accordion] payment\_intent full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   status?: string | null,
>   currency_code?: string | null,
>   amount?: number | null,
>   gateway_account_id?: string | null,
>   expires_at?: number | null,
>   reference_id?: string | null,
>   payment_method_type?: string | null,
>   success_url?: string | null,
>   failure_url?: string | null,
>   created_at?: number | null,
>   modified_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   payment_method_options?: {
>   } | null,
>   customer_id?: string | null,
>   gateway?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   active_payment_attempt?: {
>     id?: string | null,
>     status?: string | null,
>     payment_method_type?: string | null,
>     id_at_gateway?: string | null,
>     error_code?: string | null,
>     error_text?: string | null,
>     checkout_details?: string | null,
>     created_at?: number | null,
>     modified_at?: number | null,
>     error_detail?: {
>       request_id?: string | null,
>       error_category?: string | null,
>       error_code?: string | null,
>       error_message?: string | null,
>       decline_code?: string | null,
>       decline_message?: string | null,
>       network_error_code?: string | null,
>       network_error_message?: string | null,
>       error_field?: string | null,
>       recommendation_code?: string | null,
>       recommendation_message?: string | null,
>       processor_error_code?: string | null,
>       processor_error_message?: string | null,
>       error_cause_id?: string | null,
>       processor_advice_code?: string | null
>     } | null,
>     routing_rule_id?: string | null,
>     payment_method_display_rule_id?: string | null
>   } | null,
>   payment_attempts?: {
>     id?: string | null,
>     status?: string | null,
>     payment_method_type?: string | null,
>     id_at_gateway?: string | null,
>     error_code?: string | null,
>     error_text?: string | null,
>     checkout_details?: string | null,
>     created_at?: number | null,
>     modified_at?: number | null,
>     error_detail?: {
>       request_id?: string | null,
>       error_category?: string | null,
>       error_code?: string | null,
>       error_message?: string | null,
>       decline_code?: string | null,
>       decline_message?: string | null,
>       network_error_code?: string | null,
>       network_error_message?: string | null,
>       error_field?: string | null,
>       recommendation_code?: string | null,
>       recommendation_message?: string | null,
>       processor_error_code?: string | null,
>       processor_error_message?: string | null,
>       error_cause_id?: string | null,
>       processor_advice_code?: string | null
>     } | null,
>     routing_rule_id?: string | null,
>     payment_method_display_rule_id?: string | null
>   }[] | null,
>   payment_intent_metadata?: {
>     source?: string | null,
>     client_ip_address?: string | null,
>     user_agent?: string | null,
>     created_at?: number | null
>   } | null
> } | null
> ```

***

### update

`paymentIntents.update`

Update a payment intent. Updating properties on a PaymentIntent object. All the subsequent 3DS transaction attempts will have the updated values.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.paymentIntents.update({ paymentIntentId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `paymentIntentId` | `string` | Yes | — |
| `amount` | `number` | No | Amount(in cents) to be authorized for 3DS flow. |
| `currency_code` | `string` | No | The currency code (ISO 4217 format) of the amount used in transaction. |
| `gateway_account_id` | `string` | No | The gateway account used for performing the 3DS flow. |
| `payment_method_type` | `card \| ideal \| sofort \| bancontact \| google_pay \| dotpay \| giropay \| apple_pay \| upi \| netbanking_emandates \| paypal_express_checkout \| direct_debit \| boleto \| venmo \| amazon_payments \| pay_to \| faster_payments \| sepa_instant_transfer \| klarna_pay_now \| online_banking_poland \| payconiq_by_bancontact \| electronic_payment_standard \| kbc_payment_button \| pay_by_bank \| trustly \| stablecoin \| kakao_pay \| naver_pay \| revolut_pay \| cash_app_pay \| wechat_pay \| alipay \| twint \| go_pay \| grab_pay \| pay_co \| after_pay \| swish \| payme \| pix \| klarna \| alipay_hk \| paypay \| gcash \| south_korean_cards \| paynow \| bizum \| promptpay \| dana \| touch_n_go \| tamara \| qpay \| ovo \| momo \| mercado_pago \| nequi \| nupay \| picpay \| thai_qr \| blik \| fpx \| wero \| p24 \| affirm_pay \| rakuten_pay` | No | The payment method of this intent. \* google\_pay - google\_pay \* pay\_co - Payments made via PayCo \* tamara - Payments made via Tamara. \* alipay\_hk - Payments made via Alipay HK. \* ovo - Payments made via OVO. \* apple\_pay - apple\_pay \* cash\_app\_pay - Payments made via Cash App Pay. \* ideal - ideal \* bancontact - bancontact \* nequi - Payments made via Nequi. \* netbanking\_emandates - netbanking\_emandates \* pay\_to - PayTo \* trustly - Trustly \* venmo - Venmo \* after\_pay - Payments made via Afterpay \* alipay - Payments made via Alipay. \* picpay - Payments made via PicPay. \* dotpay - dotpay \* giropay - giropay \* fpx - Payments made via FPX. \* sofort - sofort \* momo - Payments made via MoMo. \* sepa\_instant\_transfer - Sepa Instant Transfer \* paypay - PayPay \* gcash - Payments made via GCash. \* mercado\_pago - Payments made via Mercado Pago. \* nupay - Payments made via NuPay. \* kakao\_pay - Payments made via Kakao Pay. \* blik - Payments made via BLIK. \* direct\_debit - direct\_debit \* dana - Payments made via Dana. \* paypal\_express\_checkout - paypal\_express\_checkout \* touch\_n\_go - Payments made via Touch 'n Go. \* boleto - boleto \* faster\_payments - Faster Payments \* rakuten\_pay - Payments made via Rakuten Pay. \* pix - Pix \* qpay - Payments made via Qpay. \* klarna\_pay\_now - Klarna Pay Now \* revolut\_pay - Payments made via Revolut Pay. \* naver\_pay - Payments made via Naver Pay. \* amazon\_payments - Amazon Payments \* electronic\_payment\_standard - Electronic Payment Standard \* stablecoin - Payments made via Stablecoin. \* grab\_pay - Payments made via GrabPay \* card - card \* upi - upi \* affirm\_pay - Payments made via Affirm Pay. \* p24 - Payments made via Przelewy24 (P24). \* south\_korean\_cards - Payments made via South Korean Cards \* thai\_qr - Payments made via Thai QR. \* online\_banking\_poland - Online Banking Poland \* klarna - Payments made via Klarna. \* wero - Payments made via Wero. \* pay\_by\_bank - Pay By Bank \* go\_pay - Payments made via GoPay \* swish - Payments made via Swish \* payconiq\_by\_bancontact - Payments made via Payconiq by Bancontact. \* twint - Payments made via Twint \* payme - Payments made via PayMe \* wechat\_pay - Payments made via WeChat Pay. \* kbc\_payment\_button - KBC Payment Button |
| `success_url` | `string` | No | The URL the customer will be directed to once 3DS verification is successful. Applicable only when `payment_method_type` is `ideal` , `sofort` , `dotpay` or `giropay` . |
| `failure_url` | `string` | No | The URL the customer will be directed to when 3DS verification fails. Applicable only when `payment_method_type` is `ideal` , `sofort` , `dotpay` or `giropay` . |
| `payment_method_options` | `object` | No | Payment method-specific options for this PaymentIntent. Only `card` is supported; keys for other payment method types are ignored. \* `card`: Options for card payments. \* `three_d_secure`: Options for 3DS authentication. \* `challenge_preference`: The preferred 3DS flow. Applicable only when `payment_method_type` is `card` and 3DS is enabled for the gateway account. Supported for Stripe, Adyen, and BlueSnap; ignored for other gateways. The gateway or card issuer can override the preference. \* `no_preference`: Chargebee, the gateway, and the issuer decide the 3DS flow. \* `no_challenge`: Requests a frictionless flow without a challenge. \* `challenge`: Requests a challenge flow. If not specified, the existing preference is retained. To clear it, pass `payment_method_options` with no `challenge_preference`. |

> [accordion] payment\_method\_options full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `payment_intent` | `object \| null` | No | A `payment_intent` is created to help you navigate the 3DS flow of collecting payment from your customer. It is necessary only for implementing 3DS flow using Chargebee.js. #### Auto-expiry All `payment_intent`s with `status` as `inited`, `in_progress` or `authorized` become `expired` after an **hour** automatically. |

> [accordion] payment\_intent full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   status?: string | null,
>   currency_code?: string | null,
>   amount?: number | null,
>   gateway_account_id?: string | null,
>   expires_at?: number | null,
>   reference_id?: string | null,
>   payment_method_type?: string | null,
>   success_url?: string | null,
>   failure_url?: string | null,
>   created_at?: number | null,
>   modified_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   payment_method_options?: {
>   } | null,
>   customer_id?: string | null,
>   gateway?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   active_payment_attempt?: {
>     id?: string | null,
>     status?: string | null,
>     payment_method_type?: string | null,
>     id_at_gateway?: string | null,
>     error_code?: string | null,
>     error_text?: string | null,
>     checkout_details?: string | null,
>     created_at?: number | null,
>     modified_at?: number | null,
>     error_detail?: {
>       request_id?: string | null,
>       error_category?: string | null,
>       error_code?: string | null,
>       error_message?: string | null,
>       decline_code?: string | null,
>       decline_message?: string | null,
>       network_error_code?: string | null,
>       network_error_message?: string | null,
>       error_field?: string | null,
>       recommendation_code?: string | null,
>       recommendation_message?: string | null,
>       processor_error_code?: string | null,
>       processor_error_message?: string | null,
>       error_cause_id?: string | null,
>       processor_advice_code?: string | null
>     } | null,
>     routing_rule_id?: string | null,
>     payment_method_display_rule_id?: string | null
>   } | null,
>   payment_attempts?: {
>     id?: string | null,
>     status?: string | null,
>     payment_method_type?: string | null,
>     id_at_gateway?: string | null,
>     error_code?: string | null,
>     error_text?: string | null,
>     checkout_details?: string | null,
>     created_at?: number | null,
>     modified_at?: number | null,
>     error_detail?: {
>       request_id?: string | null,
>       error_category?: string | null,
>       error_code?: string | null,
>       error_message?: string | null,
>       decline_code?: string | null,
>       decline_message?: string | null,
>       network_error_code?: string | null,
>       network_error_message?: string | null,
>       error_field?: string | null,
>       recommendation_code?: string | null,
>       recommendation_message?: string | null,
>       processor_error_code?: string | null,
>       processor_error_message?: string | null,
>       error_cause_id?: string | null,
>       processor_advice_code?: string | null
>     } | null,
>     routing_rule_id?: string | null,
>     payment_method_display_rule_id?: string | null
>   }[] | null,
>   payment_intent_metadata?: {
>     source?: string | null,
>     client_ip_address?: string | null,
>     user_agent?: string | null,
>     created_at?: number | null
>   } | null
> } | null
> ```

***

## Payment Schedules

### list

`paymentSchedules.list`

List payment schedules. Returns a list of payment schedules that match all the specified filter conditions. The list is sorted by updated\_at in descending order. Use limit and offset to paginate through the results. Use invoice\_id to restrict results to one or more invoices.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.paymentSchedules.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `invoice_id` | `object` | No | optional, string filter The invoice number of the invoice this payment schedule belongs to. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *invoice\_id\\\[is\\] = "INV-001"* |
| `id` | `object` | No | optional, string filter An auto-generated unique identifier for the payment schedule. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *id\\\[is\\] = "ps\_123"* |
| `updated_at` | `object` | No | optional, timestamp(UTC) in seconds filter To filter based on `updated_at`. This attribute will be present only if the resource has been updated after 2016-09-28. **Supported operators :** after, before, on, between **Example →** *updated\_at\\\[after\\] = "1435054328"* |

> [accordion] invoice\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] updated\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   payment_schedule?: {
>     id?: string | null,
>     scheme_id?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     amount?: number | null,
>     created_at?: number | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     currency_code?: string | null,
>     schedule_entries?: {
>       id?: string | null,
>       date?: number | null,
>       amount?: number | null,
>       scheduled_amount?: number | null,
>       status?: string | null
>     }[] | null,
>     reference_transactions?: {
>       schedule_entry_id?: string | null,
>       applied_amount?: number | null,
>       txn_id?: string | null,
>       txn_status?: string | null,
>       txn_date?: number | null,
>       txn_amount?: number | null
>     }[] | null
>   } | null
> }[] | null
> ```

***

## Payment Schedule Schemes

### create

`paymentScheduleSchemes.create`

Create a payment schedule scheme. Creates a payment schedule scheme. After creating a payment schedule scheme, you can use it to generate payment schedules for multiple invoices.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.paymentScheduleSchemes.create({ name: 'example', number_of_schedules: 1, period_unit: 'day' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `number_of_schedules` | `number` | Yes | Specifies the total number of payment schedules for the invoice. The maximum `number_of_schedules` varies based on the `period_unit` : - **Day**: Up to 30 schedules \* **Week**: Up to 52 schedules \* **Month**: Up to 12 schedules |
| `period_unit` | `day \| week \| month` | Yes | Defines the time unit for intervals between payment schedules. Possible values are: day, week, and month. \* month - When the time unit for intervals between payment schedules is set as month \* week - When the time unit for intervals between payment schedules is set as week \* day - When the time unit for intervals between payment schedules is set as day |
| `period` | `number` | No | The time period between the effective dates of two consecutive payment schedules, expressed in period\_units. Use this parameter to have fixed intervals between payment schedules. The maximum `period` varies based on the `period_unit` : - **Day**: Up to 30 days \* **Week**: Up to 6 weeks \* **Month**: Up to 6 months |
| `name` | `string` | Yes | The name of a payment schedule scheme. |
| `flexible_schedules` | `object` | No | Parameters for flexible\_schedules |

> [accordion] flexible\_schedules full type
>
> ```ts theme={null}
> {
>   period?: number[],
>   amount_percentage?: number[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `payment_schedule_scheme` | `object \| null` | No | Payment schedules for an invoice refer to a payment structure where the `amount_due` on an invoice is divided into smaller, more manageable parts, each of which is paid over a specified period. Payment schedule scheme is a configuration or set of rules for creating payment schedules. After creating a payment schedule scheme, you can use it to generate payment schedules for multiple invoices. |

> [accordion] payment\_schedule\_scheme full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   number_of_schedules?: number | null,
>   period_unit?: string | null,
>   period?: number | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null
> } | null
> ```

***

### delete

`paymentScheduleSchemes.delete`

Delete a payment schedule scheme. This endpoint deletes a payment schedules created for an invoice.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.paymentScheduleSchemes.delete({ paymentScheduleSchemeId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `paymentScheduleSchemeId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `payment_schedule_scheme` | `object \| null` | No | Payment schedules for an invoice refer to a payment structure where the `amount_due` on an invoice is divided into smaller, more manageable parts, each of which is paid over a specified period. Payment schedule scheme is a configuration or set of rules for creating payment schedules. After creating a payment schedule scheme, you can use it to generate payment schedules for multiple invoices. |

> [accordion] payment\_schedule\_scheme full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   number_of_schedules?: number | null,
>   period_unit?: string | null,
>   period?: number | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null
> } | null
> ```

***

### get

`paymentScheduleSchemes.get`

Retrieve a payment schedule scheme. This endpoint retrieves an existing payment schedule.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.paymentScheduleSchemes.get({ paymentScheduleSchemeId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `paymentScheduleSchemeId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `payment_schedule_scheme` | `object \| null` | No | Payment schedules for an invoice refer to a payment structure where the `amount_due` on an invoice is divided into smaller, more manageable parts, each of which is paid over a specified period. Payment schedule scheme is a configuration or set of rules for creating payment schedules. After creating a payment schedule scheme, you can use it to generate payment schedules for multiple invoices. |

> [accordion] payment\_schedule\_scheme full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   description?: string | null,
>   number_of_schedules?: number | null,
>   period_unit?: string | null,
>   period?: number | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null
> } | null
> ```

***

### list

`paymentScheduleSchemes.list`

List payment schedule schemes. Returns a list of payment schedule schemes that match all the specified filter conditions. The list is sorted by id in descending order. Use limit and offset to paginate through the results.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.paymentScheduleSchemes.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `id` | `object` | No | optional, string filter An auto-generated unique identifier for the payment schedule scheme. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *id\\\[is\\] = "scheme-id"* |
| `updated_at` | `object` | No | optional, timestamp(UTC) in seconds filter To filter based on `updated_at`. This attribute will be present only if the resource has been updated after 2016-09-28. **Supported operators :** after, before, on, between **Example →** *updated\_at\\\[after\\] = "1435054328"* |

> [accordion] id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] updated\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   payment_schedule_scheme?: {
>     id?: string | null,
>     name?: string | null,
>     description?: string | null,
>     number_of_schedules?: number | null,
>     period_unit?: string | null,
>     period?: number | null,
>     created_at?: number | null,
>     resource_version?: number | null,
>     updated_at?: number | null
>   } | null
> }[] | null
> ```

***

## Payment Sources

### createBankAccount

`paymentSources.createBankAccount`

Create a bank account payment source. This API adds a Direct Debit payment source for a customer. The bank account details collected from your customer are passed as input to this API. #### Automated Clearing House (ACH) Network ACH is an electronic network for passing financial transactions in the US.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.paymentSources.createBankAccount({ customer_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customer_id` | `string` | Yes | Identifier of the customer with whom this payment source is associated. |
| `brand_id` | `string` | No | The unique ID of the [brand](https://docs.corsair.dev/docs/api/brands) this payment source should be linked to. Applicable only when multiple brands have been created for the site. This need not match the brand of the `customer_id`; when the two differ, the value provided here is used for the payment source. An alternative way of passing this parameter is by means of the `chargebee-brand-id` custom HTTP header; when both are provided, they must specify the same brand. **Default behavior** \* When not provided, the payment source is linked to the brand of the customer it is created for. |
| `issuing_country` | `string` | No | 2-letter(alpha2) ISO country code. Required when local bank details are provided, and not IBAN. |
| `replace_primary_payment_source` | `boolean` | No | Indicates whether the primary payment source should be replaced with this payment source. In case of Create Subscription for Customer endpoint, the default value is True. Otherwise, the default value is False. |
| `bank_account` | `object` | No | Parameters for bank\_account |

> [accordion] bank\_account full type
>
> ```ts theme={null}
> {
>   gateway_account_id?: string,
>   iban?: string,
>   first_name?: string,
>   last_name?: string,
>   company?: string,
>   email?: string,
>   phone?: string,
>   bank_name?: string,
>   account_number?: string,
>   routing_number?: string,
>   bank_code?: string,
>   account_type?: checking | savings | business_checking | current,
>   account_holder_type?: individual | company,
>   echeck_type?: web | ppd | ccd,
>   swedish_identity_number?: string,
>   billing_address?: {
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `payment_source` | `object \| null` | No | **Updates** This API obsoletes the [Cards API](https://docs.corsair.dev/docs/api/cards) in Chargebee. Represents the payment source for the customer. Specific types of payment source (Card, Direct Debit, Paypal Express Checkout, etc.) is defined as sub-resource in the response object. You can find the list of supported payment sources and the expected input parameters [here](https://docs.corsair.dev/docs/api/payment_parameters). See [Payment source attributes](https://docs.corsair.dev/docs/api/payment_sources/payment-source-object) for a descriptive list of attributes and payment source types. |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] payment\_source full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   customer_id?: string | null,
>   type?: string | null,
>   reference_id?: string | null,
>   status?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   ip_address?: string | null,
>   issuing_country?: string | null,
>   vault_token?: {
>   } | null,
>   deleted?: boolean | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   card?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     iin?: string | null,
>     last4?: string | null,
>     brand?: string | null,
>     funding_type?: string | null,
>     expiry_month?: number | null,
>     expiry_year?: number | null,
>     billing_addr1?: string | null,
>     billing_addr2?: string | null,
>     billing_city?: string | null,
>     billing_state_code?: string | null,
>     billing_state?: string | null,
>     billing_country?: string | null,
>     billing_zip?: string | null,
>     masked_number?: string | null
>   } | null,
>   bank_account?: {
>     last4?: string | null,
>     name_on_account?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     direct_debit_scheme?: string | null,
>     bank_name?: string | null,
>     mandate_id?: string | null,
>     account_type?: string | null,
>     echeck_type?: string | null,
>     account_holder_type?: string | null,
>     email?: string | null
>   } | null,
>   boleto?: {
>     last4?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   amazon_payment?: {
>     email?: string | null,
>     agreement_id?: string | null
>   } | null,
>   upi?: {
>     vpa?: string | null
>   } | null,
>   paypal?: {
>     email?: string | null,
>     agreement_id?: string | null
>   } | null,
>   venmo?: {
>     user_name?: string | null
>   } | null,
>   klarna_pay_now?: {
>     email?: string | null
>   } | null,
>   mandates?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   network_transaction_reference?: {
>     original_network_transaction_id?: string | null,
>     transaction_link_id?: string | null
>   } | null
> } | null
> ```

***

### createCard

`paymentSources.createCard`

Create a card payment source. Storing card after successful 3DS completion is not supported in this API. Use create using Payment Intent API under Payment source to store the card after successful 3DS flow completion.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.paymentSources.createCard({ customer_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customer_id` | `string` | Yes | Identifier of the customer with whom this payment source is associated. |
| `brand_id` | `string` | No | The unique ID of the [brand](https://docs.corsair.dev/docs/api/brands) this payment source should be linked to. Applicable only when multiple brands have been created for the site. This need not match the brand of the `customer_id`; when the two differ, the value provided here is used for the payment source. An alternative way of passing this parameter is by means of the `chargebee-brand-id` custom HTTP header; when both are provided, they must specify the same brand. **Default behavior** \* When not provided, the payment source is linked to the brand of the customer it is created for. |
| `replace_primary_payment_source` | `boolean` | No | Indicates whether the primary payment source should be replaced with this payment source. In case of Create Subscription for Customer endpoint, the default value is True. Otherwise, the default value is False. |
| `card` | `object` | No | Parameters for card |

> [accordion] card full type
>
> ```ts theme={null}
> {
>   gateway_account_id?: string,
>   first_name?: string,
>   last_name?: string,
>   number: string,
>   expiry_month: number,
>   expiry_year: number,
>   cvv?: string,
>   preferred_scheme?: cartes_bancaires | mastercard | visa | dankort,
>   billing_addr1?: string,
>   billing_addr2?: string,
>   billing_city?: string,
>   billing_state_code?: string,
>   billing_state?: string,
>   billing_zip?: string,
>   billing_country?: string,
>   additional_information?: {
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `payment_source` | `object \| null` | No | **Updates** This API obsoletes the [Cards API](https://docs.corsair.dev/docs/api/cards) in Chargebee. Represents the payment source for the customer. Specific types of payment source (Card, Direct Debit, Paypal Express Checkout, etc.) is defined as sub-resource in the response object. You can find the list of supported payment sources and the expected input parameters [here](https://docs.corsair.dev/docs/api/payment_parameters). See [Payment source attributes](https://docs.corsair.dev/docs/api/payment_sources/payment-source-object) for a descriptive list of attributes and payment source types. |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] payment\_source full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   customer_id?: string | null,
>   type?: string | null,
>   reference_id?: string | null,
>   status?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   ip_address?: string | null,
>   issuing_country?: string | null,
>   vault_token?: {
>   } | null,
>   deleted?: boolean | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   card?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     iin?: string | null,
>     last4?: string | null,
>     brand?: string | null,
>     funding_type?: string | null,
>     expiry_month?: number | null,
>     expiry_year?: number | null,
>     billing_addr1?: string | null,
>     billing_addr2?: string | null,
>     billing_city?: string | null,
>     billing_state_code?: string | null,
>     billing_state?: string | null,
>     billing_country?: string | null,
>     billing_zip?: string | null,
>     masked_number?: string | null
>   } | null,
>   bank_account?: {
>     last4?: string | null,
>     name_on_account?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     direct_debit_scheme?: string | null,
>     bank_name?: string | null,
>     mandate_id?: string | null,
>     account_type?: string | null,
>     echeck_type?: string | null,
>     account_holder_type?: string | null,
>     email?: string | null
>   } | null,
>   boleto?: {
>     last4?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   amazon_payment?: {
>     email?: string | null,
>     agreement_id?: string | null
>   } | null,
>   upi?: {
>     vpa?: string | null
>   } | null,
>   paypal?: {
>     email?: string | null,
>     agreement_id?: string | null
>   } | null,
>   venmo?: {
>     user_name?: string | null
>   } | null,
>   klarna_pay_now?: {
>     email?: string | null
>   } | null,
>   mandates?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   network_transaction_reference?: {
>     original_network_transaction_id?: string | null,
>     transaction_link_id?: string | null
>   } | null
> } | null
> ```

***

### createUsingPaymentIntent

`paymentSources.createUsingPaymentIntent`

Create using payment intent. Used to attach the card to the customer after 3DS completion. Learn more on the 3DS implementation via Chargebee APIs.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.paymentSources.createUsingPaymentIntent({ customer_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customer_id` | `string` | Yes | Identifier of the customer with whom this payment source is associated. |
| `brand_id` | `string` | No | The unique ID of the [brand](https://docs.corsair.dev/docs/api/brands) this payment source should be linked to. Applicable only when multiple brands have been created for the site. This need not match the brand of the `customer_id`; when the two differ, the value provided here is used for the payment source. An alternative way of passing this parameter is by means of the `chargebee-brand-id` custom HTTP header; when both are provided, they must specify the same brand. **Default behavior** \* When not provided, the payment source is linked to the brand of the customer it is created for. |
| `replace_primary_payment_source` | `boolean` | No | Indicates whether the primary payment source should be replaced with this payment source. In case of Create Subscription for Customer endpoint, the default value is True. Otherwise, the default value is False. |
| `payment_intent` | `object` | No | Parameters for payment\_intent |

> [accordion] payment\_intent full type
>
> ```ts theme={null}
> {
>   id?: string,
>   gateway_account_id?: string,
>   gw_token?: string,
>   payment_method_type?: card | ideal | sofort | bancontact | google_pay | dotpay | giropay | apple_pay | upi | netbanking_emandates | paypal_express_checkout | direct_debit | boleto | venmo | amazon_payments | pay_to | faster_payments | sepa_instant_transfer | klarna_pay_now | online_banking_poland | payconiq_by_bancontact | electronic_payment_standard | kbc_payment_button | pay_by_bank | trustly | stablecoin | kakao_pay | naver_pay | revolut_pay | cash_app_pay | wechat_pay | alipay | twint | go_pay | grab_pay | pay_co | after_pay | swish | payme | pix | klarna | alipay_hk | paypay | gcash | south_korean_cards | paynow | bizum | promptpay | dana | touch_n_go | tamara | qpay | ovo | momo | mercado_pago | nequi | nupay | picpay | thai_qr | blik | fpx | wero | p24 | affirm_pay | rakuten_pay,
>   reference_id?: string,
>   additional_info?: {
>   },
>   additional_information?: {
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `payment_source` | `object \| null` | No | **Updates** This API obsoletes the [Cards API](https://docs.corsair.dev/docs/api/cards) in Chargebee. Represents the payment source for the customer. Specific types of payment source (Card, Direct Debit, Paypal Express Checkout, etc.) is defined as sub-resource in the response object. You can find the list of supported payment sources and the expected input parameters [here](https://docs.corsair.dev/docs/api/payment_parameters). See [Payment source attributes](https://docs.corsair.dev/docs/api/payment_sources/payment-source-object) for a descriptive list of attributes and payment source types. |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] payment\_source full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   customer_id?: string | null,
>   type?: string | null,
>   reference_id?: string | null,
>   status?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   ip_address?: string | null,
>   issuing_country?: string | null,
>   vault_token?: {
>   } | null,
>   deleted?: boolean | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   card?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     iin?: string | null,
>     last4?: string | null,
>     brand?: string | null,
>     funding_type?: string | null,
>     expiry_month?: number | null,
>     expiry_year?: number | null,
>     billing_addr1?: string | null,
>     billing_addr2?: string | null,
>     billing_city?: string | null,
>     billing_state_code?: string | null,
>     billing_state?: string | null,
>     billing_country?: string | null,
>     billing_zip?: string | null,
>     masked_number?: string | null
>   } | null,
>   bank_account?: {
>     last4?: string | null,
>     name_on_account?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     direct_debit_scheme?: string | null,
>     bank_name?: string | null,
>     mandate_id?: string | null,
>     account_type?: string | null,
>     echeck_type?: string | null,
>     account_holder_type?: string | null,
>     email?: string | null
>   } | null,
>   boleto?: {
>     last4?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   amazon_payment?: {
>     email?: string | null,
>     agreement_id?: string | null
>   } | null,
>   upi?: {
>     vpa?: string | null
>   } | null,
>   paypal?: {
>     email?: string | null,
>     agreement_id?: string | null
>   } | null,
>   venmo?: {
>     user_name?: string | null
>   } | null,
>   klarna_pay_now?: {
>     email?: string | null
>   } | null,
>   mandates?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   network_transaction_reference?: {
>     original_network_transaction_id?: string | null,
>     transaction_link_id?: string | null
>   } | null
> } | null
> ```

***

### createUsingPermanentToken

`paymentSources.createUsingPermanentToken`

Create using permanent token. Creates a payment source for a customer using a permanent token obtained from the payment gateway. Use this API to add a payment method that has already been vaulted in your gateway account. The permanent token enables Chargebee to securely link the payment method to the customer.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.paymentSources.createUsingPermanentToken({ customer_id: 'example', type: 'card' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customer_id` | `string` | Yes | Identifier of the customer with whom this payment source is associated. |
| `brand_id` | `string` | No | The unique ID of the [brand](https://docs.corsair.dev/docs/api/brands) this payment source should be linked to. Applicable only when multiple brands have been created for the site. This need not match the brand of the `customer_id`; when the two differ, the value provided here is used for the payment source. An alternative way of passing this parameter is by means of the `chargebee-brand-id` custom HTTP header; when both are provided, they must specify the same brand. **Default behavior** \* When not provided, the payment source is linked to the brand of the customer it is created for. |
| `type` | `card \| paypal_express_checkout \| amazon_payments \| direct_debit \| generic \| alipay \| unionpay \| apple_pay \| wechat_pay \| ideal \| google_pay \| sofort \| bancontact \| giropay \| dotpay \| upi \| netbanking_emandates \| venmo \| pay_to \| faster_payments \| sepa_instant_transfer \| automated_bank_transfer \| klarna_pay_now \| online_banking_poland \| payconiq_by_bancontact \| electronic_payment_standard \| kbc_payment_button \| pay_by_bank \| trustly \| stablecoin \| kakao_pay \| naver_pay \| revolut_pay \| cash_app_pay \| twint \| go_pay \| grab_pay \| pay_co \| after_pay \| swish \| payme \| pix \| klarna \| alipay_hk \| paypay \| gcash \| south_korean_cards \| paynow \| bizum \| promptpay \| dana \| touch_n_go \| tamara \| qpay \| ovo \| momo \| mercado_pago \| nequi \| nupay \| picpay \| thai_qr \| blik \| fpx \| wero \| p24 \| affirm_pay \| rakuten_pay` | Yes | The type of payment method. For more details refer [Update payment method for a customer](https://docs.corsair.dev/docs/api/customers/update-payment-method-for-a-customer) API under Customer resource. \* direct\_debit - Represents bank account for which the direct debit or ACH agreement/mandate is created. \* unionpay - Payments made via UnionPay. \* ovo - Payments made via OVO. \* google\_pay - Payments made via Google Pay. \* mercado\_pago - Payments made via Mercado Pago. \* sepa\_instant\_transfer - Payments made via Sepa Instant Transfer \* dotpay - Payments made via Dotpay. \* pay\_to - Payments made via PayTo \* klarna - Payments made via Klarna. \* revolut\_pay - Payments made via Revolut Pay. \* thai\_qr - Payments made via Thai QR. \* naver\_pay - Payments made via Naver Pay. \* giropay - Payments made via giropay. \* grab\_pay - Payments made via GrabPay \* rakuten\_pay - Payments made via Rakuten Pay. \* blik - Payments made via BLIK. \* stablecoin - Payments made via Stablecoin. \* alipay - Payments made via Alipay. This payment source is deprecated. \* kakao\_pay - Payments made via Kakao Pay. \* sofort - Payments made via Sofort. \* gcash - Payments made via GCash. \* dana - Payments made via Dana. \* pix - Payments made via Pix \* p24 - Payments made via Przelewy24 (P24). \* pay\_co - Payments made via PayCo \* wechat\_pay - Payments made via WeChat Pay. This payment source is deprecated. \* netbanking\_emandates - Netbanking (eMandates) Payments. \* nupay - Payments made via NuPay. \* picpay - Payments made via PicPay. \* bancontact - Payments made via Bancontact Card. \* go\_pay - Payments made via GoPay \* nequi - Payments made via Nequi. \* card - Card based payment including credit cards and debit cards. Details about the card can be obtained from the card resource. \* amazon\_payments - Payments made via Amazon Payments. \* pay\_by\_bank - Pay By Bank \* online\_banking\_poland - Payments made via Online Banking Poland \* touch\_n\_go - Payments made via Touch 'n Go. \* after\_pay - Payments made via Afterpay \* faster\_payments - Payments made via Faster Payments \* alipay\_hk - Payments made via Alipay HK. \* momo - Payments made via MoMo. \* fpx - Payments made via FPX. \* paypay - Payments made via PayPay \* generic - Payments made via Generic Payment Method. \* payme - Payments made via PayMe \* tamara - Payments made via Tamara. \* klarna\_pay\_now - Payments made via Klarna Pay Now \* twint - Payments made via Twint \* swish - Payments made via Swish \* automated\_bank\_transfer - Represents virtual bank account using which the payment will be done. \* paypal\_express\_checkout - Payments made via PayPal Express Checkout. \* venmo - Payments made via Venmo \* ideal - Payments made via iDEAL. \* trustly - Trustly \* upi - UPI Payments. \* wero - Payments made via Wero. \* kbc\_payment\_button - KBC Payment Button \* cash\_app\_pay - Payments made via Cash App Pay. \* payconiq\_by\_bancontact - Payments made via Payconiq by Bancontact. \* south\_korean\_cards - Payments made via South Korean Cards \* qpay - Payments made via Qpay. \* affirm\_pay - Payments made via Affirm Pay. \* apple\_pay - Payments made via Apple Pay. \* electronic\_payment\_standard - Electronic Payment Standard |
| `gateway_account_id` | `string` | No | The gateway account to which the payment source is associated. |
| `reference_id` | `string` | No | The reference id. In the case of Amazon and PayPal, this will be the billing agreement ID. For GoCardless direct debit this will be `mandate_id`. In the case of a card, this will be the identifier provided by the gateway or card vault for the specific payment method resource. **Note:** \* This is not the one-time temporary token provided by gateways like Stripe. \* `reference_id` is an alternative for `payment_method_token`, `customer_profile_token`, `network_transaction_id`, or `mandate_id`. \* `payment_method_token`, `customer_profile_token`, `network_transaction_id`, or `mandate_id` cannot be used with `reference_id`. \* `reference_id` is a combination of multiple tokens available at the gateway. Learn more about the combination of each gateway from this [document](https://docs.corsair.dev/docs/api/payment_parameters). |
| `issuing_country` | `string` | No | 2-letter (alpha2) ISO country code. Indicates your customer's payment method country of issuance. Applicable for PayPal via Braintree. |
| `replace_primary_payment_source` | `boolean` | No | Indicates whether the primary payment source should be replaced with this payment source. In case of Create Subscription for Customer endpoint, the default value is True. Otherwise, the default value is False. |
| `payment_method_token` | `string` | No | An identifier provided by the gateway or card vault for the specific payment method resource. **Note:** `payment_method_token` is an alternative for reference\_id and cannot be used with `reference_id`. |
| `customer_profile_token` | `string` | No | A unique identifier associated with a customer\\`s profile within a payment gateway. **Note:** `customer\_profile\_token`is an alternative for reference_id and cannot be used with`reference\_id\`. |
| `network_transaction_id` | `string` | No | An identifier of the payment or authorization transaction at the gateway initiated using this payment method. **Note:** `network_transaction_id` is an alternative for reference\_id and cannot be used with `reference_id`. |
| `mandate_id` | `string` | No | An identifier of mandates which is an authorization given by the payer (usually a customer or account holder) to allow a third party such as a merchant or service provider to initiate payments from their account. **Note:** `mandate_id` is an alternative for reference\_id and cannot be used with `reference_id`. |
| `skip_retrieval` | `boolean` | No | By default, the value is `false` and payment method details will be retrieved from the selected payment gateway using `reference_id` or `payment_method_token` / `customer_profile_token` / `network_transaction_id` / `mandate_id`. Learn more about the multiple token combinations of each gateway from this [document](https://docs.corsair.dev/docs/api/payment_parameters). Enter the value as `true` for the payment gateways that do not allow to retrieve the payment method details. Once passed, it will create payment method at Chargebee with the provided attributes in `payment_method_token`, `customer_profile_token`, `network_transaction_id`, `mandate_id`, `card`, and `billing_address`. **Note:** Currently, the `skip_retrieval` value as `true` is only supported for the Vantiv payment gateway. |
| `additional_information` | `object` | No | \* `checkout_com`: While adding a new payment method using [permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) or passing raw card details to Checkout.com, `document` ID and `country_of_residence` are required to support payments through [dLocal](https://docs.checkout.com/payment-methods/cards/dlocal). \* `payer`: User related information. \* `country_of_residence`: This is required since the billing country associated with the user's payment method may not be the same as their country of residence. Hence the user's country of residence needs to be specified. The country code should be a [two-character ISO code](https://docs.checkout.com/resources/codes/country-codes). \* `document`: Document ID is the user's [identification number](https://docs.dlocal.com/api-documentation/payins-api-reference/country-reference#documents) based on their country. \* `bluesnap`: While passing raw card details to BlueSnap, if `fraud_session_id` is added, [additional validation](https://developers.bluesnap.com/docs/fraud-prevention) is performed to avoid fraudulent transactions. \* `fraud`: Fraud identification related information. \* `fraud_session_id`: Your [BlueSnap fraud session ID](https://developers.bluesnap.com/docs/fraud-prevention#section-implementing-device-data-collector) required to perform anti-fraud validation. \* `braintree`: While passing raw card details to Braintree, your `fraud_merchant_id` and the user's `device_session_id` can be added to perform [additional validation](https://developers.braintreepayments.com/guides/premium-fraud-management-tools/device-data-collection/javascript/v3#collecting-device-data) and avoid fraudulent transactions. \* `fraud`: Fraud identification related information. \* `device_session_id`: Session ID associated with the user's device. \* `fraud_merchant_id`: Your [merchant ID](https://developers.braintreepayments.com/guides/premium-fraud-management-tools/device-data-collection/javascript/v3#collecting-device-data) for fraud detection. \* `chargebee_payments`: While passing raw card details to Chargebee Payments, if `fraud_session_id` is added, additional validation is performed to avoid fraudulent transactions. \* `fraud`: Fraud identification related information. \* `fraud_session_id`: Your Chargebee Payments fraud session ID required to perform anti-fraud validation. \* `bank_of_america`: While passing raw card details to Bank of America, your user's `device_session_id` can be added to perform additional validation and avoid fraudulent transactions. \* `fraud`: Fraud identification related information. \* `device_session_id`: Session ID associated with the user's device. \* `ecentric`: This parameter is used to verify and process payment method details in Ecentric. If the `merchant_id` parameter is included, Chargebee will vault it / perform a lookup and verification against this `merchant_id`, overriding the one configured in Chargebee. If tokens and processing occur in the same Merchant GUID, you can just skip this part. \* `merchant_id`: Merchant GUID where the card is vaulted or need to be vaulted. \* `ebanx`: While passing raw card details to EBANX, the user's `document` is required for some countries and `device_session_id` can be added to perform [additional validation](https://developer.ebanx.com/docs/payments/guides/features/device-fingerprint#device-fingerprint) and avoid fraudulent transactions. \* `payer`: User related information. \* `document`: Document is the user's identification number based on their country. \* `fraud`: Fraud identification related information. \* `device_session_id`: Session ID associated with the user's device . |
| `card` | `object` | No | Parameters of tokenized card details |
| `bank_account` | `object` | No | — |
| `billing_address` | `object` | No | Parameters for billing\_address |

> [accordion] additional\_information full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] card full type
>
> ```ts theme={null}
> {
>   last4?: string,
>   iin?: string,
>   expiry_month?: number,
>   expiry_year?: number,
>   brand?: visa | mastercard | american_express | discover | jcb | diners_club | other | bancontact | cmr_falabella | tarjeta_naranja | nativa | cencosud | cabal | argencard | elo | hipercard | carnet | rupay | maestro | dankort | cartes_bancaires | mada,
>   funding_type?: credit | debit | prepaid | not_known
> }
> ```

> [accordion] bank\_account full type
>
> ```ts theme={null}
> {
>   account_type?: checking | savings | business_checking | current,
>   account_holder_type?: individual | company,
>   first_name?: string,
>   last_name?: string,
>   company?: string,
>   scheme?: ach | bacs | sepa_core | autogiro | becs | becs_nz | pad,
>   last4?: string,
>   echeck_type?: web | ppd | ccd
> }
> ```

> [accordion] billing\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `payment_source` | `object \| null` | No | **Updates** This API obsoletes the [Cards API](https://docs.corsair.dev/docs/api/cards) in Chargebee. Represents the payment source for the customer. Specific types of payment source (Card, Direct Debit, Paypal Express Checkout, etc.) is defined as sub-resource in the response object. You can find the list of supported payment sources and the expected input parameters [here](https://docs.corsair.dev/docs/api/payment_parameters). See [Payment source attributes](https://docs.corsair.dev/docs/api/payment_sources/payment-source-object) for a descriptive list of attributes and payment source types. |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] payment\_source full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   customer_id?: string | null,
>   type?: string | null,
>   reference_id?: string | null,
>   status?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   ip_address?: string | null,
>   issuing_country?: string | null,
>   vault_token?: {
>   } | null,
>   deleted?: boolean | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   card?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     iin?: string | null,
>     last4?: string | null,
>     brand?: string | null,
>     funding_type?: string | null,
>     expiry_month?: number | null,
>     expiry_year?: number | null,
>     billing_addr1?: string | null,
>     billing_addr2?: string | null,
>     billing_city?: string | null,
>     billing_state_code?: string | null,
>     billing_state?: string | null,
>     billing_country?: string | null,
>     billing_zip?: string | null,
>     masked_number?: string | null
>   } | null,
>   bank_account?: {
>     last4?: string | null,
>     name_on_account?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     direct_debit_scheme?: string | null,
>     bank_name?: string | null,
>     mandate_id?: string | null,
>     account_type?: string | null,
>     echeck_type?: string | null,
>     account_holder_type?: string | null,
>     email?: string | null
>   } | null,
>   boleto?: {
>     last4?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   amazon_payment?: {
>     email?: string | null,
>     agreement_id?: string | null
>   } | null,
>   upi?: {
>     vpa?: string | null
>   } | null,
>   paypal?: {
>     email?: string | null,
>     agreement_id?: string | null
>   } | null,
>   venmo?: {
>     user_name?: string | null
>   } | null,
>   klarna_pay_now?: {
>     email?: string | null
>   } | null,
>   mandates?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   network_transaction_reference?: {
>     original_network_transaction_id?: string | null,
>     transaction_link_id?: string | null
>   } | null
> } | null
> ```

***

### createUsingTempToken

`paymentSources.createUsingTempToken`

Create using gateway temporary token. This API offers an alternative way to create a payment source using a single-use gateway temporary token, which is generally provided by your payment gateway. In the case of Stripe, this temporary token is generated according to the instruction detailed in Stripe documentation.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.paymentSources.createUsingTempToken({ customer_id: 'example', tmp_token: 'example', type: 'card' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customer_id` | `string` | Yes | Identifier of the customer with whom this payment source is associated. |
| `gateway_account_id` | `string` | No | The gateway account to which the payment source is associated. |
| `type` | `card \| paypal_express_checkout \| amazon_payments \| direct_debit \| generic \| alipay \| unionpay \| apple_pay \| wechat_pay \| ideal \| google_pay \| sofort \| bancontact \| giropay \| dotpay \| upi \| netbanking_emandates \| venmo \| pay_to \| faster_payments \| sepa_instant_transfer \| automated_bank_transfer \| klarna_pay_now \| online_banking_poland \| payconiq_by_bancontact \| electronic_payment_standard \| kbc_payment_button \| pay_by_bank \| trustly \| stablecoin \| kakao_pay \| naver_pay \| revolut_pay \| cash_app_pay \| twint \| go_pay \| grab_pay \| pay_co \| after_pay \| swish \| payme \| pix \| klarna \| alipay_hk \| paypay \| gcash \| south_korean_cards \| paynow \| bizum \| promptpay \| dana \| touch_n_go \| tamara \| qpay \| ovo \| momo \| mercado_pago \| nequi \| nupay \| picpay \| thai_qr \| blik \| fpx \| wero \| p24 \| affirm_pay \| rakuten_pay` | Yes | Type of payment source. \* direct\_debit - Represents bank account for which the direct debit or ACH agreement/mandate is created. \* touch\_n\_go - Payments made via Touch 'n Go. \* unionpay - Payments made via UnionPay. \* ovo - Payments made via OVO. \* after\_pay - Payments made via Afterpay \* faster\_payments - Payments made via Faster Payments \* google\_pay - Payments made via Google Pay. \* alipay\_hk - Payments made via Alipay HK. \* momo - Payments made via MoMo. \* mercado\_pago - Payments made via Mercado Pago. \* sepa\_instant\_transfer - Payments made via Sepa Instant Transfer \* fpx - Payments made via FPX. \* dotpay - Payments made via Dotpay. \* pay\_to - Payments made via PayTo \* klarna - Payments made via Klarna. \* revolut\_pay - Payments made via Revolut Pay. \* thai\_qr - Payments made via Thai QR. \* naver\_pay - Payments made via Naver Pay. \* paypay - Payments made via PayPay \* generic - Payments made via Generic Payment Method. \* payme - Payments made via PayMe \* giropay - Payments made via giropay. \* tamara - Payments made via Tamara. \* klarna\_pay\_now - Payments made via Klarna Pay Now \* grab\_pay - Payments made via GrabPay \* rakuten\_pay - Payments made via Rakuten Pay. \* twint - Payments made via Twint \* swish - Payments made via Swish \* automated\_bank\_transfer - Represents virtual bank account using which the payment will be done. \* blik - Payments made via BLIK. \* stablecoin - Payments made via Stablecoin. \* paypal\_express\_checkout - Payments made via PayPal Express Checkout. \* alipay - Payments made via Alipay. This payment source is deprecated. \* venmo - Payments made via Venmo \* kakao\_pay - Payments made via Kakao Pay. \* sofort - Payments made via Sofort. \* gcash - Payments made via GCash. \* dana - Payments made via Dana. \* pix - Payments made via Pix \* p24 - Payments made via Przelewy24 (P24). \* pay\_co - Payments made via PayCo \* wechat\_pay - Payments made via WeChat Pay. This payment source is deprecated. \* ideal - Payments made via iDEAL. \* trustly - Trustly \* netbanking\_emandates - Netbanking (eMandates) Payments. \* upi - UPI Payments. \* nupay - Payments made via NuPay. \* picpay - Payments made via PicPay. \* bancontact - Payments made via Bancontact Card. \* go\_pay - Payments made via GoPay \* nequi - Payments made via Nequi. \* wero - Payments made via Wero. \* kbc\_payment\_button - KBC Payment Button \* card - Card based payment including credit cards and debit cards. Details about the card can be obtained from the card resource. \* cash\_app\_pay - Payments made via Cash App Pay. \* payconiq\_by\_bancontact - Payments made via Payconiq by Bancontact. \* amazon\_payments - Payments made via Amazon Payments. \* south\_korean\_cards - Payments made via South Korean Cards \* pay\_by\_bank - Pay By Bank \* online\_banking\_poland - Payments made via Online Banking Poland \* qpay - Payments made via Qpay. \* affirm\_pay - Payments made via Affirm Pay. \* apple\_pay - Payments made via Apple Pay. \* electronic\_payment\_standard - Electronic Payment Standard |
| `tmp_token` | `string` | Yes | Single-use token created by payment gateways. In Stripe, a single-use token is created for Apple Pay Wallet, card details or direct debit. In Braintree, a nonce is created for Apple Pay Wallet, PayPal, or card details. In Authorize.net, a nonce is created for card details. In Adyen, an encrypted data is created from the card details. |
| `issuing_country` | `string` | No | 2-letter (alpha2) ISO country code. Indicates your customer's payment method country of issuance. Applicable for PayPal via Braintree. |
| `brand_id` | `string` | No | The unique ID of the [brand](https://docs.corsair.dev/docs/api/brands) this payment source should be linked to. Applicable only when multiple brands have been created for the site. This need not match the brand of the `customer_id`; when the two differ, the value provided here is used for the payment source. An alternative way of passing this parameter is by means of the `chargebee-brand-id` custom HTTP header; when both are provided, they must specify the same brand. **Default behavior** \* When not provided, the payment source is linked to the brand of the customer it is created for. |
| `replace_primary_payment_source` | `boolean` | No | Indicates whether the primary payment source should be replaced with this payment source. In case of Create Subscription for Customer endpoint, the default value is True. Otherwise, the default value is False. |
| `additional_information` | `object` | No | \* `checkout_com`: While adding a new payment method using [permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) or passing raw card details to Checkout.com, `document` ID and `country_of_residence` are required to support payments through [dLocal](https://docs.checkout.com/payment-methods/cards/dlocal). \* `payer`: User related information. \* `country_of_residence`: This is required since the billing country associated with the user's payment method may not be the same as their country of residence. Hence the user's country of residence needs to be specified. The country code should be a [two-character ISO code](https://docs.checkout.com/resources/codes/country-codes). \* `document`: Document ID is the user's [identification number](https://docs.dlocal.com/api-documentation/payins-api-reference/country-reference#documents) based on their country. \* `bluesnap`: While passing raw card details to BlueSnap, if `fraud_session_id` is added, [additional validation](https://developers.bluesnap.com/docs/fraud-prevention) is performed to avoid fraudulent transactions. \* `fraud`: Fraud identification related information. \* `fraud_session_id`: Your [BlueSnap fraud session ID](https://developers.bluesnap.com/docs/fraud-prevention#section-implementing-device-data-collector) required to perform anti-fraud validation. \* `braintree`: While passing raw card details to Braintree, your `fraud_merchant_id` and the user's `device_session_id` can be added to perform [additional validation](https://developers.braintreepayments.com/guides/premium-fraud-management-tools/device-data-collection/javascript/v3#collecting-device-data) and avoid fraudulent transactions. \* `fraud`: Fraud identification related information. \* `device_session_id`: Session ID associated with the user's device. \* `fraud_merchant_id`: Your [merchant ID](https://developers.braintreepayments.com/guides/premium-fraud-management-tools/device-data-collection/javascript/v3#collecting-device-data) for fraud detection. \* `chargebee_payments`: While passing raw card details to Chargebee Payments, if `fraud_session_id` is added, additional validation is performed to avoid fraudulent transactions. \* `fraud`: Fraud identification related information. \* `fraud_session_id`: Your Chargebee Payments fraud session ID required to perform anti-fraud validation. \* `bank_of_america`: While passing raw card details to Bank of America, your user's `device_session_id` can be added to perform additional validation and avoid fraudulent transactions. \* `fraud`: Fraud identification related information. \* `device_session_id`: Session ID associated with the user's device. \* `ecentric`: This parameter is used to verify and process payment method details in Ecentric. If the `merchant_id` parameter is included, Chargebee will vault it / perform a lookup and verification against this `merchant_id`, overriding the one configured in Chargebee. If tokens and processing occur in the same Merchant GUID, you can just skip this part. \* `merchant_id`: Merchant GUID where the card is vaulted or need to be vaulted. \* `ebanx`: While passing raw card details to EBANX, the user's `document` is required for some countries and `device_session_id` can be added to perform [additional validation](https://developer.ebanx.com/docs/payments/guides/features/device-fingerprint#device-fingerprint) and avoid fraudulent transactions. \* `payer`: User related information. \* `document`: Document is the user's identification number based on their country. \* `fraud`: Fraud identification related information. \* `device_session_id`: Session ID associated with the user's device . |

> [accordion] additional\_information full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `payment_source` | `object \| null` | No | **Updates** This API obsoletes the [Cards API](https://docs.corsair.dev/docs/api/cards) in Chargebee. Represents the payment source for the customer. Specific types of payment source (Card, Direct Debit, Paypal Express Checkout, etc.) is defined as sub-resource in the response object. You can find the list of supported payment sources and the expected input parameters [here](https://docs.corsair.dev/docs/api/payment_parameters). See [Payment source attributes](https://docs.corsair.dev/docs/api/payment_sources/payment-source-object) for a descriptive list of attributes and payment source types. |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] payment\_source full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   customer_id?: string | null,
>   type?: string | null,
>   reference_id?: string | null,
>   status?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   ip_address?: string | null,
>   issuing_country?: string | null,
>   vault_token?: {
>   } | null,
>   deleted?: boolean | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   card?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     iin?: string | null,
>     last4?: string | null,
>     brand?: string | null,
>     funding_type?: string | null,
>     expiry_month?: number | null,
>     expiry_year?: number | null,
>     billing_addr1?: string | null,
>     billing_addr2?: string | null,
>     billing_city?: string | null,
>     billing_state_code?: string | null,
>     billing_state?: string | null,
>     billing_country?: string | null,
>     billing_zip?: string | null,
>     masked_number?: string | null
>   } | null,
>   bank_account?: {
>     last4?: string | null,
>     name_on_account?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     direct_debit_scheme?: string | null,
>     bank_name?: string | null,
>     mandate_id?: string | null,
>     account_type?: string | null,
>     echeck_type?: string | null,
>     account_holder_type?: string | null,
>     email?: string | null
>   } | null,
>   boleto?: {
>     last4?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   amazon_payment?: {
>     email?: string | null,
>     agreement_id?: string | null
>   } | null,
>   upi?: {
>     vpa?: string | null
>   } | null,
>   paypal?: {
>     email?: string | null,
>     agreement_id?: string | null
>   } | null,
>   venmo?: {
>     user_name?: string | null
>   } | null,
>   klarna_pay_now?: {
>     email?: string | null
>   } | null,
>   mandates?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   network_transaction_reference?: {
>     original_network_transaction_id?: string | null,
>     transaction_link_id?: string | null
>   } | null
> } | null
> ```

***

### createUsingToken

`paymentSources.createUsingToken`

Create using Chargebee token. Storing card after successful 3DS completion is not supported in this API. Use create using Payment Intent API under Payment source to store the card after successful 3DS flow completion.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.paymentSources.createUsingToken({ customer_id: 'example', token_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customer_id` | `string` | Yes | Identifier of the customer with whom this payment source is associated. |
| `brand_id` | `string` | No | The unique ID of the [brand](https://docs.corsair.dev/docs/api/brands) this payment source should be linked to. Applicable only when multiple brands have been created for the site. This need not match the brand of the `customer_id`; when the two differ, the value provided here is used for the payment source. An alternative way of passing this parameter is by means of the `chargebee-brand-id` custom HTTP header; when both are provided, they must specify the same brand. **Default behavior** \* When not provided, the payment source is linked to the brand of the customer it is created for. |
| `replace_primary_payment_source` | `boolean` | No | Indicates whether the primary payment source should be replaced with this payment source. In case of Create Subscription for Customer endpoint, the default value is True. Otherwise, the default value is False. |
| `token_id` | `string` | Yes | Token generated by Chargebee.js representing payment method details. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `payment_source` | `object \| null` | No | **Updates** This API obsoletes the [Cards API](https://docs.corsair.dev/docs/api/cards) in Chargebee. Represents the payment source for the customer. Specific types of payment source (Card, Direct Debit, Paypal Express Checkout, etc.) is defined as sub-resource in the response object. You can find the list of supported payment sources and the expected input parameters [here](https://docs.corsair.dev/docs/api/payment_parameters). See [Payment source attributes](https://docs.corsair.dev/docs/api/payment_sources/payment-source-object) for a descriptive list of attributes and payment source types. |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] payment\_source full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   customer_id?: string | null,
>   type?: string | null,
>   reference_id?: string | null,
>   status?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   ip_address?: string | null,
>   issuing_country?: string | null,
>   vault_token?: {
>   } | null,
>   deleted?: boolean | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   card?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     iin?: string | null,
>     last4?: string | null,
>     brand?: string | null,
>     funding_type?: string | null,
>     expiry_month?: number | null,
>     expiry_year?: number | null,
>     billing_addr1?: string | null,
>     billing_addr2?: string | null,
>     billing_city?: string | null,
>     billing_state_code?: string | null,
>     billing_state?: string | null,
>     billing_country?: string | null,
>     billing_zip?: string | null,
>     masked_number?: string | null
>   } | null,
>   bank_account?: {
>     last4?: string | null,
>     name_on_account?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     direct_debit_scheme?: string | null,
>     bank_name?: string | null,
>     mandate_id?: string | null,
>     account_type?: string | null,
>     echeck_type?: string | null,
>     account_holder_type?: string | null,
>     email?: string | null
>   } | null,
>   boleto?: {
>     last4?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   amazon_payment?: {
>     email?: string | null,
>     agreement_id?: string | null
>   } | null,
>   upi?: {
>     vpa?: string | null
>   } | null,
>   paypal?: {
>     email?: string | null,
>     agreement_id?: string | null
>   } | null,
>   venmo?: {
>     user_name?: string | null
>   } | null,
>   klarna_pay_now?: {
>     email?: string | null
>   } | null,
>   mandates?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   network_transaction_reference?: {
>     original_network_transaction_id?: string | null,
>     transaction_link_id?: string | null
>   } | null
> } | null
> ```

***

### createVoucherPaymentSource

`paymentSources.createVoucherPaymentSource`

Create a voucher payment method. for the payment source.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.paymentSources.createVoucherPaymentSource({ customer_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customer_id` | `string` | Yes | Identifier of the customer with whom this payment source is associated. |
| `brand_id` | `string` | No | The unique ID of the [brand](https://docs.corsair.dev/docs/api/brands) this payment source should be linked to. Applicable only when multiple brands have been created for the site. This need not match the brand of the `customer_id`; when the two differ, the value provided here is used for the payment source. An alternative way of passing this parameter is by means of the `chargebee-brand-id` custom HTTP header; when both are provided, they must specify the same brand. **Default behavior** \* When not provided, the payment source is linked to the brand of the customer it is created for. |
| `voucher_payment_source` | `object` | No | Parameters for voucher\_payment\_source |

> [accordion] voucher\_payment\_source full type
>
> ```ts theme={null}
> {
>   voucher_type: boleto,
>   gateway_account_id?: string,
>   tax_id?: string,
>   billing_address?: {
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `payment_source` | `object \| null` | No | **Updates** This API obsoletes the [Cards API](https://docs.corsair.dev/docs/api/cards) in Chargebee. Represents the payment source for the customer. Specific types of payment source (Card, Direct Debit, Paypal Express Checkout, etc.) is defined as sub-resource in the response object. You can find the list of supported payment sources and the expected input parameters [here](https://docs.corsair.dev/docs/api/payment_parameters). See [Payment source attributes](https://docs.corsair.dev/docs/api/payment_sources/payment-source-object) for a descriptive list of attributes and payment source types. |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] payment\_source full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   customer_id?: string | null,
>   type?: string | null,
>   reference_id?: string | null,
>   status?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   ip_address?: string | null,
>   issuing_country?: string | null,
>   vault_token?: {
>   } | null,
>   deleted?: boolean | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   card?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     iin?: string | null,
>     last4?: string | null,
>     brand?: string | null,
>     funding_type?: string | null,
>     expiry_month?: number | null,
>     expiry_year?: number | null,
>     billing_addr1?: string | null,
>     billing_addr2?: string | null,
>     billing_city?: string | null,
>     billing_state_code?: string | null,
>     billing_state?: string | null,
>     billing_country?: string | null,
>     billing_zip?: string | null,
>     masked_number?: string | null
>   } | null,
>   bank_account?: {
>     last4?: string | null,
>     name_on_account?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     direct_debit_scheme?: string | null,
>     bank_name?: string | null,
>     mandate_id?: string | null,
>     account_type?: string | null,
>     echeck_type?: string | null,
>     account_holder_type?: string | null,
>     email?: string | null
>   } | null,
>   boleto?: {
>     last4?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   amazon_payment?: {
>     email?: string | null,
>     agreement_id?: string | null
>   } | null,
>   upi?: {
>     vpa?: string | null
>   } | null,
>   paypal?: {
>     email?: string | null,
>     agreement_id?: string | null
>   } | null,
>   venmo?: {
>     user_name?: string | null
>   } | null,
>   klarna_pay_now?: {
>     email?: string | null
>   } | null,
>   mandates?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   network_transaction_reference?: {
>     original_network_transaction_id?: string | null,
>     transaction_link_id?: string | null
>   } | null
> } | null
> ```

***

### delete

`paymentSources.delete`

Delete a payment source. Deletes a payment source. Once the payment source is deleted, if \* Deleted payment source is Primary, and Backup is available \* The Backup payment source will become the Primary payment source.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.paymentSources.delete({ custPaymentSourceId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `custPaymentSourceId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `payment_source` | `object \| null` | No | **Updates** This API obsoletes the [Cards API](https://docs.corsair.dev/docs/api/cards) in Chargebee. Represents the payment source for the customer. Specific types of payment source (Card, Direct Debit, Paypal Express Checkout, etc.) is defined as sub-resource in the response object. You can find the list of supported payment sources and the expected input parameters [here](https://docs.corsair.dev/docs/api/payment_parameters). See [Payment source attributes](https://docs.corsair.dev/docs/api/payment_sources/payment-source-object) for a descriptive list of attributes and payment source types. |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] payment\_source full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   customer_id?: string | null,
>   type?: string | null,
>   reference_id?: string | null,
>   status?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   ip_address?: string | null,
>   issuing_country?: string | null,
>   vault_token?: {
>   } | null,
>   deleted?: boolean | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   card?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     iin?: string | null,
>     last4?: string | null,
>     brand?: string | null,
>     funding_type?: string | null,
>     expiry_month?: number | null,
>     expiry_year?: number | null,
>     billing_addr1?: string | null,
>     billing_addr2?: string | null,
>     billing_city?: string | null,
>     billing_state_code?: string | null,
>     billing_state?: string | null,
>     billing_country?: string | null,
>     billing_zip?: string | null,
>     masked_number?: string | null
>   } | null,
>   bank_account?: {
>     last4?: string | null,
>     name_on_account?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     direct_debit_scheme?: string | null,
>     bank_name?: string | null,
>     mandate_id?: string | null,
>     account_type?: string | null,
>     echeck_type?: string | null,
>     account_holder_type?: string | null,
>     email?: string | null
>   } | null,
>   boleto?: {
>     last4?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   amazon_payment?: {
>     email?: string | null,
>     agreement_id?: string | null
>   } | null,
>   upi?: {
>     vpa?: string | null
>   } | null,
>   paypal?: {
>     email?: string | null,
>     agreement_id?: string | null
>   } | null,
>   venmo?: {
>     user_name?: string | null
>   } | null,
>   klarna_pay_now?: {
>     email?: string | null
>   } | null,
>   mandates?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   network_transaction_reference?: {
>     original_network_transaction_id?: string | null,
>     transaction_link_id?: string | null
>   } | null
> } | null
> ```

***

### deleteLocal

`paymentSources.deleteLocal`

Local delete a payment source. Delete a payment source reference from a Chargebee customer without deleting or altering payment source data stored at the payment gateway. ### Impacts Payment Source Sets deleted = true on the specified payment\_source and detaches it from the customer.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.paymentSources.deleteLocal({ custPaymentSourceId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `custPaymentSourceId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `payment_source` | `object \| null` | No | **Updates** This API obsoletes the [Cards API](https://docs.corsair.dev/docs/api/cards) in Chargebee. Represents the payment source for the customer. Specific types of payment source (Card, Direct Debit, Paypal Express Checkout, etc.) is defined as sub-resource in the response object. You can find the list of supported payment sources and the expected input parameters [here](https://docs.corsair.dev/docs/api/payment_parameters). See [Payment source attributes](https://docs.corsair.dev/docs/api/payment_sources/payment-source-object) for a descriptive list of attributes and payment source types. |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] payment\_source full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   customer_id?: string | null,
>   type?: string | null,
>   reference_id?: string | null,
>   status?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   ip_address?: string | null,
>   issuing_country?: string | null,
>   vault_token?: {
>   } | null,
>   deleted?: boolean | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   card?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     iin?: string | null,
>     last4?: string | null,
>     brand?: string | null,
>     funding_type?: string | null,
>     expiry_month?: number | null,
>     expiry_year?: number | null,
>     billing_addr1?: string | null,
>     billing_addr2?: string | null,
>     billing_city?: string | null,
>     billing_state_code?: string | null,
>     billing_state?: string | null,
>     billing_country?: string | null,
>     billing_zip?: string | null,
>     masked_number?: string | null
>   } | null,
>   bank_account?: {
>     last4?: string | null,
>     name_on_account?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     direct_debit_scheme?: string | null,
>     bank_name?: string | null,
>     mandate_id?: string | null,
>     account_type?: string | null,
>     echeck_type?: string | null,
>     account_holder_type?: string | null,
>     email?: string | null
>   } | null,
>   boleto?: {
>     last4?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   amazon_payment?: {
>     email?: string | null,
>     agreement_id?: string | null
>   } | null,
>   upi?: {
>     vpa?: string | null
>   } | null,
>   paypal?: {
>     email?: string | null,
>     agreement_id?: string | null
>   } | null,
>   venmo?: {
>     user_name?: string | null
>   } | null,
>   klarna_pay_now?: {
>     email?: string | null
>   } | null,
>   mandates?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   network_transaction_reference?: {
>     original_network_transaction_id?: string | null,
>     transaction_link_id?: string | null
>   } | null
> } | null
> ```

***

### export

`paymentSources.export`

Export payment source. Copies this payment source information to the gateway specified in the API. This is useful if you want to port your customer's card details into another gateway. This operation does not support copying of cards from Stripe and Braintree gateways.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.paymentSources.export({ custPaymentSourceId: 'example', gateway_account_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `custPaymentSourceId` | `string` | Yes | — |
| `gateway_account_id` | `string` | Yes | The gateway account you want to copy the card. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `third_party_payment_method` | `object \| null` | No | Used when you want to copy card information between two gateways (such as copying cards between Authorize.Net and Stripe). Will contain details of the payment method type (card, Amazon Payments, etc.), name of the gateway, and the reference ID that the gateway uses to identify the specific card. |

> [accordion] third\_party\_payment\_method full type
>
> ```ts theme={null}
> {
>   type?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   reference_id?: string | null,
>   network_transaction_reference?: {
>   } | null
> } | null
> ```

***

### get

`paymentSources.get`

Retrieve a payment source. Retrieves the payment source identified by the unique identifier.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.paymentSources.get({ custPaymentSourceId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `custPaymentSourceId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `payment_source` | `object \| null` | No | **Updates** This API obsoletes the [Cards API](https://docs.corsair.dev/docs/api/cards) in Chargebee. Represents the payment source for the customer. Specific types of payment source (Card, Direct Debit, Paypal Express Checkout, etc.) is defined as sub-resource in the response object. You can find the list of supported payment sources and the expected input parameters [here](https://docs.corsair.dev/docs/api/payment_parameters). See [Payment source attributes](https://docs.corsair.dev/docs/api/payment_sources/payment-source-object) for a descriptive list of attributes and payment source types. |

> [accordion] payment\_source full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   customer_id?: string | null,
>   type?: string | null,
>   reference_id?: string | null,
>   status?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   ip_address?: string | null,
>   issuing_country?: string | null,
>   vault_token?: {
>   } | null,
>   deleted?: boolean | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   card?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     iin?: string | null,
>     last4?: string | null,
>     brand?: string | null,
>     funding_type?: string | null,
>     expiry_month?: number | null,
>     expiry_year?: number | null,
>     billing_addr1?: string | null,
>     billing_addr2?: string | null,
>     billing_city?: string | null,
>     billing_state_code?: string | null,
>     billing_state?: string | null,
>     billing_country?: string | null,
>     billing_zip?: string | null,
>     masked_number?: string | null
>   } | null,
>   bank_account?: {
>     last4?: string | null,
>     name_on_account?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     direct_debit_scheme?: string | null,
>     bank_name?: string | null,
>     mandate_id?: string | null,
>     account_type?: string | null,
>     echeck_type?: string | null,
>     account_holder_type?: string | null,
>     email?: string | null
>   } | null,
>   boleto?: {
>     last4?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   amazon_payment?: {
>     email?: string | null,
>     agreement_id?: string | null
>   } | null,
>   upi?: {
>     vpa?: string | null
>   } | null,
>   paypal?: {
>     email?: string | null,
>     agreement_id?: string | null
>   } | null,
>   venmo?: {
>     user_name?: string | null
>   } | null,
>   klarna_pay_now?: {
>     email?: string | null
>   } | null,
>   mandates?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   network_transaction_reference?: {
>     original_network_transaction_id?: string | null,
>     transaction_link_id?: string | null
>   } | null
> } | null
> ```

***

### list

`paymentSources.list`

List payment sources. Lists all the payment sources.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.paymentSources.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `subscription_id` | `string` | No | Unique subscription identifier that helps to retrieve the payment source of a subscription which has `mandate` associated to it. |
| `include_deleted` | `boolean` | No | Indicates whether to include deleted objects in the list. The deleted objects have the attribute '`deleted` ' as '`true` '. |
| `customer_id` | `object` | No | optional, string filter To filter based on Customer Id. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *customer\_id\\\[is\\] = "3bdjnDnsdQn"* |
| `type` | `object` | No | optional, enumerated string filter Type of payment source. Possible values are : card, paypal\_express\_checkout, amazon\_payments, direct\_debit, generic, alipay, alipay\_hk, gcash, ovo, momo, mercado\_pago, nequi, nupay, picpay, thai\_qr, blik, fpx, wero, p24, affirm\_pay, rakuten\_pay, dana, touch\_n\_go, tamara, qpay, unionpay, apple\_pay, wechat\_pay, ideal, google\_pay, sofort, bancontact, giropay, dotpay, upi, netbanking\_emandates. **Supported operators :** is, is\_not, in, not\_in **Example →** *type\\\[is\\] = "card"* |
| `status` | `object` | No | optional, enumerated string filter Current status of the payment source. Possible values are : valid, expiring, expired, invalid, pending\_verification. **Supported operators :** is, is\_not, in, not\_in **Example →** *status\\\[is\\] = "valid"* |
| `updated_at` | `object` | No | optional, timestamp(UTC) in seconds filter Timestamp indicating when this payment source resource was last updated. **Supported operators :** after, before, on, between **Example →** *updated\_at\\\[on\\] = "1435054328"* |
| `created_at` | `object` | No | optional, timestamp(UTC) in seconds filter Timestamp indicating when this payment source resource is created. **Supported operators :** after, before, on, between **Example →** *created\_at\\\[on\\] = "1435054328"* |
| `sort_by` | `object` | No | optional, string filter Sorts based on the specified attribute. **Supported attributes :** created\_at, updated\_at **Supported sort-orders :** asc, desc **Example →** *sort\_by\\\[asc\\] = "created\_at"* This will sort the result based on the 'created\_at' attribute in ascending(earliest first) order. |

> [accordion] customer\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] type full type
>
> ```ts theme={null}
> {
>   is?: card | paypal_express_checkout | amazon_payments | direct_debit | generic | alipay | unionpay | apple_pay | wechat_pay | ideal | google_pay | sofort | bancontact | giropay | dotpay | upi | netbanking_emandates | venmo | pay_to | faster_payments | sepa_instant_transfer | automated_bank_transfer | klarna_pay_now | online_banking_poland | payconiq_by_bancontact | electronic_payment_standard | kbc_payment_button | pay_by_bank | trustly | stablecoin | kakao_pay | naver_pay | revolut_pay | cash_app_pay | twint | go_pay | grab_pay | pay_co | after_pay | swish | payme | pix | klarna | alipay_hk | paypay | gcash | south_korean_cards | paynow | bizum | promptpay | dana | touch_n_go | tamara | qpay | ovo | momo | mercado_pago | nequi | nupay | picpay | thai_qr | blik | fpx | wero | p24 | affirm_pay | rakuten_pay,
>   is_not?: card | paypal_express_checkout | amazon_payments | direct_debit | generic | alipay | unionpay | apple_pay | wechat_pay | ideal | google_pay | sofort | bancontact | giropay | dotpay | upi | netbanking_emandates | venmo | pay_to | faster_payments | sepa_instant_transfer | automated_bank_transfer | klarna_pay_now | online_banking_poland | payconiq_by_bancontact | electronic_payment_standard | kbc_payment_button | pay_by_bank | trustly | stablecoin | kakao_pay | naver_pay | revolut_pay | cash_app_pay | twint | go_pay | grab_pay | pay_co | after_pay | swish | payme | pix | klarna | alipay_hk | paypay | gcash | south_korean_cards | paynow | bizum | promptpay | dana | touch_n_go | tamara | qpay | ovo | momo | mercado_pago | nequi | nupay | picpay | thai_qr | blik | fpx | wero | p24 | affirm_pay | rakuten_pay,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] status full type
>
> ```ts theme={null}
> {
>   is?: valid | expiring | expired | invalid | pending_verification,
>   is_not?: valid | expiring | expired | invalid | pending_verification,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] updated\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] created\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] sort\_by full type
>
> ```ts theme={null}
> {
>   asc?: created_at | updated_at,
>   desc?: created_at | updated_at
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   payment_source?: {
>     id?: string | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     created_at?: number | null,
>     customer_id?: string | null,
>     type?: string | null,
>     reference_id?: string | null,
>     status?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     ip_address?: string | null,
>     issuing_country?: string | null,
>     vault_token?: {
>     } | null,
>     deleted?: boolean | null,
>     business_entity_id?: string | null,
>     brand_id?: string | null,
>     card?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       iin?: string | null,
>       last4?: string | null,
>       brand?: string | null,
>       funding_type?: string | null,
>       expiry_month?: number | null,
>       expiry_year?: number | null,
>       billing_addr1?: string | null,
>       billing_addr2?: string | null,
>       billing_city?: string | null,
>       billing_state_code?: string | null,
>       billing_state?: string | null,
>       billing_country?: string | null,
>       billing_zip?: string | null,
>       masked_number?: string | null
>     } | null,
>     bank_account?: {
>       last4?: string | null,
>       name_on_account?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       direct_debit_scheme?: string | null,
>       bank_name?: string | null,
>       mandate_id?: string | null,
>       account_type?: string | null,
>       echeck_type?: string | null,
>       account_holder_type?: string | null,
>       email?: string | null
>     } | null,
>     boleto?: {
>       last4?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null
>     } | null,
>     billing_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     amazon_payment?: {
>       email?: string | null,
>       agreement_id?: string | null
>     } | null,
>     upi?: {
>       vpa?: string | null
>     } | null,
>     paypal?: {
>       email?: string | null,
>       agreement_id?: string | null
>     } | null,
>     venmo?: {
>       user_name?: string | null
>     } | null,
>     klarna_pay_now?: {
>       email?: string | null
>     } | null,
>     mandates?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       created_at?: number | null
>     }[] | null,
>     network_transaction_reference?: {
>       original_network_transaction_id?: string | null,
>       transaction_link_id?: string | null
>     } | null
>   } | null
> }[] | null
> ```

***

### listGatewayPaymentMethodTokens

`paymentSources.listGatewayPaymentMethodTokens`

List Gateway Payment Method Tokens For A Payment Source. Lists gateway payment method token mappings stored for this payment source. A payment source can have multiple gateway tokens when vaulting and backup gateway merchant-initiated transactions (MIT) are enabled.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.paymentSources.listGatewayPaymentMethodTokens({ custPaymentSourceId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `custPaymentSourceId` | `string` | Yes | — |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `include_deleted` | `boolean` | No | Indicates whether to include deleted objects in the list. The deleted objects have the attribute '`deleted`' as '`true`'. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   gateway_payment_method_token?: {
>     id?: string | null,
>     gateway_account_id?: string | null,
>     gateway?: string | null,
>     gateway_customer_id?: string | null,
>     gateway_token?: string | null,
>     status?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null
>   } | null
> }[] | null
> ```

***

### switchGatewayAccount

`paymentSources.switchGatewayAccount`

Switch gateway account. Moves a card payment source from one gateway account to another.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.paymentSources.switchGatewayAccount({ custPaymentSourceId: 'example', gateway_account_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `custPaymentSourceId` | `string` | Yes | — |
| `gateway_account_id` | `string` | Yes | The gateway account you want to switch to. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `payment_source` | `object \| null` | No | **Updates** This API obsoletes the [Cards API](https://docs.corsair.dev/docs/api/cards) in Chargebee. Represents the payment source for the customer. Specific types of payment source (Card, Direct Debit, Paypal Express Checkout, etc.) is defined as sub-resource in the response object. You can find the list of supported payment sources and the expected input parameters [here](https://docs.corsair.dev/docs/api/payment_parameters). See [Payment source attributes](https://docs.corsair.dev/docs/api/payment_sources/payment-source-object) for a descriptive list of attributes and payment source types. |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] payment\_source full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   customer_id?: string | null,
>   type?: string | null,
>   reference_id?: string | null,
>   status?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   ip_address?: string | null,
>   issuing_country?: string | null,
>   vault_token?: {
>   } | null,
>   deleted?: boolean | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   card?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     iin?: string | null,
>     last4?: string | null,
>     brand?: string | null,
>     funding_type?: string | null,
>     expiry_month?: number | null,
>     expiry_year?: number | null,
>     billing_addr1?: string | null,
>     billing_addr2?: string | null,
>     billing_city?: string | null,
>     billing_state_code?: string | null,
>     billing_state?: string | null,
>     billing_country?: string | null,
>     billing_zip?: string | null,
>     masked_number?: string | null
>   } | null,
>   bank_account?: {
>     last4?: string | null,
>     name_on_account?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     direct_debit_scheme?: string | null,
>     bank_name?: string | null,
>     mandate_id?: string | null,
>     account_type?: string | null,
>     echeck_type?: string | null,
>     account_holder_type?: string | null,
>     email?: string | null
>   } | null,
>   boleto?: {
>     last4?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   amazon_payment?: {
>     email?: string | null,
>     agreement_id?: string | null
>   } | null,
>   upi?: {
>     vpa?: string | null
>   } | null,
>   paypal?: {
>     email?: string | null,
>     agreement_id?: string | null
>   } | null,
>   venmo?: {
>     user_name?: string | null
>   } | null,
>   klarna_pay_now?: {
>     email?: string | null
>   } | null,
>   mandates?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   network_transaction_reference?: {
>     original_network_transaction_id?: string | null,
>     transaction_link_id?: string | null
>   } | null
> } | null
> ```

***

### updateBankAccount

`paymentSources.updateBankAccount`

Update a bank account payment source. This API is used to update the payment source details of a customer. Information related to bank account payment source such as email, first name, and last name can be updated. \* For GoCardless, Chargebee supports (ACH,BACS,SEPA,AUTOGIRO,BECS,BECS\_NZ,PAD).

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.paymentSources.updateBankAccount({ custPaymentSourceId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `custPaymentSourceId` | `string` | Yes | — |
| `bank_account` | `object` | No | Parameters for bank\_account |

> [accordion] bank\_account full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `payment_source` | `object \| null` | No | **Updates** This API obsoletes the [Cards API](https://docs.corsair.dev/docs/api/cards) in Chargebee. Represents the payment source for the customer. Specific types of payment source (Card, Direct Debit, Paypal Express Checkout, etc.) is defined as sub-resource in the response object. You can find the list of supported payment sources and the expected input parameters [here](https://docs.corsair.dev/docs/api/payment_parameters). See [Payment source attributes](https://docs.corsair.dev/docs/api/payment_sources/payment-source-object) for a descriptive list of attributes and payment source types. |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] payment\_source full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   customer_id?: string | null,
>   type?: string | null,
>   reference_id?: string | null,
>   status?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   ip_address?: string | null,
>   issuing_country?: string | null,
>   vault_token?: {
>   } | null,
>   deleted?: boolean | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   card?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     iin?: string | null,
>     last4?: string | null,
>     brand?: string | null,
>     funding_type?: string | null,
>     expiry_month?: number | null,
>     expiry_year?: number | null,
>     billing_addr1?: string | null,
>     billing_addr2?: string | null,
>     billing_city?: string | null,
>     billing_state_code?: string | null,
>     billing_state?: string | null,
>     billing_country?: string | null,
>     billing_zip?: string | null,
>     masked_number?: string | null
>   } | null,
>   bank_account?: {
>     last4?: string | null,
>     name_on_account?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     direct_debit_scheme?: string | null,
>     bank_name?: string | null,
>     mandate_id?: string | null,
>     account_type?: string | null,
>     echeck_type?: string | null,
>     account_holder_type?: string | null,
>     email?: string | null
>   } | null,
>   boleto?: {
>     last4?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   amazon_payment?: {
>     email?: string | null,
>     agreement_id?: string | null
>   } | null,
>   upi?: {
>     vpa?: string | null
>   } | null,
>   paypal?: {
>     email?: string | null,
>     agreement_id?: string | null
>   } | null,
>   venmo?: {
>     user_name?: string | null
>   } | null,
>   klarna_pay_now?: {
>     email?: string | null
>   } | null,
>   mandates?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   network_transaction_reference?: {
>     original_network_transaction_id?: string | null,
>     transaction_link_id?: string | null
>   } | null
> } | null
> ```

***

### updateCard

`paymentSources.updateCard`

Update a card payment source. Merchants look to update card details when: \* The billing address of a customer has changed. In such a case, modify the billing address in the Chargebee and the payment gateway. \* The expiration date of the card has been extended by the bank.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.paymentSources.updateCard({ custPaymentSourceId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `custPaymentSourceId` | `string` | Yes | — |
| `gateway_meta_data` | `object` | No | Additional data about this resource can be passed to **Stripe** gateway here in the JSON Format. This will be stored along with payment source at the gateway account. |
| `reference_transaction` | `string` | No | Reference transaction is used for future purchases. This is only applicable for Vantiv. |
| `card` | `object` | No | Parameters for card |
| `network_transaction_reference` | `object` | No | Updates the original network transaction identifier stored on this payment source. Pass `network_transaction_reference[original_network_transaction_id]`. When sent with other card fields, Chargebee calls the gateway first and persists the identifier only after a successful update. When this is the only parameter in the request, Chargebee updates it locally with no gateway call. The updated value is returned on the payment source as `network_transaction_reference`. |

> [accordion] gateway\_meta\_data full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] card full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   expiry_month?: number,
>   expiry_year?: number,
>   billing_addr1?: string,
>   billing_addr2?: string,
>   billing_city?: string,
>   billing_zip?: string,
>   billing_state_code?: string,
>   billing_state?: string,
>   billing_country?: string,
>   additional_information?: {
>   }
> }
> ```

> [accordion] network\_transaction\_reference full type
>
> ```ts theme={null}
> {
>   original_network_transaction_id?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `payment_source` | `object \| null` | No | **Updates** This API obsoletes the [Cards API](https://docs.corsair.dev/docs/api/cards) in Chargebee. Represents the payment source for the customer. Specific types of payment source (Card, Direct Debit, Paypal Express Checkout, etc.) is defined as sub-resource in the response object. You can find the list of supported payment sources and the expected input parameters [here](https://docs.corsair.dev/docs/api/payment_parameters). See [Payment source attributes](https://docs.corsair.dev/docs/api/payment_sources/payment-source-object) for a descriptive list of attributes and payment source types. |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] payment\_source full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   customer_id?: string | null,
>   type?: string | null,
>   reference_id?: string | null,
>   status?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   ip_address?: string | null,
>   issuing_country?: string | null,
>   vault_token?: {
>   } | null,
>   deleted?: boolean | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   card?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     iin?: string | null,
>     last4?: string | null,
>     brand?: string | null,
>     funding_type?: string | null,
>     expiry_month?: number | null,
>     expiry_year?: number | null,
>     billing_addr1?: string | null,
>     billing_addr2?: string | null,
>     billing_city?: string | null,
>     billing_state_code?: string | null,
>     billing_state?: string | null,
>     billing_country?: string | null,
>     billing_zip?: string | null,
>     masked_number?: string | null
>   } | null,
>   bank_account?: {
>     last4?: string | null,
>     name_on_account?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     direct_debit_scheme?: string | null,
>     bank_name?: string | null,
>     mandate_id?: string | null,
>     account_type?: string | null,
>     echeck_type?: string | null,
>     account_holder_type?: string | null,
>     email?: string | null
>   } | null,
>   boleto?: {
>     last4?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   amazon_payment?: {
>     email?: string | null,
>     agreement_id?: string | null
>   } | null,
>   upi?: {
>     vpa?: string | null
>   } | null,
>   paypal?: {
>     email?: string | null,
>     agreement_id?: string | null
>   } | null,
>   venmo?: {
>     user_name?: string | null
>   } | null,
>   klarna_pay_now?: {
>     email?: string | null
>   } | null,
>   mandates?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   network_transaction_reference?: {
>     original_network_transaction_id?: string | null,
>     transaction_link_id?: string | null
>   } | null
> } | null
> ```

***

### verifyBankAccount

`paymentSources.verifyBankAccount`

Verify bank account payment source. This API can be used to verify bank accounts which have been added as payment source. This is applicable for Stripe ACH with micro-deposit mode bank accounts only. Stripe handles verification in two ways - via Plaid, and micro-deposit.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.paymentSources.verifyBankAccount({ custPaymentSourceId: 'example', amount1: 1, amount2: 1 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `custPaymentSourceId` | `string` | Yes | — |
| `amount1` | `number` | Yes | Value of the micro-deposits sent to the bank account. |
| `amount2` | `number` | Yes | Value of the micro-deposits sent to the bank account. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `payment_source` | `object \| null` | No | **Updates** This API obsoletes the [Cards API](https://docs.corsair.dev/docs/api/cards) in Chargebee. Represents the payment source for the customer. Specific types of payment source (Card, Direct Debit, Paypal Express Checkout, etc.) is defined as sub-resource in the response object. You can find the list of supported payment sources and the expected input parameters [here](https://docs.corsair.dev/docs/api/payment_parameters). See [Payment source attributes](https://docs.corsair.dev/docs/api/payment_sources/payment-source-object) for a descriptive list of attributes and payment source types. |

> [accordion] payment\_source full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   created_at?: number | null,
>   customer_id?: string | null,
>   type?: string | null,
>   reference_id?: string | null,
>   status?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   ip_address?: string | null,
>   issuing_country?: string | null,
>   vault_token?: {
>   } | null,
>   deleted?: boolean | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   card?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     iin?: string | null,
>     last4?: string | null,
>     brand?: string | null,
>     funding_type?: string | null,
>     expiry_month?: number | null,
>     expiry_year?: number | null,
>     billing_addr1?: string | null,
>     billing_addr2?: string | null,
>     billing_city?: string | null,
>     billing_state_code?: string | null,
>     billing_state?: string | null,
>     billing_country?: string | null,
>     billing_zip?: string | null,
>     masked_number?: string | null
>   } | null,
>   bank_account?: {
>     last4?: string | null,
>     name_on_account?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     direct_debit_scheme?: string | null,
>     bank_name?: string | null,
>     mandate_id?: string | null,
>     account_type?: string | null,
>     echeck_type?: string | null,
>     account_holder_type?: string | null,
>     email?: string | null
>   } | null,
>   boleto?: {
>     last4?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   amazon_payment?: {
>     email?: string | null,
>     agreement_id?: string | null
>   } | null,
>   upi?: {
>     vpa?: string | null
>   } | null,
>   paypal?: {
>     email?: string | null,
>     agreement_id?: string | null
>   } | null,
>   venmo?: {
>     user_name?: string | null
>   } | null,
>   klarna_pay_now?: {
>     email?: string | null
>   } | null,
>   mandates?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   network_transaction_reference?: {
>     original_network_transaction_id?: string | null,
>     transaction_link_id?: string | null
>   } | null
> } | null
> ```

***

## Payment Vouchers

### create

`paymentVouchers.create`

Create a voucher for the customer to initiate payment. Creates a voucher type payment source. If you create this voucher type payment source using customer details, like tax ID, you can then generate a voucher with that payment source.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.paymentVouchers.create({ customer_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customer_id` | `string` | Yes | The unique identifier of the customer for whom you want to create the voucher. |
| `payment_source_id` | `string` | No | The identifier of the payment source used for generating the voucher. |
| `voucher_payment_source` | `object` | No | Parameters for voucher\_payment\_source |
| `invoice_allocations` | `object` | No | Parameters for `invoice_allocations` |

> [accordion] voucher\_payment\_source full type
>
> ```ts theme={null}
> {
>   voucher_type: boleto
> }
> ```

> [accordion] invoice\_allocations full type
>
> ```ts theme={null}
> {
>   invoice_id: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `payment_voucher` | `object \| null` | No | The Payment Voucher resource represents a voucher that has been created for a customer to initiate voucher-based payment. This resource contains relevant details such as the voucher URL, the amount of the voucher, the status of the voucher, and more. Currently, the only supported voucher-based payment source is Boleto. Boleto is a payment method in Brazil that is regulated by the Central Bank of Brazil and is considered an official form of payment. This is also a popular voucher-based payment method in Brazil. **Note:** This resource can be extended in the future to support other types of payment sources for vouchers. |

> [accordion] payment\_voucher full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   id_at_gateway?: string | null,
>   payment_voucher_type?: string | null,
>   expires_at?: number | null,
>   status?: string | null,
>   subscription_id?: string | null,
>   currency_code?: string | null,
>   amount?: number | null,
>   gateway_account_id?: string | null,
>   payment_source_id?: string | null,
>   gateway?: string | null,
>   payload?: string | null,
>   error_code?: string | null,
>   error_text?: string | null,
>   url?: string | null,
>   date?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   customer_id?: string | null,
>   linked_invoices?: {
>     invoice_id?: string | null,
>     txn_id?: string | null,
>     applied_at?: number | null
>   }[] | null
> } | null
> ```

***

### get

`paymentVouchers.get`

Retrieve voucher data. Retrieves a voucher using the unique payment\_voucher\_id .

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.paymentVouchers.get({ paymentVoucherId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `paymentVoucherId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `payment_voucher` | `object \| null` | No | The Payment Voucher resource represents a voucher that has been created for a customer to initiate voucher-based payment. This resource contains relevant details such as the voucher URL, the amount of the voucher, the status of the voucher, and more. Currently, the only supported voucher-based payment source is Boleto. Boleto is a payment method in Brazil that is regulated by the Central Bank of Brazil and is considered an official form of payment. This is also a popular voucher-based payment method in Brazil. **Note:** This resource can be extended in the future to support other types of payment sources for vouchers. |

> [accordion] payment\_voucher full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   id_at_gateway?: string | null,
>   payment_voucher_type?: string | null,
>   expires_at?: number | null,
>   status?: string | null,
>   subscription_id?: string | null,
>   currency_code?: string | null,
>   amount?: number | null,
>   gateway_account_id?: string | null,
>   payment_source_id?: string | null,
>   gateway?: string | null,
>   payload?: string | null,
>   error_code?: string | null,
>   error_text?: string | null,
>   url?: string | null,
>   date?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   customer_id?: string | null,
>   linked_invoices?: {
>     invoice_id?: string | null,
>     txn_id?: string | null,
>     applied_at?: number | null
>   }[] | null
> } | null
> ```

***

## Pc2Migration Item Families

### create

`pc2MigrationItemFamilies.create`

Create a pc2\_migration\_item\_family. (POST /pc2\_migration\_item\_families)

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.pc2MigrationItemFamilies.create({ id: 'cust_8gsnbYfsMLds', name: 'example', pc2_migration_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `name` | `string` | Yes | — |
| `id` | `string` | Yes | — |
| `description` | `string` | No | — |
| `is_default` | `boolean` | No | — |
| `pc2_migration_id` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `pc2_migration_item_family` | `object \| null` | No | — |

> [accordion] pc2\_migration\_item\_family full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   pc2_migration_id?: string | null,
>   description?: string | null,
>   is_default?: boolean | null,
>   metadata?: string | null,
>   status?: string | null,
>   created_at?: number | null
> } | null
> ```

***

### delete

`pc2MigrationItemFamilies.delete`

Delete draft family. (POST /pc2\_migration\_item\_families/\{pc2-migration-item-family-id}/delete)

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.pc2MigrationItemFamilies.delete({ pc2MigrationItemFamilyId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `pc2MigrationItemFamilyId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `is_deleted` | `boolean \| null` | No | — |

***

### get

`pc2MigrationItemFamilies.get`

Retrieve a pc2 migration item family. (GET /pc2\_migration\_item\_families/\{pc2-migration-item-family-id})

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.pc2MigrationItemFamilies.get({ pc2MigrationItemFamilyId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `pc2MigrationItemFamilyId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `pc2_migration_item_family` | `object \| null` | No | — |

> [accordion] pc2\_migration\_item\_family full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   pc2_migration_id?: string | null,
>   description?: string | null,
>   is_default?: boolean | null,
>   metadata?: string | null,
>   status?: string | null,
>   created_at?: number | null
> } | null
> ```

***

### list

`pc2MigrationItemFamilies.list`

List pc2 migration item families. (GET /pc2\_migration\_item\_families)

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.pc2MigrationItemFamilies.list({
	pc2_migration_id: {},
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set 'offset' to the value of 'next\_offset' obtained in the previous iteration of the API call. |
| `pc2_migration_id` | `object` | Yes | pc2\_migration reference key |

> [accordion] pc2\_migration\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   pc2_migration_item_family?: {
>     id?: string | null,
>     name?: string | null,
>     pc2_migration_id?: string | null,
>     description?: string | null,
>     is_default?: boolean | null,
>     metadata?: string | null,
>     status?: string | null,
>     created_at?: number | null
>   } | null
> }[] | null
> ```

***

### update

`pc2MigrationItemFamilies.update`

Update a pc2\_migration\_item\_family. (POST /pc2\_migration\_item\_families/\{pc2-migration-item-family-id})

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.pc2MigrationItemFamilies.update({ pc2MigrationItemFamilyId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `pc2MigrationItemFamilyId` | `string` | Yes | — |
| `name` | `string` | No | — |
| `id` | `string` | No | — |
| `is_default` | `boolean` | No | — |
| `description` | `string` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `pc2_migration_item_family` | `object \| null` | No | — |

> [accordion] pc2\_migration\_item\_family full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   pc2_migration_id?: string | null,
>   description?: string | null,
>   is_default?: boolean | null,
>   metadata?: string | null,
>   status?: string | null,
>   created_at?: number | null
> } | null
> ```

***

## Pc2Migration Item Prices

### delete

`pc2MigrationItemPrices.delete`

Delete draft item price. (POST /pc2\_migration\_item\_prices/\{pc2-migration-item-price-id}/delete)

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.pc2MigrationItemPrices.delete({ pc2MigrationItemPriceId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `pc2MigrationItemPriceId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `is_deleted` | `boolean \| null` | No | — |

***

### get

`pc2MigrationItemPrices.get`

Retrieve a pc2 migration item price. (GET /pc2\_migration\_item\_prices/\{pc2-migration-item-price-id})

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.pc2MigrationItemPrices.get({ pc2MigrationItemPriceId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `pc2MigrationItemPriceId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `pc2_migration_item_price` | `object \| null` | No | — |

> [accordion] pc2\_migration\_item\_price full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   pc2_migration_id?: string | null,
>   pc2_migration_item_id?: string | null,
>   ref_entity_id?: string | null,
>   pc1_item_type?: string | null,
>   is_recurring?: boolean | null,
>   is_primary_attached_item?: boolean | null,
>   currency_code?: string | null,
>   period?: number | null,
>   period_unit?: string | null,
>   is_invalid_pc1_id?: boolean | null,
>   sanitized_pc1_id?: string | null,
>   description?: string | null,
>   metadata?: string | null,
>   status?: string | null,
>   created_at?: number | null
> } | null
> ```

***

### list

`pc2MigrationItemPrices.list`

List pc2 migration item prices. (GET /pc2\_migration\_item\_prices)

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.pc2MigrationItemPrices.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set 'offset' to the value of 'next\_offset' obtained in the previous iteration of the API call. |
| `pc2_migration_id` | `object` | No | pc2\_migration reference key |
| `pc2_migration_item_id` | `object` | No | item reference key |
| `is_invalid_pc1_id` | `object` | No | check if pc1 autocorrection required |
| `pc1_item_type` | `object` | No | — |
| `is_recurring` | `object` | No | — |

> [accordion] pc2\_migration\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string
> }
> ```

> [accordion] pc2\_migration\_item\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string
> }
> ```

> [accordion] is\_invalid\_pc1\_id full type
>
> ```ts theme={null}
> {
>   is?: true | false
> }
> ```

> [accordion] pc1\_item\_type full type
>
> ```ts theme={null}
> {
>   is?: plan | addon,
>   is_not?: plan | addon,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] is\_recurring full type
>
> ```ts theme={null}
> {
>   is?: true | false
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   pc2_migration_item_price?: {
>     id?: string | null,
>     name?: string | null,
>     pc2_migration_id?: string | null,
>     pc2_migration_item_id?: string | null,
>     ref_entity_id?: string | null,
>     pc1_item_type?: string | null,
>     is_recurring?: boolean | null,
>     is_primary_attached_item?: boolean | null,
>     currency_code?: string | null,
>     period?: number | null,
>     period_unit?: string | null,
>     is_invalid_pc1_id?: boolean | null,
>     sanitized_pc1_id?: string | null,
>     description?: string | null,
>     metadata?: string | null,
>     status?: string | null,
>     created_at?: number | null
>   } | null
> }[] | null
> ```

***

### update

`pc2MigrationItemPrices.update`

Update a pc2\_migration\_item\_price. (POST /pc2\_migration\_item\_prices/\{pc2-migration-item-price-id})

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.pc2MigrationItemPrices.update({ pc2MigrationItemPriceId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `pc2MigrationItemPriceId` | `string` | Yes | — |
| `name` | `string` | No | — |
| `pc2_migration_item_id` | `string` | No | — |
| `description` | `string` | No | — |
| `metadata` | `string` | No | — |
| `sanitized_pc1_id` | `string` | No | — |
| `is_primary_attached_item` | `boolean` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `pc2_migration_item_price` | `object \| null` | No | — |

> [accordion] pc2\_migration\_item\_price full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   pc2_migration_id?: string | null,
>   pc2_migration_item_id?: string | null,
>   ref_entity_id?: string | null,
>   pc1_item_type?: string | null,
>   is_recurring?: boolean | null,
>   is_primary_attached_item?: boolean | null,
>   currency_code?: string | null,
>   period?: number | null,
>   period_unit?: string | null,
>   is_invalid_pc1_id?: boolean | null,
>   sanitized_pc1_id?: string | null,
>   description?: string | null,
>   metadata?: string | null,
>   status?: string | null,
>   created_at?: number | null
> } | null
> ```

***

## Pc2Migration Items

### create

`pc2MigrationItems.create`

Create a pc2\_migration\_item. (POST /pc2\_migration\_items)

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.pc2MigrationItems.create({
	id: 'cust_8gsnbYfsMLds',
	name: 'example',
	pc1_type: 'plan',
	pc2_migration_id: 'example',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `id` | `string` | Yes | — |
| `name` | `string` | Yes | — |
| `pc1_type` | `plan \| addon` | Yes | — |
| `pc2_migration_item_family_id` | `string` | No | — |
| `pc2_migration_id` | `string` | Yes | — |
| `description` | `string` | No | — |
| `metadata` | `string` | No | — |
| `is_giftable` | `boolean` | No | — |
| `is_shippable` | `boolean` | No | — |
| `enabled_for_checkout` | `boolean` | No | — |
| `enabled_in_portal` | `boolean` | No | — |
| `redirect_url` | `string` | No | — |
| `is_recurring` | `boolean` | No | — |
| `gift_claim_redirect_url` | `string` | No | — |
| `included_in_mrr` | `boolean` | No | — |
| `unit` | `string` | No | — |
| `pc2_migration_item_prices` | `object` | No | — |

> [accordion] pc2\_migration\_item\_prices full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   name: string[],
>   description?: string[],
>   metadata?: string[],
>   ref_entity_id: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `pc2_migration_item` | `object \| null` | No | — |

> [accordion] pc2\_migration\_item full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   pc2_migration_id?: string | null,
>   pc2_migration_item_family_id?: string | null,
>   pc1_type?: string | null,
>   is_recurring?: boolean | null,
>   is_shippable?: boolean | null,
>   is_giftable?: boolean | null,
>   redirect_url?: string | null,
>   enabled_for_checkout?: boolean | null,
>   enabled_in_portal?: boolean | null,
>   gift_claim_redirect_url?: string | null,
>   unit?: string | null,
>   included_in_mrr?: boolean | null,
>   description?: string | null,
>   metadata?: string | null,
>   status?: string | null,
>   created_at?: number | null
> } | null
> ```

***

### delete

`pc2MigrationItems.delete`

Delete draft item. (POST /pc2\_migration\_items/\{pc2-migration-item-id}/delete)

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.pc2MigrationItems.delete({ pc2MigrationItemId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `pc2MigrationItemId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `is_deleted` | `boolean \| null` | No | — |

***

### get

`pc2MigrationItems.get`

Retrieve a pc2 migration item. (GET /pc2\_migration\_items/\{pc2-migration-item-id})

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.pc2MigrationItems.get({ pc2MigrationItemId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `pc2MigrationItemId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `pc2_migration_item` | `object \| null` | No | — |

> [accordion] pc2\_migration\_item full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   pc2_migration_id?: string | null,
>   pc2_migration_item_family_id?: string | null,
>   pc1_type?: string | null,
>   is_recurring?: boolean | null,
>   is_shippable?: boolean | null,
>   is_giftable?: boolean | null,
>   redirect_url?: string | null,
>   enabled_for_checkout?: boolean | null,
>   enabled_in_portal?: boolean | null,
>   gift_claim_redirect_url?: string | null,
>   unit?: string | null,
>   included_in_mrr?: boolean | null,
>   description?: string | null,
>   metadata?: string | null,
>   status?: string | null,
>   created_at?: number | null
> } | null
> ```

***

### list

`pc2MigrationItems.list`

List pc2 migration items. (GET /pc2\_migration\_items)

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.pc2MigrationItems.list({
	pc2_migration_item_family: {},
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set 'offset' to the value of 'next\_offset' obtained in the previous iteration of the API call. |
| `pc2_migration_item_family` | `object` | Yes | Parameters for pc2\_migration\_item\_family |

> [accordion] pc2\_migration\_item\_family full type
>
> ```ts theme={null}
> {
>   pc2_migration_id?: {
>     is?: string,
>     is_not?: string,
>     starts_with?: string
>   }
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   pc2_migration_item?: {
>     id?: string | null,
>     name?: string | null,
>     pc2_migration_id?: string | null,
>     pc2_migration_item_family_id?: string | null,
>     pc1_type?: string | null,
>     is_recurring?: boolean | null,
>     is_shippable?: boolean | null,
>     is_giftable?: boolean | null,
>     redirect_url?: string | null,
>     enabled_for_checkout?: boolean | null,
>     enabled_in_portal?: boolean | null,
>     gift_claim_redirect_url?: string | null,
>     unit?: string | null,
>     included_in_mrr?: boolean | null,
>     description?: string | null,
>     metadata?: string | null,
>     status?: string | null,
>     created_at?: number | null
>   } | null
> }[] | null
> ```

***

### listApplicableItems

`pc2MigrationItems.listApplicableItems`

Applicable\_items a pc2\_migration\_item. (GET /pc2\_migration\_items/applicable\_items)

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.pc2MigrationItems.listApplicableItems({
	is_recurring: {},
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set 'offset' to the value of 'next\_offset' obtained in the previous iteration of the API call. |
| `is_recurring` | `object` | Yes | — |

> [accordion] is\_recurring full type
>
> ```ts theme={null}
> {
>   is?: true | false
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   pc2_migration_applicable_item?: {
>     pc1_plan_code?: string | null,
>     pc1_plan_name?: string | null,
>     pc1_addon_code?: string | null,
>     pc2_addon_name?: string | null,
>     pc2_plan_name?: string | null,
>     pc2_plan_code?: string | null,
>     event_type?: string | null
>   } | null
> }[] | null
> ```

***

### update

`pc2MigrationItems.update`

Update a pc2\_migration\_item. (POST /pc2\_migration\_items/\{pc2-migration-item-id})

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.pc2MigrationItems.update({ pc2MigrationItemId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `pc2MigrationItemId` | `string` | Yes | — |
| `name` | `string` | No | — |
| `id` | `string` | No | — |
| `pc2_migration_item_family_id` | `string` | No | — |
| `description` | `string` | No | — |
| `metadata` | `string` | No | — |
| `is_giftable` | `boolean` | No | — |
| `is_shippable` | `boolean` | No | — |
| `enabled_for_checkout` | `boolean` | No | — |
| `enabled_in_portal` | `boolean` | No | — |
| `redirect_url` | `string` | No | — |
| `is_recurring` | `boolean` | No | — |
| `gift_claim_redirect_url` | `string` | No | — |
| `included_in_mrr` | `boolean` | No | — |
| `unit` | `string` | No | — |
| `pc2_migration_item_prices` | `object` | No | — |

> [accordion] pc2\_migration\_item\_prices full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   name: string[],
>   description?: string[],
>   metadata?: string[],
>   ref_entity_id: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `pc2_migration_item` | `object \| null` | No | — |

> [accordion] pc2\_migration\_item full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   pc2_migration_id?: string | null,
>   pc2_migration_item_family_id?: string | null,
>   pc1_type?: string | null,
>   is_recurring?: boolean | null,
>   is_shippable?: boolean | null,
>   is_giftable?: boolean | null,
>   redirect_url?: string | null,
>   enabled_for_checkout?: boolean | null,
>   enabled_in_portal?: boolean | null,
>   gift_claim_redirect_url?: string | null,
>   unit?: string | null,
>   included_in_mrr?: boolean | null,
>   description?: string | null,
>   metadata?: string | null,
>   status?: string | null,
>   created_at?: number | null
> } | null
> ```

***

## Pc2Migrations

### contactSupport

`pc2Migrations.contactSupport`

Contact\_support a pc2\_migration. (POST /pc2\_migrations/\{pc2-migration-id}/contact\_support)

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.pc2Migrations.contactSupport({ pc2MigrationId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `pc2MigrationId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `pc2_migration` | `object \| null` | No | — |

> [accordion] pc2\_migration full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   status?: string | null,
>   current_action?: string | null,
>   status_details?: string | null,
>   error_details?: string | null,
>   api_hit_count?: number | null,
>   is_internal_migration?: boolean | null,
>   is_id_processor_applicable?: boolean | null,
>   is_attached_item_processor_applicable?: boolean | null,
>   started_by?: string | null,
>   data_transfer_started_by?: string | null,
>   migration_completed_by?: string | null,
>   started_at?: number | null,
>   data_transfer_completed_at?: number | null,
>   migration_completed_at?: number | null
> } | null
> ```

***

### create

`pc2Migrations.create`

Create a pc2\_migration. (POST /pc2\_migrations)

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.pc2Migrations.create({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `pc2_migration` | `object \| null` | No | — |

> [accordion] pc2\_migration full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   status?: string | null,
>   current_action?: string | null,
>   status_details?: string | null,
>   error_details?: string | null,
>   api_hit_count?: number | null,
>   is_internal_migration?: boolean | null,
>   is_id_processor_applicable?: boolean | null,
>   is_attached_item_processor_applicable?: boolean | null,
>   started_by?: string | null,
>   data_transfer_started_by?: string | null,
>   migration_completed_by?: string | null,
>   started_at?: number | null,
>   data_transfer_completed_at?: number | null,
>   migration_completed_at?: number | null
> } | null
> ```

***

### get

`pc2Migrations.get`

Retrieve a pc2 migration. (GET /pc2\_migrations/\{pc2-migration-id})

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.pc2Migrations.get({ pc2MigrationId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `pc2MigrationId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `pc2_migration` | `object \| null` | No | — |

> [accordion] pc2\_migration full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   status?: string | null,
>   current_action?: string | null,
>   status_details?: string | null,
>   error_details?: string | null,
>   api_hit_count?: number | null,
>   is_internal_migration?: boolean | null,
>   is_id_processor_applicable?: boolean | null,
>   is_attached_item_processor_applicable?: boolean | null,
>   started_by?: string | null,
>   data_transfer_started_by?: string | null,
>   migration_completed_by?: string | null,
>   started_at?: number | null,
>   data_transfer_completed_at?: number | null,
>   migration_completed_at?: number | null
> } | null
> ```

***

### initiate

`pc2Migrations.initiate`

Initiate a pc2\_migration. (POST /pc2\_migrations/\{pc2-migration-id}/initiate)

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.pc2Migrations.initiate({ pc2MigrationId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `pc2MigrationId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `pc2_migration` | `object \| null` | No | — |

> [accordion] pc2\_migration full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   status?: string | null,
>   current_action?: string | null,
>   status_details?: string | null,
>   error_details?: string | null,
>   api_hit_count?: number | null,
>   is_internal_migration?: boolean | null,
>   is_id_processor_applicable?: boolean | null,
>   is_attached_item_processor_applicable?: boolean | null,
>   started_by?: string | null,
>   data_transfer_started_by?: string | null,
>   migration_completed_by?: string | null,
>   started_at?: number | null,
>   data_transfer_completed_at?: number | null,
>   migration_completed_at?: number | null
> } | null
> ```

***

## Personalized Offers

### create

`personalizedOffers.create`

List personalized offers. This API is used to retrieve a list of personalized offer(s) for a customer based on the context (such as customer or subscription details and end-user attributes). This allows you to retrieve any active offers targeted to the user.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.personalizedOffers.create({ customer_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `first_name` | `string` | No | First name of the customer. **Note** This parameter is ignored if it is not mapped to any field in the [settings](https://www.chargebee.com/docs/retention/chargebee-billing-integration.html#syncing-and-mapping-chargebee-fields-into-chargebee-retention). |
| `last_name` | `string` | No | Last name of the customer. **Note** This parameter is ignored if it is not mapped to any field in the [settings](https://www.chargebee.com/docs/retention/chargebee-billing-integration.html#syncing-and-mapping-chargebee-fields-into-chargebee-retention). |
| `email` | `string` | No | Customer's email address. **Note** This parameter is ignored if it is not mapped to any field in the [settings](https://www.chargebee.com/docs/retention/chargebee-billing-integration.html#syncing-and-mapping-chargebee-fields-into-chargebee-retention). |
| `roles` | `string[]` | No | Roles or user types associated with the end user. (Useful in offer targeting for B2B scenarios with multiple user roles.). **Note** This parameter is ignored if it is not mapped to any field in the [settings](https://www.chargebee.com/docs/retention/chargebee-billing-integration.html#syncing-and-mapping-chargebee-fields-into-chargebee-retention). |
| `external_user_id` | `string` | No | The unique identifier of the user in the your system. This is used to identify the user for whom the offer is being created. **Note** This parameter is ignored if it is not mapped to any field in the [settings](https://www.chargebee.com/docs/retention/chargebee-billing-integration.html#syncing-and-mapping-chargebee-fields-into-chargebee-retention). |
| `subscription_id` | `string` | No | The unique identifier of the subscription for which the offer should be retrieved. **Notes:** \* **Required** if multiple brands are configured in your Growth application. \* **Recommended** to always provide. \* If omitted and the customer has multiple subscriptions, the system attempts to retrieve the offer associated with one of their subscriptions. |
| `customer_id` | `string` | Yes | The ID of the customer in the billing system (Chargebee customer ID). |
| `custom` | `object` | No | JSON object of custom attributes (key-value pairs) used for offer targeting or content. [Configure](https://www.chargebee.com/docs/retention/settings-and-installation/chargebee-retention-field-mappings) custom attributes in the dashboard. **Note** This parameter is ignored if it is not mapped to any field in the [settings](https://www.chargebee.com/docs/retention/chargebee-billing-integration.html#syncing-and-mapping-chargebee-fields-into-chargebee-retention). |
| `request_context` | `object` | No | A JSON object with standard context attributes (browser, device, locale, etc.) of the end user's session. This can help in offer targeting based on user environment. |

> [accordion] custom full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] request\_context full type
>
> ```ts theme={null}
> {
>   user_agent?: string,
>   locale?: string,
>   timezone?: string,
>   url?: string,
>   referrer_url?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `personalized_offers` | `object[] \| null` | No | List of best offers to be shown to the customer. Currently this will always return one personalized offer. This will be empty if no best offers are found. |
| `brand` | `object \| null` | No | The brand to which this offer belongs, including its unique id and human-readable name |
| `expires_at` | `number \| null` | No | The timestamp until which the offer remains active. After this time, you must retrieve the offer again via the List Personalised Offers API to get the latest. |

> [accordion] personalized\_offers full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   offer_id?: string | null,
>   content?: {
>     title?: string | null,
>     description?: string | null
>   } | null,
>   options?: {
>     id?: string | null,
>     label?: string | null,
>     processing_type?: string | null,
>     processing_layout?: string | null,
>     redirect_url?: string | null
>   }[] | null
> }[] | null
> ```

> [accordion] brand full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null
> } | null
> ```

***

## Plans

### copy

`plans.copy`

Copy a plan. Creates a plan in this site by copying its configurations from another site. Copying of archived plans is not supported. Note: The attribute *tax\_profile\_id* is not copied. In effect, if the plan is taxable, it will be mapped to the *Primary* tax profile. Product Catalog 1.0 sites only.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.plans.copy({ from_site: 'example', id_at_from_site: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `from_site` | `string` | Yes | Your Chargebee site name having the plan to be copied. **Note:** Unless you are copying from a twin site (acme \\& acme-test are twin sites), [contact 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 have this allow-listed. |
| `id_at_from_site` | `string` | Yes | Id of the plan to be copied. The new plan created in this site will have the same Id. |
| `id` | `string` | No | Id of copied plan in this site. |
| `for_site_merging` | `boolean` | No | If copy action is performed as part of Chargebee site merge action, pass the value as true. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `plan` | `object \| null` | No | Specifies the price with billing frequency for a subscription. Create separate plans for varied price or billing frequency. For example, if you need to charge $10 per month for a group of customers and $100 per year for another group of customers, then create separate plans for each. |

> [accordion] plan full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   invoice_name?: string | null,
>   description?: string | null,
>   price?: number | null,
>   currency_code?: string | null,
>   period?: number | null,
>   period_unit?: string | null,
>   trial_period?: number | null,
>   trial_period_unit?: string | null,
>   trial_end_action?: string | null,
>   pricing_model?: string | null,
>   free_quantity?: number | null,
>   setup_cost?: number | null,
>   status?: string | null,
>   archived_at?: number | null,
>   billing_cycles?: number | null,
>   redirect_url?: string | null,
>   enabled_in_hosted_pages?: boolean | null,
>   enabled_in_portal?: boolean | null,
>   addon_applicability?: string | null,
>   tax_code?: string | null,
>   hsn_code?: string | null,
>   taxjar_product_code?: string | null,
>   avalara_sale_type?: string | null,
>   avalara_transaction_type?: number | null,
>   avalara_service_type?: number | null,
>   sku?: string | null,
>   accounting_code?: string | null,
>   accounting_category1?: string | null,
>   accounting_category2?: string | null,
>   accounting_category3?: string | null,
>   accounting_category4?: string | null,
>   is_shippable?: boolean | null,
>   shipping_frequency_period?: number | null,
>   shipping_frequency_period_unit?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   giftable?: boolean | null,
>   claim_url?: string | null,
>   free_quantity_in_decimal?: string | null,
>   price_in_decimal?: string | null,
>   channel?: string | null,
>   invoice_notes?: string | null,
>   taxable?: boolean | null,
>   tax_profile_id?: string | null,
>   meta_data?: {
>   } | null,
>   show_description_in_invoices?: boolean | null,
>   show_description_in_quotes?: boolean | null,
>   tiers?: {
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   applicable_addons?: {
>     id?: string | null
>   }[] | null,
>   attached_addons?: {
>     id?: string | null,
>     quantity?: number | null,
>     billing_cycles?: number | null,
>     type?: string | null,
>     quantity_in_decimal?: string | null
>   }[] | null,
>   event_based_addons?: {
>     id?: string | null,
>     quantity?: number | null,
>     on_event?: string | null,
>     charge_once?: boolean | null,
>     quantity_in_decimal?: string | null
>   }[] | null
> } | null
> ```

***

### create

`plans.create`

Create a plan. This endpoint creates a new plan based on the plan Id and plan name. Product Catalog 1.0 sites only.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.plans.create({ id: 'cust_8gsnbYfsMLds', name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `id` | `string` | Yes | A unique ID for your system to identify the plan. |
| `name` | `string` | Yes | The display name used in web interface for identifying the plan. |
| `invoice_name` | `string` | No | Display name used in invoice. If it is not configured then name is used in invoice. |
| `description` | `string` | No | Description about the plan to show in the hosted pages \\& customer portal. **Note:** If your input contains characters that are subjected to sanitization (like incomplete HTML tags), the sanitization process might increase the length of your input. If the sanitized input exceeds the limit, your request will be rejected. |
| `trial_period` | `number` | No | The free time window for your customer to try your product. |
| `trial_period_unit` | `day \| month` | No | Time unit for the trial period. \* month - In months \* day - In days |
| `trial_end_action` | `site_default \| activate_subscription \| cancel_subscription` | No | 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 plan 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. This can be overridden at the [subscription-level](https://docs.corsair.dev/docs/api/v2/pcv-1/subscriptions/subscription-object#trial_end_action) . \* cancel\_subscription - The subscription cancels. \* activate\_subscription - The subscription activates and charges are raised for non-metered items. \* 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. |
| `period` | `number` | No | Defines billing frequency. Example: to bill customer every 3 months, provide "3" here. |
| `period_unit` | `day \| week \| month \| year` | No | Defines billing frequency in association with billing period. \* month - Charge based on month(s) \* day - Charge based on day(s) \* week - Charge based on week(s) \* year - Charge based on year(s) |
| `setup_cost` | `number` | No | One-time setup fee charged as part of the first invoice. |
| `price` | `number` | No | The price of the plan. The unit depends on the [type of currency](https://docs.corsair.dev/docs/api/getting-started) . |
| `price_in_decimal` | `string` | No | The price of the plan when the `pricing_model` is `flat_fee`. When the pricing model is `per_unit` , it is the price per unit quantity of the plan. Not applicable for the other pricing models. The value is in decimal and in major units of the currency. Also, this is only applicable when [multi-decimal pricing](https://docs.corsair.dev/docs/api/v2/pcv-1/currencies) is enabled. . |
| `currency_code` | `string` | No | The currency code (ISO 4217 format) of the plan. |
| `billing_cycles` | `number` | No | The number of billing cycles the subscription is active. The subscription is moved to non renewing state and then to cancelled state automatically. |
| `pricing_model` | `flat_fee \| per_unit \| tiered \| volume \| stairstep` | No | Defines how the recurring charges for the subscription is calculated. \* tiered - There are quantity tiers for which per unit prices are set. Quantities are purchased from successive tiers. \* per\_unit - A fixed price per unit quantity. \* flat\_fee - A fixed price that is not quantity-based. \* volume - The per unit price is based on the tier that the total quantity falls in. \* stairstep - A quantity-based pricing scheme. The item is charged a fixed price based on the tier that the total quantity falls in. |
| `free_quantity` | `number` | No | Free quantity the subscriptions of this plan will have. Only the quantity more than this will be charged for the subscription. |
| `free_quantity_in_decimal` | `string` | No | The quantity of the plan that is available free-of-charge, represented in decimal. When a subscription is created for this plan or when the plan of a subscription is changed to this one, only the quantity above this number is charged for. Applicable for quantity-based plans and only when [multi-decimal pricing](https://docs.corsair.dev/docs/api/v2/pcv-1/currencies) is enabled. . |
| `addon_applicability` | `all \| restricted` | No | Indicates if all or only some addons are applicable with the plan. \* all - All addons are applicable with this plan. \* restricted - Only addons marked as 'applicable\_addons' are applicable with the plan. |
| `redirect_url` | `string` | No | The url to redirect on successful checkout. Eg: [https://yoursite.com/success.html?plan=basic](https://yoursite.com/success.html?plan=basic). |
| `enabled_in_hosted_pages` | `boolean` | No | If true, allow checkout through plan specific hosted page URL for this plan. |
| `enabled_in_portal` | `boolean` | No | If enabled, customers can switch to this plan using the 'Change Subscription' option in the customer portal. |
| `taxable` | `boolean` | No | Specifies whether taxes apply to this plan. This value is set and returned even if [Taxes](https://www.chargebee.com/docs/tax.html) have been disabled in Chargebee. However, the value is effective only while Taxes are enabled. |
| `tax_profile_id` | `string` | No | Tax profile of the plan. |
| `tax_code` | `string` | No | The Avalara tax codes to which items are mapped to should be provided here. Applicable only if you use Chargebee's [AvaTax for Sales integration](https://www.chargebee.com/docs/avalara.html) . |
| `hsn_code` | `string` | No | The [HSN code](https://cbic-gst.gov.in/gst-goods-services-rates.html) to which the item is mapped for calculating the customer's tax in India. Applicable only when both of the following conditions are true: \* [**India**](https://www.chargebee.com/docs/indian-gst.html#configuring-indian-gst) has been enabled as a **Tax Region**. (An error is returned when this condition is not true.) \* The [**AvaTax for Sales** integration](https://www.chargebee.com/docs/avalara.html) has been enabled in Chargebee. . |
| `taxjar_product_code` | `string` | No | The TaxJar product codes to which items are mapped to should be provided here. Applicable only if you use Chargebee's [TaxJar integration](https://www.chargebee.com/docs/taxjar.html) . |
| `avalara_sale_type` | `wholesale \| retail \| consumed \| vendor_use` | No | Indicates the type of sale carried out. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. \* retail - Transaction is a sale to an end user \* vendor\_use - Transaction is for an item that is subject to vendor use tax \* consumed - Transaction is for an item that is consumed directly \* wholesale - Transaction is a sale to another company that will resell your product or service to another consumer |
| `avalara_transaction_type` | `number` | No | Indicates the type of product to be taxed. Values for this field can be taken from Avalara. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. |
| `avalara_service_type` | `number` | No | Indicates the type of service for the product to be taxed. Values for this field can be taken from Avalara. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. |
| `sku` | `string` | No | The field is used as Product name/code in your third party accounting application. Chargebee will use it as an alternate name in your accounting application. |
| `accounting_code` | `string` | No | This field is to capture the Account code setup in your Accounting system for integration purposes only. |
| `accounting_category1` | `string` | No | Used exclusively with the following [accounting integrations](https://www.chargebee.com/docs/1.0/finance-integration-index.html) \* [**Xero:**](https://www.chargebee.com/docs/1.0/xero.html) If you've categorized your products in Xero, provide the category name and option. Use the format: `:` . For example:`Location: Singapore.` \* [**QuickBooks:**](https://www.chargebee.com/docs/1.0/quickbooks.html) If you've categorized your product sales in QuickBooks according to Classes, provide the class name here. Use the following format: `::...` \* [**NetSuite:**](https://www.chargebee.com/docs/1.0/netsuite.html) If you've categorized your products in NetSuite under Classes, provide the class name here. Use the following format: `: : ....` For example: `Services : Plan.` \* [**Intacct:**](https://www.chargebee.com/docs/1.0/intacct.html) If you've classified your products in Intacct under Locations, provide the name of the Location here. |
| `accounting_category2` | `string` | No | Used exclusively with the following [accounting integrations](https://www.chargebee.com/docs/1.0/finance-integration-index.html) \* [**Xero:**](https://www.chargebee.com/docs/1.0/xero.html) If you've categorized your products in Xero, then provide the second category name and option here. Use the format: `: ....` For example, `Region: South` \* [**QuickBooks:**](https://www.chargebee.com/docs/1.0/quickbooks.html) If you've categorized your product sales in QuickBooks according to Location, provide the Location name here. Use the following format: `::....` For example: `Location: North America: Canada` \* [**NetSuite:**](https://www.chargebee.com/docs/1.0/netsuite.html) If you've categorized your products in NetSuite under Locations, provide the location name here. Use the following format `: : ....` For example: `NA:US:CA` \* [**Intacct:**](https://www.chargebee.com/docs/1.0/intacct.html) If you've classified your products in Intacct under Dimensions, provide the value of the Dimension here. |
| `accounting_category3` | `string` | No | Used exclusively with the following [accounting integrations](https://www.chargebee.com/docs/1.0/finance-integration-index.html) \* [**NetSuite:**](https://www.chargebee.com/docs/1.0/netsuite.html) If you've categorized your products in NetSuite under Departments, pass the department name here. Use the following format: `: : ....` For example: `Production: Assembly.` \* [**Intacct:**](https://www.chargebee.com/docs/1.0/intacct.html) If you've classified your products in Intacct under multiple Dimensions, provide the value of the second Dimension here. . |
| `accounting_category4` | `string` | No | Used exclusively with the following [accounting integrations](https://www.chargebee.com/docs/1.0/finance-integration-index.html) \* [**NetSuite:**](https://www.chargebee.com/docs/1.0/netsuite.html) Provide the "Revenue Recognition Rule Id" for the product from NetSuite. \* [**Intacct:**](https://www.chargebee.com/docs/1.0/intacct.html) If you have configured "Revenue Recognition Templates" for products in Intacct, provide the template ID for the product. . |
| `is_shippable` | `boolean` | No | If enabled, charges for this plan/addon will be added to orders. |
| `shipping_frequency_period` | `number` | No | Defines the shipping frequency. Example: to bill customer every 2 weeks, provide "2" here. |
| `shipping_frequency_period_unit` | `year \| month \| week \| day` | No | Defines the shipping frequency in association with shipping period. \* month - Ship based on month(s) \* year - Ship based on year(s) \* day - Ship based on day(s) \* week - Ship based on week(s) |
| `invoice_notes` | `string` | No | A customer-facing note added to all invoices associated with this API resource. This note becomes one among [all the notes](https://docs.corsair.dev/docs/api/invoices/invoice-object#notes) displayed on the invoice PDF. |
| `meta_data` | `object` | No | A collection of key-value pairs that provides extra information about the plan. **Note:** There's a character limit of 65,535. [Learn more](https://docs.corsair.dev/docs/api/v2/pcv-1/advanced-features) . |
| `show_description_in_invoices` | `boolean` | No | Whether the [plan.description](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object) should be shown on [invoice PDFs](https://docs.corsair.dev/docs/api/invoices/retrieve-invoice-as-pdf). If this Boolean is changed, only invoices generated (or [regenerated](https://www.chargebee.com/docs/billing/2.0/invoices-credit-notes-and-quotes/invoice-operations#actions-for-payment-due-not-paid-invoices) )after the change are affected; past invoices are not. |
| `show_description_in_quotes` | `boolean` | No | Whether the [plan description](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object) should be shown on [quote PDFs](https://docs.corsair.dev/docs/api/quotes/retrieve-quote-as-pdf). If this Boolean is changed, only quotes created after the change are affected; past quotes are not. |
| `giftable` | `boolean` | No | Specifies if the plan should be gifted or not. |
| `status` | `active \| archived` | No | The plan state. \* archived - No new subscriptions allowed for the plan. Existing subscriptions on this plan will remain as-is and can be migrated to another active plan if required. \* active - New subscriptions can be created with the plan. |
| `claim_url` | `string` | No | The url to redirect on successful claim. Eg: [https://yoursite.com/claim\_success.html?plan=basic](https://yoursite.com/claim_success.html?plan=basic). |
| `tiers` | `object` | No | Parameters for tiers |
| `tax_providers_fields` | `object` | No | Parameters for tax\_providers\_fields |
| `applicable_addons` | `object` | No | Parameters for applicable\_addons |
| `event_based_addons` | `object` | No | Parameters for event\_based\_addons |
| `attached_addons` | `object` | No | Parameters for attached\_addons |

> [accordion] meta\_data full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] tiers full type
>
> ```ts theme={null}
> {
>   starting_unit?: number[],
>   ending_unit?: number[],
>   price?: number[],
>   starting_unit_in_decimal?: string[],
>   ending_unit_in_decimal?: string[],
>   price_in_decimal?: string[]
> }
> ```

> [accordion] tax\_providers\_fields full type
>
> ```ts theme={null}
> {
>   provider_name: string[],
>   field_id: string[],
>   field_value: string[]
> }
> ```

> [accordion] applicable\_addons full type
>
> ```ts theme={null}
> {
>   id?: string[]
> }
> ```

> [accordion] event\_based\_addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   on_event?: (subscription_creation | subscription_trial_start | plan_activation | subscription_activation | contract_termination)[],
>   charge_once?: boolean[]
> }
> ```

> [accordion] attached\_addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   billing_cycles?: number[],
>   type?: (recommended | mandatory)[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `plan` | `object \| null` | No | Specifies the price with billing frequency for a subscription. Create separate plans for varied price or billing frequency. For example, if you need to charge $10 per month for a group of customers and $100 per year for another group of customers, then create separate plans for each. |

> [accordion] plan full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   invoice_name?: string | null,
>   description?: string | null,
>   price?: number | null,
>   currency_code?: string | null,
>   period?: number | null,
>   period_unit?: string | null,
>   trial_period?: number | null,
>   trial_period_unit?: string | null,
>   trial_end_action?: string | null,
>   pricing_model?: string | null,
>   free_quantity?: number | null,
>   setup_cost?: number | null,
>   status?: string | null,
>   archived_at?: number | null,
>   billing_cycles?: number | null,
>   redirect_url?: string | null,
>   enabled_in_hosted_pages?: boolean | null,
>   enabled_in_portal?: boolean | null,
>   addon_applicability?: string | null,
>   tax_code?: string | null,
>   hsn_code?: string | null,
>   taxjar_product_code?: string | null,
>   avalara_sale_type?: string | null,
>   avalara_transaction_type?: number | null,
>   avalara_service_type?: number | null,
>   sku?: string | null,
>   accounting_code?: string | null,
>   accounting_category1?: string | null,
>   accounting_category2?: string | null,
>   accounting_category3?: string | null,
>   accounting_category4?: string | null,
>   is_shippable?: boolean | null,
>   shipping_frequency_period?: number | null,
>   shipping_frequency_period_unit?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   giftable?: boolean | null,
>   claim_url?: string | null,
>   free_quantity_in_decimal?: string | null,
>   price_in_decimal?: string | null,
>   channel?: string | null,
>   invoice_notes?: string | null,
>   taxable?: boolean | null,
>   tax_profile_id?: string | null,
>   meta_data?: {
>   } | null,
>   show_description_in_invoices?: boolean | null,
>   show_description_in_quotes?: boolean | null,
>   tiers?: {
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   applicable_addons?: {
>     id?: string | null
>   }[] | null,
>   attached_addons?: {
>     id?: string | null,
>     quantity?: number | null,
>     billing_cycles?: number | null,
>     type?: string | null,
>     quantity_in_decimal?: string | null
>   }[] | null,
>   event_based_addons?: {
>     id?: string | null,
>     quantity?: number | null,
>     on_event?: string | null,
>     charge_once?: boolean | null,
>     quantity_in_decimal?: string | null
>   }[] | null
> } | null
> ```

***

### delete

`plans.delete`

Delete a plan. Deletes or archives a plan. This endpoint behaves differently based on the scenarios listed below: \* When the plan has subscriptions/invoices linked, it is not deleted. Instead, it is moved to the archived state. Subscriptions already on it continue to renew. Product Catalog 1.0 sites only.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.plans.delete({ planId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `planId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `plan` | `object \| null` | No | Specifies the price with billing frequency for a subscription. Create separate plans for varied price or billing frequency. For example, if you need to charge $10 per month for a group of customers and $100 per year for another group of customers, then create separate plans for each. |

> [accordion] plan full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   invoice_name?: string | null,
>   description?: string | null,
>   price?: number | null,
>   currency_code?: string | null,
>   period?: number | null,
>   period_unit?: string | null,
>   trial_period?: number | null,
>   trial_period_unit?: string | null,
>   trial_end_action?: string | null,
>   pricing_model?: string | null,
>   free_quantity?: number | null,
>   setup_cost?: number | null,
>   status?: string | null,
>   archived_at?: number | null,
>   billing_cycles?: number | null,
>   redirect_url?: string | null,
>   enabled_in_hosted_pages?: boolean | null,
>   enabled_in_portal?: boolean | null,
>   addon_applicability?: string | null,
>   tax_code?: string | null,
>   hsn_code?: string | null,
>   taxjar_product_code?: string | null,
>   avalara_sale_type?: string | null,
>   avalara_transaction_type?: number | null,
>   avalara_service_type?: number | null,
>   sku?: string | null,
>   accounting_code?: string | null,
>   accounting_category1?: string | null,
>   accounting_category2?: string | null,
>   accounting_category3?: string | null,
>   accounting_category4?: string | null,
>   is_shippable?: boolean | null,
>   shipping_frequency_period?: number | null,
>   shipping_frequency_period_unit?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   giftable?: boolean | null,
>   claim_url?: string | null,
>   free_quantity_in_decimal?: string | null,
>   price_in_decimal?: string | null,
>   channel?: string | null,
>   invoice_notes?: string | null,
>   taxable?: boolean | null,
>   tax_profile_id?: string | null,
>   meta_data?: {
>   } | null,
>   show_description_in_invoices?: boolean | null,
>   show_description_in_quotes?: boolean | null,
>   tiers?: {
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   applicable_addons?: {
>     id?: string | null
>   }[] | null,
>   attached_addons?: {
>     id?: string | null,
>     quantity?: number | null,
>     billing_cycles?: number | null,
>     type?: string | null,
>     quantity_in_decimal?: string | null
>   }[] | null,
>   event_based_addons?: {
>     id?: string | null,
>     quantity?: number | null,
>     on_event?: string | null,
>     charge_once?: boolean | null,
>     quantity_in_decimal?: string | null
>   }[] | null
> } | null
> ```

***

### get

`plans.get`

Retrieve a plan. This endpoint retrieves a specific plan using the plan ID. Product Catalog 1.0 sites only.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.plans.get({ planId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `planId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `plan` | `object \| null` | No | Specifies the price with billing frequency for a subscription. Create separate plans for varied price or billing frequency. For example, if you need to charge $10 per month for a group of customers and $100 per year for another group of customers, then create separate plans for each. |

> [accordion] plan full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   invoice_name?: string | null,
>   description?: string | null,
>   price?: number | null,
>   currency_code?: string | null,
>   period?: number | null,
>   period_unit?: string | null,
>   trial_period?: number | null,
>   trial_period_unit?: string | null,
>   trial_end_action?: string | null,
>   pricing_model?: string | null,
>   free_quantity?: number | null,
>   setup_cost?: number | null,
>   status?: string | null,
>   archived_at?: number | null,
>   billing_cycles?: number | null,
>   redirect_url?: string | null,
>   enabled_in_hosted_pages?: boolean | null,
>   enabled_in_portal?: boolean | null,
>   addon_applicability?: string | null,
>   tax_code?: string | null,
>   hsn_code?: string | null,
>   taxjar_product_code?: string | null,
>   avalara_sale_type?: string | null,
>   avalara_transaction_type?: number | null,
>   avalara_service_type?: number | null,
>   sku?: string | null,
>   accounting_code?: string | null,
>   accounting_category1?: string | null,
>   accounting_category2?: string | null,
>   accounting_category3?: string | null,
>   accounting_category4?: string | null,
>   is_shippable?: boolean | null,
>   shipping_frequency_period?: number | null,
>   shipping_frequency_period_unit?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   giftable?: boolean | null,
>   claim_url?: string | null,
>   free_quantity_in_decimal?: string | null,
>   price_in_decimal?: string | null,
>   channel?: string | null,
>   invoice_notes?: string | null,
>   taxable?: boolean | null,
>   tax_profile_id?: string | null,
>   meta_data?: {
>   } | null,
>   show_description_in_invoices?: boolean | null,
>   show_description_in_quotes?: boolean | null,
>   tiers?: {
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   applicable_addons?: {
>     id?: string | null
>   }[] | null,
>   attached_addons?: {
>     id?: string | null,
>     quantity?: number | null,
>     billing_cycles?: number | null,
>     type?: string | null,
>     quantity_in_decimal?: string | null
>   }[] | null,
>   event_based_addons?: {
>     id?: string | null,
>     quantity?: number | null,
>     on_event?: string | null,
>     charge_once?: boolean | null,
>     quantity_in_decimal?: string | null
>   }[] | null
> } | null
> ```

***

### list

`plans.list`

List plans. This API fetches all the active and archived plans. If the limit parameter is not set, it will return upto 10 plans. Product Catalog 1.0 sites only.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.plans.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `id` | `object` | No | optional, string filter A unique ID for your system to identify the plan. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *id\\\[is\\] = "Enterprise"* |
| `name` | `object` | No | optional, string filter The display name used in web interface for identifying the plan. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *name\\\[is\\] = "plan\_enterprise"* |
| `price` | `object` | No | optional, in cents filter The price of the plan. The unit depends on the [type of currency](https://docs.corsair.dev/docs/api/getting-started) . **Supported operators :** is, is\_not, lt, lte, gt, gte, between **Example →** *price\\\[gte\\] = "1200"* |
| `period` | `object` | No | optional, integer filter Defines billing frequency. Example: to bill customer every 3 months, provide "3" here. **Supported operators :** is, is\_not, lt, lte, gt, gte, between **Example →** *period\\\[lte\\] = "3"* |
| `period_unit` | `object` | No | optional, enumerated string filter Defines billing frequency in association with billing period. Possible values are : day, week, month, year. **Supported operators :** is, is\_not, in, not\_in **Example →** *period\_unit\\\[is\\] = "month"* |
| `trial_period` | `object` | No | optional, integer filter The free time window for your customer to try your product. **Supported operators :** is, is\_not, lt, lte, gt, gte, between, is\_present **Example →** *trial\_period\\\[lt\\] = "14"* |
| `trial_period_unit` | `object` | No | optional, enumerated string filter Time unit for the trial period. Possible values are : day, month. **Supported operators :** is, is\_not, in, not\_in **Example →** *trial\_period\_unit\\\[is\\] = "day"* |
| `addon_applicability` | `object` | No | optional, enumerated string filter Indicates if all or only some addons are applicable with the plan. Possible values are : all, restricted. **Supported operators :** is, is\_not, in, not\_in **Example →** *addon\_applicability\\\[is\\] = "all"* |
| `giftable` | `object` | No | optional, boolean filter Specifies if the plan should be gifted or not. Possible values are : *true, false* **Supported operators :** is **Example →** *giftable\\\[is\\] = "true"* |
| `pricing_model` | `object` | No | optional, enumerated string filter Defines how the recurring charges for the subscription is calculated. Possible values are : flat\_fee, per\_unit, tiered, volume, stairstep. **Supported operators :** is, is\_not, in, not\_in **Example →** *pricing\_model\\\[is\\] = "flat\_fee"* |
| `status` | `object` | No | optional, enumerated string filter The plan state. Possible values are : active, archived, deleted. **Supported operators :** is, is\_not, in, not\_in **Example →** *status\\\[is\\] = "active"* |
| `updated_at` | `object` | No | optional, timestamp(UTC) in seconds filter To filter based on updated at. This attribute will be present only if the resource has been updated after 2016-11-09. **Supported operators :** after, before, on, between **Example →** *updated\_at\\\[before\\] = "1243545465"* |
| `currency_code` | `object` | No | optional, string filter The currency code (ISO 4217 format) of the plan. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *currency\_code\\\[is\\] = "USD"* |
| `channel` | `object` | No | optional, enumerated string filter The subscription channel this object originated from and is maintained in. Possible values are : web, app\_store, play\_store. **Supported operators :** is, is\_not, in, not\_in **Example →** *channel\\\[is\\] = "APP STORE"* |
| `include_deleted` | `boolean` | No | If set to true, includes the deleted resources in the response. For the deleted resources in the response, the '**deleted** ' attribute will be '**true** '. |

> [accordion] id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] name full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] price full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   lt?: string,
>   lte?: string,
>   gt?: string,
>   gte?: string,
>   between?: string
> }
> ```

> [accordion] period full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   lt?: string,
>   lte?: string,
>   gt?: string,
>   gte?: string,
>   between?: string
> }
> ```

> [accordion] period\_unit full type
>
> ```ts theme={null}
> {
>   is?: day | week | month | year,
>   is_not?: day | week | month | year,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] trial\_period full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   lt?: string,
>   lte?: string,
>   gt?: string,
>   gte?: string,
>   between?: string,
>   is_present?: true | false
> }
> ```

> [accordion] trial\_period\_unit full type
>
> ```ts theme={null}
> {
>   is?: day | month,
>   is_not?: day | month,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] addon\_applicability full type
>
> ```ts theme={null}
> {
>   is?: all | restricted,
>   is_not?: all | restricted,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] giftable full type
>
> ```ts theme={null}
> {
>   is?: true | false
> }
> ```

> [accordion] pricing\_model full type
>
> ```ts theme={null}
> {
>   is?: flat_fee | per_unit | tiered | volume | stairstep,
>   is_not?: flat_fee | per_unit | tiered | volume | stairstep,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] status full type
>
> ```ts theme={null}
> {
>   is?: active | archived | deleted,
>   is_not?: active | archived | deleted,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] updated\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] currency\_code full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] channel full type
>
> ```ts theme={null}
> {
>   is?: web | app_store | play_store,
>   is_not?: web | app_store | play_store,
>   in?: string,
>   not_in?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   plan?: {
>     id?: string | null,
>     name?: string | null,
>     invoice_name?: string | null,
>     description?: string | null,
>     price?: number | null,
>     currency_code?: string | null,
>     period?: number | null,
>     period_unit?: string | null,
>     trial_period?: number | null,
>     trial_period_unit?: string | null,
>     trial_end_action?: string | null,
>     pricing_model?: string | null,
>     free_quantity?: number | null,
>     setup_cost?: number | null,
>     status?: string | null,
>     archived_at?: number | null,
>     billing_cycles?: number | null,
>     redirect_url?: string | null,
>     enabled_in_hosted_pages?: boolean | null,
>     enabled_in_portal?: boolean | null,
>     addon_applicability?: string | null,
>     tax_code?: string | null,
>     hsn_code?: string | null,
>     taxjar_product_code?: string | null,
>     avalara_sale_type?: string | null,
>     avalara_transaction_type?: number | null,
>     avalara_service_type?: number | null,
>     sku?: string | null,
>     accounting_code?: string | null,
>     accounting_category1?: string | null,
>     accounting_category2?: string | null,
>     accounting_category3?: string | null,
>     accounting_category4?: string | null,
>     is_shippable?: boolean | null,
>     shipping_frequency_period?: number | null,
>     shipping_frequency_period_unit?: string | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     giftable?: boolean | null,
>     claim_url?: string | null,
>     free_quantity_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     channel?: string | null,
>     invoice_notes?: string | null,
>     taxable?: boolean | null,
>     tax_profile_id?: string | null,
>     meta_data?: {
>     } | null,
>     show_description_in_invoices?: boolean | null,
>     show_description_in_quotes?: boolean | null,
>     tiers?: {
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       price?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       price_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     tax_providers_fields?: {
>       provider_name?: string | null,
>       field_id?: string | null,
>       field_value?: string | null
>     }[] | null,
>     applicable_addons?: {
>       id?: string | null
>     }[] | null,
>     attached_addons?: {
>       id?: string | null,
>       quantity?: number | null,
>       billing_cycles?: number | null,
>       type?: string | null,
>       quantity_in_decimal?: string | null
>     }[] | null,
>     event_based_addons?: {
>       id?: string | null,
>       quantity?: number | null,
>       on_event?: string | null,
>       charge_once?: boolean | null,
>       quantity_in_decimal?: string | null
>     }[] | null
>   } | null
> }[] | null
> ```

***

### unarchive

`plans.unarchive`

Unarchive a plan. This endpoint unarchives a specific plan which was archived earlier. Product Catalog 1.0 sites only.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.plans.unarchive({ planId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `planId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `plan` | `object \| null` | No | Specifies the price with billing frequency for a subscription. Create separate plans for varied price or billing frequency. For example, if you need to charge $10 per month for a group of customers and $100 per year for another group of customers, then create separate plans for each. |

> [accordion] plan full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   invoice_name?: string | null,
>   description?: string | null,
>   price?: number | null,
>   currency_code?: string | null,
>   period?: number | null,
>   period_unit?: string | null,
>   trial_period?: number | null,
>   trial_period_unit?: string | null,
>   trial_end_action?: string | null,
>   pricing_model?: string | null,
>   free_quantity?: number | null,
>   setup_cost?: number | null,
>   status?: string | null,
>   archived_at?: number | null,
>   billing_cycles?: number | null,
>   redirect_url?: string | null,
>   enabled_in_hosted_pages?: boolean | null,
>   enabled_in_portal?: boolean | null,
>   addon_applicability?: string | null,
>   tax_code?: string | null,
>   hsn_code?: string | null,
>   taxjar_product_code?: string | null,
>   avalara_sale_type?: string | null,
>   avalara_transaction_type?: number | null,
>   avalara_service_type?: number | null,
>   sku?: string | null,
>   accounting_code?: string | null,
>   accounting_category1?: string | null,
>   accounting_category2?: string | null,
>   accounting_category3?: string | null,
>   accounting_category4?: string | null,
>   is_shippable?: boolean | null,
>   shipping_frequency_period?: number | null,
>   shipping_frequency_period_unit?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   giftable?: boolean | null,
>   claim_url?: string | null,
>   free_quantity_in_decimal?: string | null,
>   price_in_decimal?: string | null,
>   channel?: string | null,
>   invoice_notes?: string | null,
>   taxable?: boolean | null,
>   tax_profile_id?: string | null,
>   meta_data?: {
>   } | null,
>   show_description_in_invoices?: boolean | null,
>   show_description_in_quotes?: boolean | null,
>   tiers?: {
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   applicable_addons?: {
>     id?: string | null
>   }[] | null,
>   attached_addons?: {
>     id?: string | null,
>     quantity?: number | null,
>     billing_cycles?: number | null,
>     type?: string | null,
>     quantity_in_decimal?: string | null
>   }[] | null,
>   event_based_addons?: {
>     id?: string | null,
>     quantity?: number | null,
>     on_event?: string | null,
>     charge_once?: boolean | null,
>     quantity_in_decimal?: string | null
>   }[] | null
> } | null
> ```

***

### update

`plans.update`

Update a plan. When updating plans that are already linked to an invoice or a subscription, you can only update the following parameters: \* name \* invoice\_name \* setup\_cost \* price \* trial\_period \* trial\_period\_unit \* redirect\_url \* enabled\_in\_hosted\_pages \* meta\_data. Product Catalog 1.0 sites only.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.plans.update({ planId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `planId` | `string` | Yes | — |
| `name` | `string` | No | The display name used in web interface for identifying the plan. |
| `invoice_name` | `string` | No | Display name used in invoice. If it is not configured then name is used in invoice. |
| `description` | `string` | No | Description about the plan to show in the hosted pages \\& customer portal. **Note:** If your input contains characters that are subjected to sanitization (like incomplete HTML tags), the sanitization process might increase the length of your input. If the sanitized input exceeds the limit, your request will be rejected. |
| `trial_period` | `number` | No | The free time window for your customer to try your product. If **zero** is passed, the trial period will be removed. |
| `trial_period_unit` | `day \| month` | No | Time unit for the trial period. \* month - In months \* day - In days |
| `trial_end_action` | `site_default \| activate_subscription \| cancel_subscription` | No | 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 plan 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. This can be overridden at the [subscription-level](https://docs.corsair.dev/docs/api/v2/pcv-1/subscriptions/subscription-object#trial_end_action) . \* cancel\_subscription - The subscription cancels. \* activate\_subscription - The subscription activates and charges are raised for non-metered items. \* 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. |
| `period` | `number` | No | Defines billing frequency. Example: to bill customer every 3 months, provide "3" here. |
| `period_unit` | `day \| week \| month \| year` | No | Defines billing frequency in association with billing period. \* month - Charge based on month(s) \* day - Charge based on day(s) \* week - Charge based on week(s) \* year - Charge based on year(s) |
| `setup_cost` | `number` | No | One-time setup fee charged as part of the first invoice. |
| `price` | `number` | No | The price of the plan. The unit depends on the [type of currency](https://docs.corsair.dev/docs/api/getting-started) . |
| `price_in_decimal` | `string` | No | The price of the plan when the `pricing_model` is `flat_fee`. When the pricing model is `per_unit` , it is the price per unit quantity of the plan. Not applicable for the other pricing models. The value is in decimal and in major units of the currency. Also, this is only applicable when [multi-decimal pricing](https://docs.corsair.dev/docs/api/v2/pcv-1/currencies) is enabled. . |
| `currency_code` | `string` | No | The currency code (ISO 4217 format) of the plan. Applicable if Multicurrency is enabled. |
| `billing_cycles` | `number` | No | The number of billing cycles the subscription is active. The subscription is moved to non renewing state and then to cancelled state automatically. |
| `pricing_model` | `flat_fee \| per_unit \| tiered \| volume \| stairstep` | No | Defines how the recurring charges for the subscription is calculated. \* tiered - There are quantity tiers for which per unit prices are set. Quantities are purchased from successive tiers. \* per\_unit - A fixed price per unit quantity. \* flat\_fee - A fixed price that is not quantity-based. \* volume - The per unit price is based on the tier that the total quantity falls in. \* stairstep - A quantity-based pricing scheme. The item is charged a fixed price based on the tier that the total quantity falls in. |
| `free_quantity` | `number` | No | Free quantity the subscriptions of this plan will have. Only the quantity more than this will be charged for the subscription. |
| `free_quantity_in_decimal` | `string` | No | The quantity of the plan that is available free-of-charge, represented in decimal. When a subscription is created for this plan or when the plan of a subscription is changed to this one, only the quantity above this number is charged for. Applicable for quantity-based plans and only when [multi-decimal pricing](https://docs.corsair.dev/docs/api/v2/pcv-1/currencies) is enabled. . |
| `addon_applicability` | `all \| restricted` | No | Indicates if all or only some addons are applicable with the plan. \* all - All addons are applicable with this plan. \* restricted - Only addons marked as 'applicable\_addons' are applicable with the plan. |
| `redirect_url` | `string` | No | The url to redirect on successful checkout. Eg: [https://yoursite.com/success.html?plan=basic](https://yoursite.com/success.html?plan=basic). |
| `enabled_in_hosted_pages` | `boolean` | No | If true, allow checkout through plan specific hosted page URL for this plan. |
| `enabled_in_portal` | `boolean` | No | If enabled, customers can switch to this plan using the 'Change Subscription' option in the customer portal. |
| `taxable` | `boolean` | No | Specifies whether taxes apply to this plan. This value is set and returned even if [Taxes](https://www.chargebee.com/docs/tax.html) have been disabled in Chargebee. However, the value is effective only while Taxes are enabled. |
| `tax_profile_id` | `string` | No | Tax profile of the plan. |
| `tax_code` | `string` | No | The Avalara tax codes to which items are mapped to should be provided here. Applicable only if you use Chargebee's [AvaTax for Sales integration](https://www.chargebee.com/docs/avalara.html) . |
| `hsn_code` | `string` | No | The [HSN code](https://cbic-gst.gov.in/gst-goods-services-rates.html) to which the item is mapped for calculating the customer's tax in India. Applicable only when both of the following conditions are true: \* [**India**](https://www.chargebee.com/docs/indian-gst.html#configuring-indian-gst) has been enabled as a **Tax Region**. (An error is returned when this condition is not true.) \* The [**AvaTax for Sales** integration](https://www.chargebee.com/docs/avalara.html) has been enabled in Chargebee. . |
| `taxjar_product_code` | `string` | No | The TaxJar product codes to which items are mapped to should be provided here. Applicable only if you use Chargebee's [TaxJar integration](https://www.chargebee.com/docs/taxjar.html) . |
| `avalara_sale_type` | `wholesale \| retail \| consumed \| vendor_use` | No | Indicates the type of sale carried out. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. \* retail - Transaction is a sale to an end user \* vendor\_use - Transaction is for an item that is subject to vendor use tax \* consumed - Transaction is for an item that is consumed directly \* wholesale - Transaction is a sale to another company that will resell your product or service to another consumer |
| `avalara_transaction_type` | `number` | No | Indicates the type of product to be taxed. Values for this field can be taken from Avalara. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. |
| `avalara_service_type` | `number` | No | Indicates the type of service for the product to be taxed. Values for this field can be taken from Avalara. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. |
| `sku` | `string` | No | The field is used as Product name/code in your third party accounting application. Chargebee will use it as an alternate name in your accounting application. |
| `accounting_code` | `string` | No | This field is to capture the Account code setup in your Accounting system for integration purposes only. |
| `accounting_category1` | `string` | No | Used exclusively with the following [accounting integrations](https://www.chargebee.com/docs/1.0/finance-integration-index.html) \* [**Xero:**](https://www.chargebee.com/docs/1.0/xero.html) If you've categorized your products in Xero, provide the category name and option. Use the format: `:` . For example:`Location: Singapore.` \* [**QuickBooks:**](https://www.chargebee.com/docs/1.0/quickbooks.html) If you've categorized your product sales in QuickBooks according to Classes, provide the class name here. Use the following format: `::...` \* [**NetSuite:**](https://www.chargebee.com/docs/1.0/netsuite.html) If you've categorized your products in NetSuite under Classes, provide the class name here. Use the following format: `: : ....` For example: `Services : Plan.` \* [**Intacct:**](https://www.chargebee.com/docs/1.0/intacct.html) If you've classified your products in Intacct under Locations, provide the name of the Location here. |
| `accounting_category2` | `string` | No | Used exclusively with the following [accounting integrations](https://www.chargebee.com/docs/1.0/finance-integration-index.html) \* [**Xero:**](https://www.chargebee.com/docs/1.0/xero.html) If you've categorized your products in Xero, then provide the second category name and option here. Use the format: `: ....` For example, `Region: South` \* [**QuickBooks:**](https://www.chargebee.com/docs/1.0/quickbooks.html) If you've categorized your product sales in QuickBooks according to Location, provide the Location name here. Use the following format: `::....` For example: `Location: North America: Canada` \* [**NetSuite:**](https://www.chargebee.com/docs/1.0/netsuite.html) If you've categorized your products in NetSuite under Locations, provide the location name here. Use the following format `: : ....` For example: `NA:US:CA` \* [**Intacct:**](https://www.chargebee.com/docs/1.0/intacct.html) If you've classified your products in Intacct under Dimensions, provide the value of the Dimension here. |
| `accounting_category3` | `string` | No | Used exclusively with the following [accounting integrations](https://www.chargebee.com/docs/1.0/finance-integration-index.html) \* [**NetSuite:**](https://www.chargebee.com/docs/1.0/netsuite.html) If you've categorized your products in NetSuite under Departments, pass the department name here. Use the following format: `: : ....` For example: `Production: Assembly.` \* [**Intacct:**](https://www.chargebee.com/docs/1.0/intacct.html) If you've classified your products in Intacct under multiple Dimensions, provide the value of the second Dimension here. . |
| `accounting_category4` | `string` | No | Used exclusively with the following [accounting integrations](https://www.chargebee.com/docs/1.0/finance-integration-index.html) \* [**NetSuite:**](https://www.chargebee.com/docs/1.0/netsuite.html) Provide the "Revenue Recognition Rule Id" for the product from NetSuite. \* [**Intacct:**](https://www.chargebee.com/docs/1.0/intacct.html) If you have configured "Revenue Recognition Templates" for products in Intacct, provide the template ID for the product. . |
| `is_shippable` | `boolean` | No | If enabled, charges for this plan/addon will be added to orders. |
| `shipping_frequency_period` | `number` | No | Defines the shipping frequency. Example: to bill customer every 2 weeks, provide "2" here. |
| `shipping_frequency_period_unit` | `year \| month \| week \| day` | No | Defines the shipping frequency in association with shipping period. \* month - Ship based on month(s) \* year - Ship based on year(s) \* day - Ship based on day(s) \* week - Ship based on week(s) |
| `invoice_notes` | `string` | No | A customer-facing note added to all invoices associated with this API resource. This note becomes one among [all the notes](https://docs.corsair.dev/docs/api/invoices/invoice-object#notes) displayed on the invoice PDF. |
| `meta_data` | `object` | No | A collection of key-value pairs that provides extra information about the plan. **Note:** There's a character limit of 65,535. [Learn more](https://docs.corsair.dev/docs/api/v2/pcv-1/advanced-features) . |
| `show_description_in_invoices` | `boolean` | No | Whether the [plan.description](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object) should be shown on [invoice PDFs](https://docs.corsair.dev/docs/api/invoices/retrieve-invoice-as-pdf). If this Boolean is changed, only invoices generated (or [regenerated](https://www.chargebee.com/docs/billing/2.0/invoices-credit-notes-and-quotes/invoice-operations#actions-for-payment-due-not-paid-invoices) )after the change are affected; past invoices are not. |
| `show_description_in_quotes` | `boolean` | No | Whether the [plan description](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object) should be shown on [quote PDFs](https://docs.corsair.dev/docs/api/quotes/retrieve-quote-as-pdf). If this Boolean is changed, only quotes created after the change are affected; past quotes are not. |
| `tiers` | `object` | No | Parameters for tiers |
| `tax_providers_fields` | `object` | No | Parameters for tax\_providers\_fields |
| `applicable_addons` | `object` | No | Parameters for applicable\_addons |
| `event_based_addons` | `object` | No | Parameters for event\_based\_addons |
| `attached_addons` | `object` | No | Parameters for attached\_addons |

> [accordion] meta\_data full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] tiers full type
>
> ```ts theme={null}
> {
>   starting_unit?: number[],
>   ending_unit?: number[],
>   price?: number[],
>   starting_unit_in_decimal?: string[],
>   ending_unit_in_decimal?: string[],
>   price_in_decimal?: string[]
> }
> ```

> [accordion] tax\_providers\_fields full type
>
> ```ts theme={null}
> {
>   provider_name: string[],
>   field_id: string[],
>   field_value: string[]
> }
> ```

> [accordion] applicable\_addons full type
>
> ```ts theme={null}
> {
>   id?: string[]
> }
> ```

> [accordion] event\_based\_addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   on_event?: (subscription_creation | subscription_trial_start | plan_activation | subscription_activation | contract_termination)[],
>   charge_once?: boolean[]
> }
> ```

> [accordion] attached\_addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   billing_cycles?: number[],
>   type?: (recommended | mandatory)[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `plan` | `object \| null` | No | Specifies the price with billing frequency for a subscription. Create separate plans for varied price or billing frequency. For example, if you need to charge $10 per month for a group of customers and $100 per year for another group of customers, then create separate plans for each. |

> [accordion] plan full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   invoice_name?: string | null,
>   description?: string | null,
>   price?: number | null,
>   currency_code?: string | null,
>   period?: number | null,
>   period_unit?: string | null,
>   trial_period?: number | null,
>   trial_period_unit?: string | null,
>   trial_end_action?: string | null,
>   pricing_model?: string | null,
>   free_quantity?: number | null,
>   setup_cost?: number | null,
>   status?: string | null,
>   archived_at?: number | null,
>   billing_cycles?: number | null,
>   redirect_url?: string | null,
>   enabled_in_hosted_pages?: boolean | null,
>   enabled_in_portal?: boolean | null,
>   addon_applicability?: string | null,
>   tax_code?: string | null,
>   hsn_code?: string | null,
>   taxjar_product_code?: string | null,
>   avalara_sale_type?: string | null,
>   avalara_transaction_type?: number | null,
>   avalara_service_type?: number | null,
>   sku?: string | null,
>   accounting_code?: string | null,
>   accounting_category1?: string | null,
>   accounting_category2?: string | null,
>   accounting_category3?: string | null,
>   accounting_category4?: string | null,
>   is_shippable?: boolean | null,
>   shipping_frequency_period?: number | null,
>   shipping_frequency_period_unit?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   giftable?: boolean | null,
>   claim_url?: string | null,
>   free_quantity_in_decimal?: string | null,
>   price_in_decimal?: string | null,
>   channel?: string | null,
>   invoice_notes?: string | null,
>   taxable?: boolean | null,
>   tax_profile_id?: string | null,
>   meta_data?: {
>   } | null,
>   show_description_in_invoices?: boolean | null,
>   show_description_in_quotes?: boolean | null,
>   tiers?: {
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   applicable_addons?: {
>     id?: string | null
>   }[] | null,
>   attached_addons?: {
>     id?: string | null,
>     quantity?: number | null,
>     billing_cycles?: number | null,
>     type?: string | null,
>     quantity_in_decimal?: string | null
>   }[] | null,
>   event_based_addons?: {
>     id?: string | null,
>     quantity?: number | null,
>     on_event?: string | null,
>     charge_once?: boolean | null,
>     quantity_in_decimal?: string | null
>   }[] | null
> } | null
> ```

***

## Portal Sessions

### activate

`portalSessions.activate`

Activate a portal session. When an user is sent back to your return URL with session details, you should validate that information by calling this API. The details passed to the return\_url should be sent as below: \* auth\_session\_id - this should be sent as part of the endpoint.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.portalSessions.activate({ portalSessionId: 'example', token: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `portalSessionId` | `string` | Yes | — |
| `token` | `string` | Yes | Unique pre-authenticated portal session token to access customer portal directly. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `portal_session` | `object \| null` | No | Customer Portal lets your customers to manage their account and billing themselves. Chargebee supports Single Sign-on (SSO) to access the customer portal. If you already have your own authentication for your website, it allows your authenticated customers to access their portal without having to login again. **Note:** You can instead allow your customers to access the portal via login page provided by Chargebee. [Read more](https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html). Please follow the below steps for supporting portal access via SSO: 1. To enable the "Allow access to customer portal via API", click **Settings** \\> **Configure Chargebee** \\> **Customer Facing Essentials** \\> **Checkout and Self Serve Portal** \\> **Portal**. 2. Provide a link in your website/application which your authenticated customers can use to access the portal (For example, `{your_website_url}/portal_link`). 3. Handle the link request in your server code and create a portal session for the customer by calling Chargebee's "Create a portal session" API 4. Forward the user to the access URL present in the "Portal Session" resource returned by the above API call. **Notes about access URL:** \* The access URL should be accessed by the customer within one hour from the time it was created. \* Once accessed, the session is valid until the user logs out from the portal UI or logout API is called from your application for this session. \* Once accessed, the access url cannot be reused. Hence do not persist this URL. Whenever you need to provide access to the portal, you need to create a new portal session. Using Chargebee's authentication **Note:** This feature is not supported in [in-app](https://www.chargebee.com/docs/inapp-self-serve-portal.html) portal. Chargebee allows you to integrate your website by building user authentication on top of Chargebee. You can also use the portal login to provide authenticated access for your customers to your website pages. **Workflow:** Users should be redirected to the portal login URL - **[https://yourdomain.chargebeeportal.com/portal/login](https://yourdomain.chargebeeportal.com/portal/login)** by passing the following parameters: \* **return\_url** - URL the users should be redirected to upon successful authentication. \* **cancel\_url** - URL the users should be redirected to when they want to go back to your website during login. The domain name used in the Return/Cancel URL should be added as a 'Whitelisted Domain' in Chargebee. Add just the domain name in Chargebee and not the entire URL: E.g. yourdomain.com. Upon successful authentication, a session is created for the user and Chargebee redirects the user to the return\_url along with the following parameters: \* **auth\_session\_id** - Identifier to the authenticated session. \* **auth\_session\_token** - Token for the session which should be sent later to activate this session. Using the **auth\_session\_id** \\& **auth\_session\_token** , you should call [Activate a Portal Session](https://docs.corsair.dev/docs/api/portal_sessions/activate-a-portal-session) API to validate the session details and create a session for that user in your website. **Note:** The process of setting up the portal account will take place along with the authentication process. Scheduled subscription changes \* When [Ramps](ramps) are disabled, the customer can view and edit the single scheduled change if it exists. \* When [Ramps](ramps) are enabled with compatibility mode: \* The customer can view and edit the first ramp if it exists. \* If they edit the subscription, the impacts are the same as those described in the documentation for [`changes_scheduled_at`](subscriptions#update_subscription_for_items_changes_scheduled_at) parameter in the Update subscription API. For more details, see [Ramps API compatibility mode](subscriptions#ramps-compat-mode). |

> [accordion] portal\_session full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   token?: string | null,
>   access_url?: string | null,
>   redirect_url?: string | null,
>   status?: string | null,
>   created_at?: number | null,
>   expires_at?: number | null,
>   customer_id?: string | null,
>   login_at?: number | null,
>   logout_at?: number | null,
>   login_ipaddress?: string | null,
>   logout_ipaddress?: string | null,
>   linked_customers?: {
>     customer_id?: string | null,
>     email?: string | null,
>     has_billing_address?: boolean | null,
>     has_payment_method?: boolean | null,
>     has_active_subscription?: boolean | null
>   }[] | null
> } | null
> ```

***

### create

`portalSessions.create`

Create a portal session. Creates a portal session for a customer. The session resource in the response contains the access URL. Forward the customer to that access URL. If you would like to logout the customer later via API call, you need to store the id of the portal session resource returned by this API.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.portalSessions.create({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `redirect_url` | `string` | No | URL to redirect when the user logs out from the portal. |
| `forward_url` | `string` | No | By default access\_url redirects the customer to the portal home page. If you would like to redirect the customer to a different URL, you can use this parameter to do so. **Note:** This parameter is not applicable for [in-app](https://www.chargebee.com/docs/v3-self-serve-portal.html) portal. |
| `customer` | `object` | No | Parameters for customer |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `portal_session` | `object \| null` | No | Customer Portal lets your customers to manage their account and billing themselves. Chargebee supports Single Sign-on (SSO) to access the customer portal. If you already have your own authentication for your website, it allows your authenticated customers to access their portal without having to login again. **Note:** You can instead allow your customers to access the portal via login page provided by Chargebee. [Read more](https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html). Please follow the below steps for supporting portal access via SSO: 1. To enable the "Allow access to customer portal via API", click **Settings** \\> **Configure Chargebee** \\> **Customer Facing Essentials** \\> **Checkout and Self Serve Portal** \\> **Portal**. 2. Provide a link in your website/application which your authenticated customers can use to access the portal (For example, `{your_website_url}/portal_link`). 3. Handle the link request in your server code and create a portal session for the customer by calling Chargebee's "Create a portal session" API 4. Forward the user to the access URL present in the "Portal Session" resource returned by the above API call. **Notes about access URL:** \* The access URL should be accessed by the customer within one hour from the time it was created. \* Once accessed, the session is valid until the user logs out from the portal UI or logout API is called from your application for this session. \* Once accessed, the access url cannot be reused. Hence do not persist this URL. Whenever you need to provide access to the portal, you need to create a new portal session. Using Chargebee's authentication **Note:** This feature is not supported in [in-app](https://www.chargebee.com/docs/inapp-self-serve-portal.html) portal. Chargebee allows you to integrate your website by building user authentication on top of Chargebee. You can also use the portal login to provide authenticated access for your customers to your website pages. **Workflow:** Users should be redirected to the portal login URL - **[https://yourdomain.chargebeeportal.com/portal/login](https://yourdomain.chargebeeportal.com/portal/login)** by passing the following parameters: \* **return\_url** - URL the users should be redirected to upon successful authentication. \* **cancel\_url** - URL the users should be redirected to when they want to go back to your website during login. The domain name used in the Return/Cancel URL should be added as a 'Whitelisted Domain' in Chargebee. Add just the domain name in Chargebee and not the entire URL: E.g. yourdomain.com. Upon successful authentication, a session is created for the user and Chargebee redirects the user to the return\_url along with the following parameters: \* **auth\_session\_id** - Identifier to the authenticated session. \* **auth\_session\_token** - Token for the session which should be sent later to activate this session. Using the **auth\_session\_id** \\& **auth\_session\_token** , you should call [Activate a Portal Session](https://docs.corsair.dev/docs/api/portal_sessions/activate-a-portal-session) API to validate the session details and create a session for that user in your website. **Note:** The process of setting up the portal account will take place along with the authentication process. Scheduled subscription changes \* When [Ramps](ramps) are disabled, the customer can view and edit the single scheduled change if it exists. \* When [Ramps](ramps) are enabled with compatibility mode: \* The customer can view and edit the first ramp if it exists. \* If they edit the subscription, the impacts are the same as those described in the documentation for [`changes_scheduled_at`](subscriptions#update_subscription_for_items_changes_scheduled_at) parameter in the Update subscription API. For more details, see [Ramps API compatibility mode](subscriptions#ramps-compat-mode). |

> [accordion] portal\_session full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   token?: string | null,
>   access_url?: string | null,
>   redirect_url?: string | null,
>   status?: string | null,
>   created_at?: number | null,
>   expires_at?: number | null,
>   customer_id?: string | null,
>   login_at?: number | null,
>   logout_at?: number | null,
>   login_ipaddress?: string | null,
>   logout_ipaddress?: string | null,
>   linked_customers?: {
>     customer_id?: string | null,
>     email?: string | null,
>     has_billing_address?: boolean | null,
>     has_payment_method?: boolean | null,
>     has_active_subscription?: boolean | null
>   }[] | null
> } | null
> ```

***

### get

`portalSessions.get`

Retrieve a portal session. This API retrieves a portal session using portal\_session\_id as a path parameter.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.portalSessions.get({ portalSessionId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `portalSessionId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `portal_session` | `object \| null` | No | Customer Portal lets your customers to manage their account and billing themselves. Chargebee supports Single Sign-on (SSO) to access the customer portal. If you already have your own authentication for your website, it allows your authenticated customers to access their portal without having to login again. **Note:** You can instead allow your customers to access the portal via login page provided by Chargebee. [Read more](https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html). Please follow the below steps for supporting portal access via SSO: 1. To enable the "Allow access to customer portal via API", click **Settings** \\> **Configure Chargebee** \\> **Customer Facing Essentials** \\> **Checkout and Self Serve Portal** \\> **Portal**. 2. Provide a link in your website/application which your authenticated customers can use to access the portal (For example, `{your_website_url}/portal_link`). 3. Handle the link request in your server code and create a portal session for the customer by calling Chargebee's "Create a portal session" API 4. Forward the user to the access URL present in the "Portal Session" resource returned by the above API call. **Notes about access URL:** \* The access URL should be accessed by the customer within one hour from the time it was created. \* Once accessed, the session is valid until the user logs out from the portal UI or logout API is called from your application for this session. \* Once accessed, the access url cannot be reused. Hence do not persist this URL. Whenever you need to provide access to the portal, you need to create a new portal session. Using Chargebee's authentication **Note:** This feature is not supported in [in-app](https://www.chargebee.com/docs/inapp-self-serve-portal.html) portal. Chargebee allows you to integrate your website by building user authentication on top of Chargebee. You can also use the portal login to provide authenticated access for your customers to your website pages. **Workflow:** Users should be redirected to the portal login URL - **[https://yourdomain.chargebeeportal.com/portal/login](https://yourdomain.chargebeeportal.com/portal/login)** by passing the following parameters: \* **return\_url** - URL the users should be redirected to upon successful authentication. \* **cancel\_url** - URL the users should be redirected to when they want to go back to your website during login. The domain name used in the Return/Cancel URL should be added as a 'Whitelisted Domain' in Chargebee. Add just the domain name in Chargebee and not the entire URL: E.g. yourdomain.com. Upon successful authentication, a session is created for the user and Chargebee redirects the user to the return\_url along with the following parameters: \* **auth\_session\_id** - Identifier to the authenticated session. \* **auth\_session\_token** - Token for the session which should be sent later to activate this session. Using the **auth\_session\_id** \\& **auth\_session\_token** , you should call [Activate a Portal Session](https://docs.corsair.dev/docs/api/portal_sessions/activate-a-portal-session) API to validate the session details and create a session for that user in your website. **Note:** The process of setting up the portal account will take place along with the authentication process. Scheduled subscription changes \* When [Ramps](ramps) are disabled, the customer can view and edit the single scheduled change if it exists. \* When [Ramps](ramps) are enabled with compatibility mode: \* The customer can view and edit the first ramp if it exists. \* If they edit the subscription, the impacts are the same as those described in the documentation for [`changes_scheduled_at`](subscriptions#update_subscription_for_items_changes_scheduled_at) parameter in the Update subscription API. For more details, see [Ramps API compatibility mode](subscriptions#ramps-compat-mode). |

> [accordion] portal\_session full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   token?: string | null,
>   access_url?: string | null,
>   redirect_url?: string | null,
>   status?: string | null,
>   created_at?: number | null,
>   expires_at?: number | null,
>   customer_id?: string | null,
>   login_at?: number | null,
>   logout_at?: number | null,
>   login_ipaddress?: string | null,
>   logout_ipaddress?: string | null,
>   linked_customers?: {
>     customer_id?: string | null,
>     email?: string | null,
>     has_billing_address?: boolean | null,
>     has_payment_method?: boolean | null,
>     has_active_subscription?: boolean | null
>   }[] | null
> } | null
> ```

***

### logout

`portalSessions.logout`

Logout a portal session. Logs out the portal session. Typically this should be called when customers logout of your application. If this API is called for a Portal Session that currently is in : \* "created" status, the session status will be marked as "logged\_out" and the access URL will become invalid.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.portalSessions.logout({ portalSessionId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `portalSessionId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `portal_session` | `object \| null` | No | Customer Portal lets your customers to manage their account and billing themselves. Chargebee supports Single Sign-on (SSO) to access the customer portal. If you already have your own authentication for your website, it allows your authenticated customers to access their portal without having to login again. **Note:** You can instead allow your customers to access the portal via login page provided by Chargebee. [Read more](https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html). Please follow the below steps for supporting portal access via SSO: 1. To enable the "Allow access to customer portal via API", click **Settings** \\> **Configure Chargebee** \\> **Customer Facing Essentials** \\> **Checkout and Self Serve Portal** \\> **Portal**. 2. Provide a link in your website/application which your authenticated customers can use to access the portal (For example, `{your_website_url}/portal_link`). 3. Handle the link request in your server code and create a portal session for the customer by calling Chargebee's "Create a portal session" API 4. Forward the user to the access URL present in the "Portal Session" resource returned by the above API call. **Notes about access URL:** \* The access URL should be accessed by the customer within one hour from the time it was created. \* Once accessed, the session is valid until the user logs out from the portal UI or logout API is called from your application for this session. \* Once accessed, the access url cannot be reused. Hence do not persist this URL. Whenever you need to provide access to the portal, you need to create a new portal session. Using Chargebee's authentication **Note:** This feature is not supported in [in-app](https://www.chargebee.com/docs/inapp-self-serve-portal.html) portal. Chargebee allows you to integrate your website by building user authentication on top of Chargebee. You can also use the portal login to provide authenticated access for your customers to your website pages. **Workflow:** Users should be redirected to the portal login URL - **[https://yourdomain.chargebeeportal.com/portal/login](https://yourdomain.chargebeeportal.com/portal/login)** by passing the following parameters: \* **return\_url** - URL the users should be redirected to upon successful authentication. \* **cancel\_url** - URL the users should be redirected to when they want to go back to your website during login. The domain name used in the Return/Cancel URL should be added as a 'Whitelisted Domain' in Chargebee. Add just the domain name in Chargebee and not the entire URL: E.g. yourdomain.com. Upon successful authentication, a session is created for the user and Chargebee redirects the user to the return\_url along with the following parameters: \* **auth\_session\_id** - Identifier to the authenticated session. \* **auth\_session\_token** - Token for the session which should be sent later to activate this session. Using the **auth\_session\_id** \\& **auth\_session\_token** , you should call [Activate a Portal Session](https://docs.corsair.dev/docs/api/portal_sessions/activate-a-portal-session) API to validate the session details and create a session for that user in your website. **Note:** The process of setting up the portal account will take place along with the authentication process. Scheduled subscription changes \* When [Ramps](ramps) are disabled, the customer can view and edit the single scheduled change if it exists. \* When [Ramps](ramps) are enabled with compatibility mode: \* The customer can view and edit the first ramp if it exists. \* If they edit the subscription, the impacts are the same as those described in the documentation for [`changes_scheduled_at`](subscriptions#update_subscription_for_items_changes_scheduled_at) parameter in the Update subscription API. For more details, see [Ramps API compatibility mode](subscriptions#ramps-compat-mode). |

> [accordion] portal\_session full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   token?: string | null,
>   access_url?: string | null,
>   redirect_url?: string | null,
>   status?: string | null,
>   created_at?: number | null,
>   expires_at?: number | null,
>   customer_id?: string | null,
>   login_at?: number | null,
>   logout_at?: number | null,
>   login_ipaddress?: string | null,
>   logout_ipaddress?: string | null,
>   linked_customers?: {
>     customer_id?: string | null,
>     email?: string | null,
>     has_billing_address?: boolean | null,
>     has_payment_method?: boolean | null,
>     has_active_subscription?: boolean | null
>   }[] | null
> } | null
> ```

***

## Price Ramps

### create

`priceRamps.create`

Create a price ramp. Creates a price ramp for an item price. Use this operation to schedule how the item price changes across a subscription's billing cycles by defining an ordered set of ramp\_intervals.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.priceRamps.create({ item_price_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `item_price_id` | `string` | Yes | The ID of the [item price](https://docs.corsair.dev/docs/api/item_prices) for which the price ramp is created. The price defined by the ramp intervals overrides the catalog price of this item price for the applicable billing cycles. |
| `business_entity_id` | `string` | No | The unique ID of the [business entity](https://docs.corsair.dev/docs/api/business_entities) for this `price_ramp`. This is applicable only when multiple business entities have been created for the site. When provided, the operation will read or write data associated with the specified business entity. If not provided, the resource will be created at the site level, and the business\_entity\_id will not be included in the API response. **Note** : An alternative way of passing this parameter is by using a [custom HTTP header](https://docs.corsair.dev/docs/api/advanced-features) or [query string parameter](https://docs.corsair.dev/docs/api/advanced-features#mbe-alternative). |
| `ramp_intervals` | `object` | No | The ordered list of intervals that make up the price ramp. Each interval defines the price that applies for a contiguous range of billing cycles. Intervals must be contiguous and ordered by `starting_billing_cycle`, with the first interval starting at billing cycle `1`. Adjacent intervals with the same pricing are merged before the ramp is saved. At least 2 intervals must remain after the merge. Up to 3 intervals. |

> [accordion] ramp\_intervals full type
>
> ```ts theme={null}
> {
>   starting_billing_cycle: number[],
>   ending_billing_cycle?: number[],
>   apply_catalog_price?: boolean[],
>   price?: number[],
>   price_in_decimal?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `price_ramp` | `object \| null` | No | Price ramp resource lets you define a stepped pricing schedule on an [item price](https://docs.corsair.dev/docs/api/item_prices) in the Product Catalog. Each ramp is an ordered list of `ramp_intervals` that set the price for contiguous ranges of billing cycles, so new subscriptions inherit introductory or stepped pricing without custom per-subscription logic. Here's an example to show how you can use ramp pricing: A media streaming company offers a **Basic** monthly plan with a catalog price of $9.99. To grow acquisitions, they configure a price ramp so new subscribers start on an introductory price, then step up to full price. \|----------\|--------------\|---------------\|-------------------\| \| **Plan** \| **Currency** \| **Frequency** \| **Catalog price** \| \| Basic \| USD \| Monthly \| $9.99 \| \|--------------------\|-------------------\|-------------------------\| \| **Billing cycles** \| **Price charged** \| **Price type** \| \| Month 1 \| $0.99 \| Introductory ramp price \| \| Months 2--4 \| $4.99 \| Introductory ramp price \| \| Month 5 onwards \| $9.99 \| Catalog price \| Every new subscription on this Basic USD Monthly item price inherits the ramp automatically. In this example the final interval uses the catalog price, so the subscriber stays on $9.99 from month 5 onward. The catalog price continues only when that final interval sets `apply_catalog_price` to `true`. A final interval that sets `price` and omits `ending_billing_cycle` keeps that fixed price for the remaining billing cycles. An interval that uses the item price's catalog price returns `apply_catalog_price` as `true`. The resolved price for every interval is always available in `price` (in the [minor unit of the currency](https://docs.corsair.dev/docs/api/currencies)) and, when [multi-decimal pricing](https://docs.corsair.dev/docs/api/currencies) is enabled, in `price_in_decimal`. When a price ramp is linked to an item price, the `price_ramp_id` is exposed on the corresponding [item price](https://docs.corsair.dev/docs/api/item_prices) object. **See also:** For a more detailed understanding of Price Ramps, including how to configure and manage them, as well as their impact on other features, follow these resources: \* [Price Ramps](https://www.chargebee.com/docs/billing/2.0/product-catalog/price-ramps) \* [Configuring a Price Ramp](https://www.chargebee.com/docs/billing/2.0/product-catalog/price-ramps-configure) \* [How Ramp Pricing works with Create Subscription](https://www.chargebee.com/docs/billing/2.0/product-catalog/price-ramps-create-subscription) \* [How Ramp Pricing works with Hosted Checkout](https://www.chargebee.com/docs/billing/2.0/product-catalog/price-ramps-hosted-checkout) |

> [accordion] price\_ramp full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   item_price_id?: string | null,
>   status?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   archived_at?: number | null,
>   business_entity_id?: string | null,
>   ramp_intervals?: {
>     starting_billing_cycle?: number | null,
>     ending_billing_cycle?: number | null,
>     apply_catalog_price?: boolean | null,
>     price?: number | null,
>     price_in_decimal?: string | null
>   }[] | null
> } | null
> ```

***

### delete

`priceRamps.delete`

Delete a price ramp. Deletes a price ramp. Its status is set to deleted and the linked item price's price\_ramp\_id is cleared, so new subscriptions no longer inherit the ramp and a new ramp can be created for the item price. Subscriptions that already captured the ramp keep that schedule.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.priceRamps.delete({ priceRampId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `priceRampId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `price_ramp` | `object \| null` | No | Price ramp resource lets you define a stepped pricing schedule on an [item price](https://docs.corsair.dev/docs/api/item_prices) in the Product Catalog. Each ramp is an ordered list of `ramp_intervals` that set the price for contiguous ranges of billing cycles, so new subscriptions inherit introductory or stepped pricing without custom per-subscription logic. Here's an example to show how you can use ramp pricing: A media streaming company offers a **Basic** monthly plan with a catalog price of $9.99. To grow acquisitions, they configure a price ramp so new subscribers start on an introductory price, then step up to full price. \|----------\|--------------\|---------------\|-------------------\| \| **Plan** \| **Currency** \| **Frequency** \| **Catalog price** \| \| Basic \| USD \| Monthly \| $9.99 \| \|--------------------\|-------------------\|-------------------------\| \| **Billing cycles** \| **Price charged** \| **Price type** \| \| Month 1 \| $0.99 \| Introductory ramp price \| \| Months 2--4 \| $4.99 \| Introductory ramp price \| \| Month 5 onwards \| $9.99 \| Catalog price \| Every new subscription on this Basic USD Monthly item price inherits the ramp automatically. In this example the final interval uses the catalog price, so the subscriber stays on $9.99 from month 5 onward. The catalog price continues only when that final interval sets `apply_catalog_price` to `true`. A final interval that sets `price` and omits `ending_billing_cycle` keeps that fixed price for the remaining billing cycles. An interval that uses the item price's catalog price returns `apply_catalog_price` as `true`. The resolved price for every interval is always available in `price` (in the [minor unit of the currency](https://docs.corsair.dev/docs/api/currencies)) and, when [multi-decimal pricing](https://docs.corsair.dev/docs/api/currencies) is enabled, in `price_in_decimal`. When a price ramp is linked to an item price, the `price_ramp_id` is exposed on the corresponding [item price](https://docs.corsair.dev/docs/api/item_prices) object. **See also:** For a more detailed understanding of Price Ramps, including how to configure and manage them, as well as their impact on other features, follow these resources: \* [Price Ramps](https://www.chargebee.com/docs/billing/2.0/product-catalog/price-ramps) \* [Configuring a Price Ramp](https://www.chargebee.com/docs/billing/2.0/product-catalog/price-ramps-configure) \* [How Ramp Pricing works with Create Subscription](https://www.chargebee.com/docs/billing/2.0/product-catalog/price-ramps-create-subscription) \* [How Ramp Pricing works with Hosted Checkout](https://www.chargebee.com/docs/billing/2.0/product-catalog/price-ramps-hosted-checkout) |

> [accordion] price\_ramp full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   item_price_id?: string | null,
>   status?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   archived_at?: number | null,
>   business_entity_id?: string | null,
>   ramp_intervals?: {
>     starting_billing_cycle?: number | null,
>     ending_billing_cycle?: number | null,
>     apply_catalog_price?: boolean | null,
>     price?: number | null,
>     price_in_decimal?: string | null
>   }[] | null
> } | null
> ```

***

### get

`priceRamps.get`

Retrieve a price ramp. Retrieves a price ramp using its unique ID, including its status and the ordered list of ramp\_intervals. ### Prerequisites & Constraints \* Price Ramps must be enabled for the site. Contact Chargebee Support to enable them. Until they are enabled, this operation returns API\_RESTRICTED.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.priceRamps.get({ priceRampId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `priceRampId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `price_ramp` | `object \| null` | No | Price ramp resource lets you define a stepped pricing schedule on an [item price](https://docs.corsair.dev/docs/api/item_prices) in the Product Catalog. Each ramp is an ordered list of `ramp_intervals` that set the price for contiguous ranges of billing cycles, so new subscriptions inherit introductory or stepped pricing without custom per-subscription logic. Here's an example to show how you can use ramp pricing: A media streaming company offers a **Basic** monthly plan with a catalog price of $9.99. To grow acquisitions, they configure a price ramp so new subscribers start on an introductory price, then step up to full price. \|----------\|--------------\|---------------\|-------------------\| \| **Plan** \| **Currency** \| **Frequency** \| **Catalog price** \| \| Basic \| USD \| Monthly \| $9.99 \| \|--------------------\|-------------------\|-------------------------\| \| **Billing cycles** \| **Price charged** \| **Price type** \| \| Month 1 \| $0.99 \| Introductory ramp price \| \| Months 2--4 \| $4.99 \| Introductory ramp price \| \| Month 5 onwards \| $9.99 \| Catalog price \| Every new subscription on this Basic USD Monthly item price inherits the ramp automatically. In this example the final interval uses the catalog price, so the subscriber stays on $9.99 from month 5 onward. The catalog price continues only when that final interval sets `apply_catalog_price` to `true`. A final interval that sets `price` and omits `ending_billing_cycle` keeps that fixed price for the remaining billing cycles. An interval that uses the item price's catalog price returns `apply_catalog_price` as `true`. The resolved price for every interval is always available in `price` (in the [minor unit of the currency](https://docs.corsair.dev/docs/api/currencies)) and, when [multi-decimal pricing](https://docs.corsair.dev/docs/api/currencies) is enabled, in `price_in_decimal`. When a price ramp is linked to an item price, the `price_ramp_id` is exposed on the corresponding [item price](https://docs.corsair.dev/docs/api/item_prices) object. **See also:** For a more detailed understanding of Price Ramps, including how to configure and manage them, as well as their impact on other features, follow these resources: \* [Price Ramps](https://www.chargebee.com/docs/billing/2.0/product-catalog/price-ramps) \* [Configuring a Price Ramp](https://www.chargebee.com/docs/billing/2.0/product-catalog/price-ramps-configure) \* [How Ramp Pricing works with Create Subscription](https://www.chargebee.com/docs/billing/2.0/product-catalog/price-ramps-create-subscription) \* [How Ramp Pricing works with Hosted Checkout](https://www.chargebee.com/docs/billing/2.0/product-catalog/price-ramps-hosted-checkout) |

> [accordion] price\_ramp full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   item_price_id?: string | null,
>   status?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   archived_at?: number | null,
>   business_entity_id?: string | null,
>   ramp_intervals?: {
>     starting_billing_cycle?: number | null,
>     ending_billing_cycle?: number | null,
>     apply_catalog_price?: boolean | null,
>     price?: number | null,
>     price_in_decimal?: string | null
>   }[] | null
> } | null
> ```

***

### list

`priceRamps.list`

List price ramps. Retrieves a list of price ramps for your site. You can filter the results by attributes such as id, item\_price\_id, status, and updated\_at, and sort them using sort\_by. Only active and archived price ramps are returned by this operation. deleted price ramps are not listed.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.priceRamps.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `id` | `object` | No | Filter price ramps based on their unique ID. **Supported operators :** is, is\_not, starts\_with, in, not\_in |
| `item_price_id` | `object` | No | Filter price ramps based on the [item price](https://docs.corsair.dev/docs/api/item_prices) they are linked to. **Supported operators :** is, is\_not, starts\_with, in, not\_in |
| `status` | `object` | No | Filter price ramps based on their `status`. Only `active` and `archived` price ramps are returned by this operation; `deleted` price ramps are not listed. **Supported operators :** is, is\_not, in, not\_in |
| `updated_at` | `object` | No | Filter price ramps based on the timestamp at which they were last updated. **Supported operators :** after, before, on, between |
| `business_entity_id` | `object` | No | Filter price ramps based on the [business entity](https://docs.corsair.dev/docs/api/business_entities) they belong to. **Supported operators :** is, is\_present |
| `include_site_level_resources` | `object` | No | optional, boolean filter Default value is `true`. To exclude site-level resources in [specific cases](https://docs.corsair.dev/docs/api/using_business_entity_filters_in_product_catalog_list_apis), set this parameter to `false`. Possible values are : *true, false* **Supported operators :** is **Example →** *include\_site\_level\_resources\\\[is\\] = "false"* |
| `sort_by` | `object` | No | Sorts the price ramps based on the specified attribute. **Supported attributes :** id, status, updated\_at **Supported sort-orders :** asc, desc |

> [accordion] id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] item\_price\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] status full type
>
> ```ts theme={null}
> {
>   is?: active | archived,
>   is_not?: active | archived,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] updated\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] business\_entity\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_present?: true | false
> }
> ```

> [accordion] include\_site\_level\_resources full type
>
> ```ts theme={null}
> {
>   is?: true | false
> }
> ```

> [accordion] sort\_by full type
>
> ```ts theme={null}
> {
>   asc?: id | status | updated_at,
>   desc?: id | status | updated_at
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   price_ramp?: {
>     id?: string | null,
>     item_price_id?: string | null,
>     status?: string | null,
>     created_at?: number | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     archived_at?: number | null,
>     business_entity_id?: string | null,
>     ramp_intervals?: {
>       starting_billing_cycle?: number | null,
>       ending_billing_cycle?: number | null,
>       apply_catalog_price?: boolean | null,
>       price?: number | null,
>       price_in_decimal?: string | null
>     }[] | null
>   } | null
> }[] | null
> ```

***

### update

`priceRamps.update`

Update a price ramp. Updates a price ramp. You can either change its status (to activate or archive it) or replace its ramp\_intervals. These two changes are mutually exclusive within a single request. When ramp\_intervals is provided, the existing intervals are replaced in full with the new ordered set.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.priceRamps.update({ priceRampId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `priceRampId` | `string` | Yes | — |
| `status` | `active \| archived` | No | The status to set for the price ramp. Use this to activate a ramp or archive it so that it no longer applies to the linked item price. `status` and `ramp_intervals` are mutually exclusive in a single request. \* active - Activates the price ramp so that its ramp intervals apply to the linked item price. \* archived - Archives the price ramp so that it no longer applies to the linked item price. |
| `ramp_intervals` | `object` | No | The new ordered list of intervals for the price ramp. When provided, this **replaces** the existing set of ramp intervals in full. Each interval must include `starting_billing_cycle`. Intervals must be contiguous and ordered by `starting_billing_cycle`, with the first interval starting at billing cycle `1`. Adjacent intervals with the same pricing are merged before the ramp is saved. At least 2 intervals must remain after the merge. Up to 3 intervals. `ramp_intervals` and `status` are mutually exclusive in a single request. |

> [accordion] ramp\_intervals full type
>
> ```ts theme={null}
> {
>   starting_billing_cycle: number[],
>   ending_billing_cycle?: number[],
>   apply_catalog_price?: boolean[],
>   price?: number[],
>   price_in_decimal?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `price_ramp` | `object \| null` | No | Price ramp resource lets you define a stepped pricing schedule on an [item price](https://docs.corsair.dev/docs/api/item_prices) in the Product Catalog. Each ramp is an ordered list of `ramp_intervals` that set the price for contiguous ranges of billing cycles, so new subscriptions inherit introductory or stepped pricing without custom per-subscription logic. Here's an example to show how you can use ramp pricing: A media streaming company offers a **Basic** monthly plan with a catalog price of $9.99. To grow acquisitions, they configure a price ramp so new subscribers start on an introductory price, then step up to full price. \|----------\|--------------\|---------------\|-------------------\| \| **Plan** \| **Currency** \| **Frequency** \| **Catalog price** \| \| Basic \| USD \| Monthly \| $9.99 \| \|--------------------\|-------------------\|-------------------------\| \| **Billing cycles** \| **Price charged** \| **Price type** \| \| Month 1 \| $0.99 \| Introductory ramp price \| \| Months 2--4 \| $4.99 \| Introductory ramp price \| \| Month 5 onwards \| $9.99 \| Catalog price \| Every new subscription on this Basic USD Monthly item price inherits the ramp automatically. In this example the final interval uses the catalog price, so the subscriber stays on $9.99 from month 5 onward. The catalog price continues only when that final interval sets `apply_catalog_price` to `true`. A final interval that sets `price` and omits `ending_billing_cycle` keeps that fixed price for the remaining billing cycles. An interval that uses the item price's catalog price returns `apply_catalog_price` as `true`. The resolved price for every interval is always available in `price` (in the [minor unit of the currency](https://docs.corsair.dev/docs/api/currencies)) and, when [multi-decimal pricing](https://docs.corsair.dev/docs/api/currencies) is enabled, in `price_in_decimal`. When a price ramp is linked to an item price, the `price_ramp_id` is exposed on the corresponding [item price](https://docs.corsair.dev/docs/api/item_prices) object. **See also:** For a more detailed understanding of Price Ramps, including how to configure and manage them, as well as their impact on other features, follow these resources: \* [Price Ramps](https://www.chargebee.com/docs/billing/2.0/product-catalog/price-ramps) \* [Configuring a Price Ramp](https://www.chargebee.com/docs/billing/2.0/product-catalog/price-ramps-configure) \* [How Ramp Pricing works with Create Subscription](https://www.chargebee.com/docs/billing/2.0/product-catalog/price-ramps-create-subscription) \* [How Ramp Pricing works with Hosted Checkout](https://www.chargebee.com/docs/billing/2.0/product-catalog/price-ramps-hosted-checkout) |

> [accordion] price\_ramp full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   item_price_id?: string | null,
>   status?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   archived_at?: number | null,
>   business_entity_id?: string | null,
>   ramp_intervals?: {
>     starting_billing_cycle?: number | null,
>     ending_billing_cycle?: number | null,
>     apply_catalog_price?: boolean | null,
>     price?: number | null,
>     price_in_decimal?: string | null
>   }[] | null
> } | null
> ```

***

## Price Variants

### create

`priceVariants.create`

Create a price variant. This endpoint allows the creation of a new price variant that can be attached to item prices.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.priceVariants.create({ id: 'cust_8gsnbYfsMLds', name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `id` | `string` | Yes | The unique and immutable identifier of the price variant. |
| `name` | `string` | Yes | A unique name of the price variant. |
| `external_name` | `string` | No | A unique display name for the price variant. |
| `description` | `string` | No | Description of the price variant. |
| `variant_group` | `string` | No | The `variant_group` organizes similar [price\_variants](https://docs.corsair.dev/docs/api/price_variants) to optimize strategies such as bundling, geo-based pricing experiments, and campaign-specific pricing like `cb-atomic-pricing-` for effective grouping. The `variant_group` provides greater flexibility and precision in your pricing models. |
| `business_entity_id` | `string` | No | The unique ID of the [business entity](https://docs.corsair.dev/docs/api/business_entities) for this `price_variant`. This is applicable only when multiple business entities have been created for the site. When provided, the operation will read or write data associated with the specified business entity. If not provided, the resource will be created at the site level, and the `business_entity_id` will not be included in the API response. **Note** An alternative way of passing this parameter is by means of a [custom HTTP header](https://docs.corsair.dev/docs/api/advanced-features#mbe-header-main). |
| `attributes` | `object` | No | The list of price variant attribute values. Attributes can be used to store additional information about the price variant. For example, for a price variant called 'Germany', the attributes can be 'Country':'Germany', 'City':'Berlin' and so on. |

> [accordion] attributes full type
>
> ```ts theme={null}
> {
>   name: string[],
>   value: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `price_variant` | `object \| null` | No | Price variant resource offers businesses the flexibility to manage pricing for multiple variations of an [item](https://docs.corsair.dev/docs/api/items) (plan, addon, or charge) in the Product Catalog. It enables the creation of diverse pricing structures based on variables such as geography, partners, versions, and more. **See also:** For a more detailed understanding of Price Variants, including how to enable, configure, and manage them, as well as their impact on other features, follow these resources: \* [Price Variant Overview](https://www.chargebee.com/docs/2.0/variant-pricing-overview.html) \* [Enabling Price Variant](https://www.chargebee.com/docs/2.0/variant-pricing-enable.html) \* [Configuring Price Variant](https://www.chargebee.com/docs/2.0/variant-pricing-config.html) \* [Impacted Features by Price Variant](https://www.chargebee.com/docs/2.0/variant-pricing-impacted-features.html) |

> [accordion] price\_variant full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   external_name?: string | null,
>   variant_group?: string | null,
>   description?: string | null,
>   status?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   archived_at?: number | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null,
>   attributes?: {
>     name?: string | null,
>     value?: string | null
>   }[] | null
> } | null
> ```

***

### delete

`priceVariants.delete`

Delete a price variant. Deletes the price variant. This is not allowed if price variant is attached to any item price. Once deleted, the id and name of the price variant can be reused.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.priceVariants.delete({ priceVariantId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `priceVariantId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `price_variant` | `object \| null` | No | Price variant resource offers businesses the flexibility to manage pricing for multiple variations of an [item](https://docs.corsair.dev/docs/api/items) (plan, addon, or charge) in the Product Catalog. It enables the creation of diverse pricing structures based on variables such as geography, partners, versions, and more. **See also:** For a more detailed understanding of Price Variants, including how to enable, configure, and manage them, as well as their impact on other features, follow these resources: \* [Price Variant Overview](https://www.chargebee.com/docs/2.0/variant-pricing-overview.html) \* [Enabling Price Variant](https://www.chargebee.com/docs/2.0/variant-pricing-enable.html) \* [Configuring Price Variant](https://www.chargebee.com/docs/2.0/variant-pricing-config.html) \* [Impacted Features by Price Variant](https://www.chargebee.com/docs/2.0/variant-pricing-impacted-features.html) |

> [accordion] price\_variant full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   external_name?: string | null,
>   variant_group?: string | null,
>   description?: string | null,
>   status?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   archived_at?: number | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null,
>   attributes?: {
>     name?: string | null,
>     value?: string | null
>   }[] | null
> } | null
> ```

***

### get

`priceVariants.get`

Retrieve a price variant. This endpoint retrieves the details of a specific price variant using its unique identifier.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.priceVariants.get({ priceVariantId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `priceVariantId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `price_variant` | `object \| null` | No | Price variant resource offers businesses the flexibility to manage pricing for multiple variations of an [item](https://docs.corsair.dev/docs/api/items) (plan, addon, or charge) in the Product Catalog. It enables the creation of diverse pricing structures based on variables such as geography, partners, versions, and more. **See also:** For a more detailed understanding of Price Variants, including how to enable, configure, and manage them, as well as their impact on other features, follow these resources: \* [Price Variant Overview](https://www.chargebee.com/docs/2.0/variant-pricing-overview.html) \* [Enabling Price Variant](https://www.chargebee.com/docs/2.0/variant-pricing-enable.html) \* [Configuring Price Variant](https://www.chargebee.com/docs/2.0/variant-pricing-config.html) \* [Impacted Features by Price Variant](https://www.chargebee.com/docs/2.0/variant-pricing-impacted-features.html) |

> [accordion] price\_variant full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   external_name?: string | null,
>   variant_group?: string | null,
>   description?: string | null,
>   status?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   archived_at?: number | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null,
>   attributes?: {
>     name?: string | null,
>     value?: string | null
>   }[] | null
> } | null
> ```

***

### list

`priceVariants.list`

List price variants. This endpoint is used to retrieve a list of price variants.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.priceVariants.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `id` | `object` | No | optional, string filter Filter variant based on their [id](https://docs.corsair.dev/docs/api/price_variants) . **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *id\\\[is\\] = "basic"* |
| `name` | `object` | No | optional, string filter Filter variant based on their `name` s. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *name\\\[is\\] = "basic"* |
| `status` | `object` | No | optional, enumerated string filter Filter variant based on their `status`. Possible values are : active, archived. **Supported operators :** is, is\_not, in, not\_in **Example →** *status\\\[is\\] = "active"* |
| `updated_at` | `object` | No | optional, timestamp(UTC) in seconds filter Filter product based on their `updated time` . **Supported operators :** after, before, on, between **Example →** *updated\_at\\\[on\\] = "1243545465"* |
| `created_at` | `object` | No | optional, timestamp(UTC) in seconds filter Filter product based on their `created time` . **Supported operators :** after, before, on, between **Example →** *created\_at\\\[before\\] = "1243545465"* |
| `business_entity_id` | `object` | No | optional, string filter The unique ID of the [business entity](https://docs.corsair.dev/docs/api/business_entities) of this `price_variant`. [Learn more](https://docs.corsair.dev/docs/api/using_business_entity_filters_in_product_catalog_list_apis) about all the scenarios before using this filter. **Supported operators :** is, is\_present **Example →** *business\_entity\_id\\\[is\_present\\] = "true"* |
| `include_site_level_resources` | `object` | No | optional, boolean filter Default value is `true` . To exclude site-level resources in [specific cases](), set this parameter to `false`. Possible values are : *true, false* **Supported operators :** is **Example →** *include\_site\_level\_resources\\\[is\\] = "null"* |
| `sort_by` | `object` | No | optional, string filter Sorts based on the specified attribute. **Supported attributes :** name, id, status, created\_at, updated\_at **Supported sort-orders :** asc, desc **Example →** *sort\_by\\\[asc\\] = "name"* This will sort the result based on the 'name' attribute in ascending(earliest first) order. |

> [accordion] id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] name full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] status full type
>
> ```ts theme={null}
> {
>   is?: active | archived,
>   is_not?: active | archived,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] updated\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] created\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] business\_entity\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_present?: true | false
> }
> ```

> [accordion] include\_site\_level\_resources full type
>
> ```ts theme={null}
> {
>   is?: true | false
> }
> ```

> [accordion] sort\_by full type
>
> ```ts theme={null}
> {
>   asc?: name | id | status | created_at | updated_at,
>   desc?: name | id | status | created_at | updated_at
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   price_variant?: {
>     id?: string | null,
>     name?: string | null,
>     external_name?: string | null,
>     variant_group?: string | null,
>     description?: string | null,
>     status?: string | null,
>     created_at?: number | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     archived_at?: number | null,
>     business_entity_id?: string | null,
>     deleted?: boolean | null,
>     attributes?: {
>       name?: string | null,
>       value?: string | null
>     }[] | null
>   } | null
> }[] | null
> ```

***

### update

`priceVariants.update`

Update a price variant. This endpoint modifies the details of an existing price variant.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.priceVariants.update({ priceVariantId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `priceVariantId` | `string` | Yes | — |
| `name` | `string` | No | A unique name of the price variant. |
| `external_name` | `string` | No | A unique display name for the price variant. |
| `description` | `string` | No | Description of the price variant. |
| `variant_group` | `string` | No | The `variant_group` organizes similar [price\_variants](https://docs.corsair.dev/docs/api/price_variants) to optimize strategies such as bundling, geo-based pricing experiments, and campaign-specific pricing like `cb-atomic-pricing-` for effective grouping. The `variant_group` provides greater flexibility and precision in your pricing models. |
| `status` | `active \| archived` | No | Status of a price variant. \* active - Active price variant. This price variant can be attached to [item prices](https://docs.corsair.dev/docs/api/item_prices) . \* archived - Archived price variant. This price variant is no longer `active` and cannot be attached to new [item prices](https://docs.corsair.dev/docs/api/item_prices). Existing item prices that already have this price variant attached will continue to remain as is. |
| `attributes` | `object` | No | The list of price variant attribute values. Attributes can be used to store additional information about the price variant. For example, for a price variant called 'Germany', the attributes can be 'Country':'Germany', 'City':'Berlin' and so on. |

> [accordion] attributes full type
>
> ```ts theme={null}
> {
>   name: string[],
>   value: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `price_variant` | `object \| null` | No | Price variant resource offers businesses the flexibility to manage pricing for multiple variations of an [item](https://docs.corsair.dev/docs/api/items) (plan, addon, or charge) in the Product Catalog. It enables the creation of diverse pricing structures based on variables such as geography, partners, versions, and more. **See also:** For a more detailed understanding of Price Variants, including how to enable, configure, and manage them, as well as their impact on other features, follow these resources: \* [Price Variant Overview](https://www.chargebee.com/docs/2.0/variant-pricing-overview.html) \* [Enabling Price Variant](https://www.chargebee.com/docs/2.0/variant-pricing-enable.html) \* [Configuring Price Variant](https://www.chargebee.com/docs/2.0/variant-pricing-config.html) \* [Impacted Features by Price Variant](https://www.chargebee.com/docs/2.0/variant-pricing-impacted-features.html) |

> [accordion] price\_variant full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   external_name?: string | null,
>   variant_group?: string | null,
>   description?: string | null,
>   status?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   archived_at?: number | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null,
>   attributes?: {
>     name?: string | null,
>     value?: string | null
>   }[] | null
> } | null
> ```

***

## Pricing Page Sessions

### createForExistingSubscription

`pricingPageSessions.createForExistingSubscription`

Create pricing page for existing subscription. This endpoint streamlines the generation of a pricing page session to enable subscription upgrade , and downgrade workflows using Chargebee's hosted pricing pages (Atomic Pricing ). By providing a subscription ID as a parameter, you will obtain a hosted pricing page session URL.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.pricingPageSessions.createForExistingSubscription({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `redirect_url` | `string` | No | The customers will be redirected to this URL upon successful checkout. |
| `custom` | `object` | No | JSON object of custom attributes (key-value pairs) used for pricing page targeting or content. [Configure](https://www.chargebee.com/docs/retention/settings-and-installation/chargebee-retention-field-mappings) custom attributes in the dashboard. |
| `pricing_page` | `object` | No | Parameters for pricing page |
| `subscription` | `object` | No | Parameters for subscription |
| `contract_term` | `object` | No | Parameters for contract\_term |
| `discounts` | `object` | No | Parameters for discounts |

> [accordion] custom full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] pricing\_page full type
>
> ```ts theme={null}
> {
>   id?: string
> }
> ```

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id: string
> }
> ```

> [accordion] contract\_term full type
>
> ```ts theme={null}
> {
>   action_at_term_end?: renew | evergreen | cancel | renew_once,
>   cancellation_cutoff_period?: number
> }
> ```

> [accordion] discounts full type
>
> ```ts theme={null}
> {
>   apply_on?: (invoice_amount | specific_item_price)[],
>   duration_type: (one_time | forever | limited_period)[],
>   percentage?: number[],
>   amount?: number[],
>   period?: number[],
>   period_unit?: (day | week | month | year)[],
>   included_in_mrr?: boolean[],
>   item_price_id?: string[],
>   quantity?: number[],
>   label?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `pricing_page_session` | `object \| null` | No | The `pricing_page_session` resource allows you to create a pricing page that incorporates customer and subscription details. This page helps customers choose a plan, start a new subscription, or modify an existing one. Each session is distinct and has a limited duration, ensuring a unique and time-sensitive experience. |

> [accordion] pricing\_page\_session full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   url?: string | null,
>   created_at?: number | null,
>   expires_at?: number | null
> } | null
> ```

***

### createForNewSubscription

`pricingPageSessions.createForNewSubscription`

Create pricing page for new subscription. This endpoint streamlines the generation of a pricing page session to enable new subscription creation workflows using Chargebee's hosted pricing pages (Atomic Pricing ). By providing a subscription ID and/or customer ID as a parameter, you'll obtain a pricing page session URL.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.pricingPageSessions.createForNewSubscription({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `redirect_url` | `string` | No | The customers will be redirected to this URL upon successful checkout. |
| `business_entity_id` | `string` | No | Sets the [context](https://docs.corsair.dev/docs/api/business_entities) for this operation to the [business entity](https://docs.corsair.dev/docs/api/business_entities) specified. Applicable only when multiple business entities have been created for the site. When this parameter is provided, new subscription and customer resources are created within the business entity. |
| `brand_id` | `string` | No | The unique ID of the [brand](https://docs.corsair.dev/docs/api/brands) this pricing page session should be linked to. Applicable only when multiple brands have been created for the site. The customer and subscription created through the session are linked to the same brand. An alternative way of passing this parameter is by means of the `chargebee-brand-id` custom HTTP header; when both are provided, they must specify the same brand. **Default behavior** \* When not provided, the default brand defined for the site is used. |
| `auto_select_local_currency` | `boolean` | No | \* **`false`:** The first currency in the dropdown list is selected. \* **`true`:** Automatically determines the currency based on the visitor's geolocation. For example, if the visitor is from the United States and this flag is enabled, USD is selected as the currency-if it's available on the pricing page. Similarly, if the visitor is from India, INR is selected. If the visitor's country currency isn't available, the first currency in the dropdown list is selected. |
| `custom` | `object` | No | JSON object of custom attributes (key-value pairs) used for pricing page targeting or content. [Configure](https://www.chargebee.com/docs/retention/settings-and-installation/chargebee-retention-field-mappings) custom attributes in the dashboard. |
| `pricing_page` | `object` | No | Parameters for pricing page |
| `subscription` | `object` | No | Parameters for subscription |
| `customer` | `object` | No | Parameters for customer |
| `billing_address` | `object` | No | Parameters for billing\_address |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `contract_term` | `object` | No | Parameters for contract\_term |
| `discounts` | `object` | No | Parameters for discounts |

> [accordion] custom full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] pricing\_page full type
>
> ```ts theme={null}
> {
>   id?: string
> }
> ```

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id?: string
> }
> ```

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string,
>   email?: string,
>   first_name?: string,
>   last_name?: string,
>   company?: string,
>   phone?: string,
>   locale?: string
> }
> ```

> [accordion] billing\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] contract\_term full type
>
> ```ts theme={null}
> {
>   action_at_term_end?: renew | evergreen | cancel | renew_once,
>   cancellation_cutoff_period?: number
> }
> ```

> [accordion] discounts full type
>
> ```ts theme={null}
> {
>   apply_on?: (invoice_amount | specific_item_price)[],
>   duration_type: (one_time | forever | limited_period)[],
>   percentage?: number[],
>   amount?: number[],
>   period?: number[],
>   period_unit?: (day | week | month | year)[],
>   included_in_mrr?: boolean[],
>   item_price_id?: string[],
>   quantity?: number[],
>   label?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `pricing_page_session` | `object \| null` | No | The `pricing_page_session` resource allows you to create a pricing page that incorporates customer and subscription details. This page helps customers choose a plan, start a new subscription, or modify an existing one. Each session is distinct and has a limited duration, ensuring a unique and time-sensitive experience. |

> [accordion] pricing\_page\_session full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   url?: string | null,
>   created_at?: number | null,
>   expires_at?: number | null
> } | null
> ```

***

## Products

### create

`products.create`

Create a product. This API creates a new product.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.products.create({ external_name: 'example', name: 'example', status: 'active' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `name` | `string` | Yes | A unique internal name for the product. This is only visible in Chargebee. |
| `external_name` | `string` | Yes | The unique name that appears to the end user for each product. |
| `status` | `active \| inactive` | Yes | Status of the product. \* active - The active products are visible on the storefront, subscription, or checkout. \* inactive - The inactive products are not visible on the storefront, subscription, or checkout. |
| `id` | `string` | No | The immutable unique identifier of the product. If not passed, it will get autogenerated. |
| `description` | `string` | No | Description of the product. |
| `sku` | `string` | No | A unique identifier code a seller assigns to each product or item. Retailers and merchants use SKUs to keep track of inventory and sales data and help organize products within a store or warehouse. SKUs can include a combination of letters, numbers, and symbols and can vary in length depending on the seller's needs. |
| `metadata` | `object` | No | A collection of key-value pairs that provides extra information about the product. **Note:** There's a character limit of 65,535. [Learn more](https://docs.corsair.dev/docs/api/advanced-features#metadata) . |
| `shippable` | `boolean` | No | Whether a product is shippable or not. Pass the value as `true` if it is a shippable physical product, else pass the value as `false` . |

> [accordion] metadata full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `product` | `object \| null` | No | Products are offerings that can be sold to customers either as one-time purchases or as recurring subscriptions. These products could include physical items, digital goods, or services that are delivered over a period of time. Chargebee's API allows developers to interact with and manipulate product data, enabling businesses to seamlessly integrate their product offerings into their subscription management workflows. |

> [accordion] product full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   external_name?: string | null,
>   description?: string | null,
>   has_variant?: boolean | null,
>   status?: string | null,
>   shippable?: boolean | null,
>   sku?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   deleted?: boolean | null,
>   metadata?: {
>   } | null,
>   options?: {
>     id?: string | null,
>     name?: string | null,
>     values?: any[] | null,
>     default_value?: string | null,
>     type?: string | null
>   }[] | null
> } | null
> ```

***

### createVariant

`products.createVariant`

Create a product variant. This API is used for creating a new product variant. The following table will help you to understand the state of the variant status after passing status value during variant creation. \* Parameter Value column holds possible inputs to the variant.status.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.products.createVariant({ productId: 'example', name: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `productId` | `string` | Yes | — |
| `id` | `string` | No | The immutable unique identifier of a product variant. If not passed, it will get autogenerated. |
| `name` | `string` | Yes | This is a unique name that appears for each product variant to the end user. |
| `external_name` | `string` | No | The unique name that appears for each product variant to the end user. |
| `description` | `string` | No | A detailed description of this product variant. |
| `sku` | `string` | No | A unique identifier code a seller assigns to each product variant. Retailers and merchants use SKUs to keep track of inventory and sales data and help organize products within a store or warehouse. SKUs can include a combination of letters, numbers, and symbols and can vary in length depending on the seller's needs. |
| `metadata` | `object` | No | A collection of key-value pairs that provides extra information about the product. **Note:** There's a character limit of 65,535. [Learn more](https://docs.corsair.dev/docs/api/advanced-features#metadata) . |
| `status` | `active \| inactive` | No | Status of the product variant. Refer to the [table](https://docs.corsair.dev/docs/api/variants/create-a-product-variant) for more information. \* active - The active product variants are visible on the storefront, subscription, or checkout. \* inactive - The inactive product variants are not visible on the storefront, subscription, or checkout. |
| `option_values` | `object` | No | List of product variants option values. |

> [accordion] metadata full type
>
> ```ts theme={null}
> {
> }
> ```

> [accordion] option\_values full type
>
> ```ts theme={null}
> {
>   name: string[],
>   value: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `variant` | `object \| null` | No | A product variant is a specific product version with a unique combination of product option values. |

> [accordion] variant full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   external_name?: string | null,
>   description?: string | null,
>   sku?: string | null,
>   deleted?: boolean | null,
>   product_id?: string | null,
>   status?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   metadata?: {
>   } | null,
>   option_values?: {
>     name?: string | null,
>     value?: string | null
>   }[] | null
> } | null
> ```

***

### delete

`products.delete`

Delete a product. This API deletes a product and changes the delete attribute value to true . Deletion of a product is not allowed if there are active or archived variants under the product or if there are items mapped to the product. Once deleted, the name of the product can be reused.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.products.delete({ productId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `productId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `product` | `object \| null` | No | Products are offerings that can be sold to customers either as one-time purchases or as recurring subscriptions. These products could include physical items, digital goods, or services that are delivered over a period of time. Chargebee's API allows developers to interact with and manipulate product data, enabling businesses to seamlessly integrate their product offerings into their subscription management workflows. |

> [accordion] product full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   external_name?: string | null,
>   description?: string | null,
>   has_variant?: boolean | null,
>   status?: string | null,
>   shippable?: boolean | null,
>   sku?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   deleted?: boolean | null,
>   metadata?: {
>   } | null,
>   options?: {
>     id?: string | null,
>     name?: string | null,
>     values?: any[] | null,
>     default_value?: string | null,
>     type?: string | null
>   }[] | null
> } | null
> ```

***

### get

`products.get`

Retrieve a product. using product\_id . (GET /products/\{product-id})

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.products.get({ productId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `productId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `product` | `object \| null` | No | Products are offerings that can be sold to customers either as one-time purchases or as recurring subscriptions. These products could include physical items, digital goods, or services that are delivered over a period of time. Chargebee's API allows developers to interact with and manipulate product data, enabling businesses to seamlessly integrate their product offerings into their subscription management workflows. |

> [accordion] product full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   external_name?: string | null,
>   description?: string | null,
>   has_variant?: boolean | null,
>   status?: string | null,
>   shippable?: boolean | null,
>   sku?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   deleted?: boolean | null,
>   metadata?: {
>   } | null,
>   options?: {
>     id?: string | null,
>     name?: string | null,
>     values?: any[] | null,
>     default_value?: string | null,
>     type?: string | null
>   }[] | null
> } | null
> ```

***

### list

`products.list`

List products. This API retrieves the list of products that are active or inactive . Use include\_deleted parameter to include deleted products with active and inactive products.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.products.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `include_deleted` | `boolean` | No | If set to `true` , it includes the deleted products in the API response. |
| `id` | `object` | No | optional, string filter Filter product based on their [id](https://docs.corsair.dev/docs/api/products) . **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *id\\\[is\\] = "basic"* |
| `name` | `object` | No | optional, string filter Filter product based on their `name` s. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *name\\\[is\\] = "basic"* |
| `status` | `object` | No | optional, enumerated string filter Filter product based on their `status`. Possible values are : active, inactive. **Supported operators :** is, is\_not, in, not\_in **Example →** *status\\\[is\\] = "basic"* |
| `shippable` | `object` | No | optional, boolean filter Filter product based on whether it is shippable or not. Possible values are : *true, false* **Supported operators :** is **Example →** *shippable\\\[is\\] = "true"* |
| `has_variant` | `object` | No | optional, boolean filter Filter product based on whether it has variants or not. Possible values are : *true, false* **Supported operators :** is **Example →** *has\_variant\\\[is\\] = "true"* |
| `created_at` | `object` | No | optional, timestamp(UTC) in seconds filter Filter product based on their `created time` . **Supported operators :** after, before, on, between **Example →** *created\_at\\\[after\\] = "1243545465"* |
| `updated_at` | `object` | No | optional, timestamp(UTC) in seconds filter Filter product based on their `updated time` . **Supported operators :** after, before, on, between **Example →** *updated\_at\\\[after\\] = "1243545465"* |
| `sort_by` | `object` | No | optional, string filter Sorts based on the specified attribute. **Supported attributes :** name, id, created\_at, updated\_at **Supported sort-orders :** asc, desc **Example →** *sort\_by\\\[asc\\] = "name"* This will sort the result based on the 'name' attribute in ascending(earliest first) order. |

> [accordion] id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] name full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] status full type
>
> ```ts theme={null}
> {
>   is?: active | inactive,
>   is_not?: active | inactive,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] shippable full type
>
> ```ts theme={null}
> {
>   is?: true | false
> }
> ```

> [accordion] has\_variant full type
>
> ```ts theme={null}
> {
>   is?: true | false
> }
> ```

> [accordion] created\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] updated\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] sort\_by full type
>
> ```ts theme={null}
> {
>   asc?: name | id | created_at | updated_at,
>   desc?: name | id | created_at | updated_at
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   product?: {
>     id?: string | null,
>     name?: string | null,
>     external_name?: string | null,
>     description?: string | null,
>     has_variant?: boolean | null,
>     status?: string | null,
>     shippable?: boolean | null,
>     sku?: string | null,
>     created_at?: number | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     deleted?: boolean | null,
>     metadata?: {
>     } | null,
>     options?: {
>       id?: string | null,
>       name?: string | null,
>       values?: any[] | null,
>       default_value?: string | null,
>       type?: string | null
>     }[] | null
>   } | null
> }[] | null
> ```

***

### listVariants

`products.listVariants`

List product variants. This API retrieves the list of product variants.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.products.listVariants({ productId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `productId` | `string` | Yes | — |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `include_deleted` | `boolean` | No | If set to `true` , it includes the deleted variants in the API response. |
| `id` | `object` | No | optional, string filter Filter variant based on their [id](https://docs.corsair.dev/docs/api/variants) . **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *id\\\[is\_not\\] = "basic"* |
| `name` | `object` | No | optional, string filter Filter variant based on their `name` s. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *name\\\[is\\] = "basic"* |
| `sku` | `object` | No | optional, string filter Filter variant based on their `sku` . **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *sku\\\[is\\] = "basic"* |
| `status` | `object` | No | optional, enumerated string filter Filter variant based on their `status`. Possible values are : active, inactive. **Supported operators :** is, is\_not, in, not\_in **Example →** *status\\\[is\\] = "active"* |
| `updated_at` | `object` | No | optional, timestamp(UTC) in seconds filter Filter product based on their `updated time` . **Supported operators :** after, before, on, between **Example →** *updated\_at\\\[before\\] = "basic"* |
| `created_at` | `object` | No | optional, timestamp(UTC) in seconds filter Filter product based on their `created time` . **Supported operators :** after, before, on, between **Example →** *created\_at\\\[before\\] = "basic"* |
| `sort_by` | `object` | No | optional, string filter Sorts based on the specified attribute. **Supported attributes :** name, id, status, created\_at, updated\_at **Supported sort-orders :** asc, desc **Example →** *sort\_by\\\[asc\\] = "name"* This will sort the result based on the 'name' attribute in ascending(earliest first) order. |

> [accordion] id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] name full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] sku full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] status full type
>
> ```ts theme={null}
> {
>   is?: active | inactive,
>   is_not?: active | inactive,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] updated\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] created\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] sort\_by full type
>
> ```ts theme={null}
> {
>   asc?: name | id | status | created_at | updated_at,
>   desc?: name | id | status | created_at | updated_at
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   variant?: {
>     id?: string | null,
>     name?: string | null,
>     external_name?: string | null,
>     description?: string | null,
>     sku?: string | null,
>     deleted?: boolean | null,
>     product_id?: string | null,
>     status?: string | null,
>     created_at?: number | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     metadata?: {
>     } | null,
>     option_values?: {
>       name?: string | null,
>       value?: string | null
>     }[] | null
>   } | null
> }[] | null
> ```

***

### update

`products.update`

Update a product. This API allows you to update specific product details. The following table will help you to understand the status of the mapped item and item\_price after passing product status value during product updation.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.products.update({ productId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `productId` | `string` | Yes | — |
| `name` | `string` | No | A unique internal name for the product. This is only visible in Chargebee. |
| `external_name` | `string` | No | The unique name that appears for each product to the end user. |
| `description` | `string` | No | Description of the product. |
| `status` | `active \| inactive` | No | Status of the product. Refer to the [table](https://docs.corsair.dev/docs/api/products/update-a-product) for more information. \* active - The active products are visible on the storefront, subscription, or checkout. \* inactive - The inactive products are not visible on the storefront, subscription, or checkout. |
| `sku` | `string` | No | A unique identifier code a seller assigns to each product or item. Retailers and merchants use SKUs to keep track of inventory and sales data and help organize products within a store or warehouse. SKUs can include a combination of letters, numbers, and symbols and can vary in length depending on the seller's needs. |
| `shippable` | `boolean` | No | Whether a product is shippable or not. Pass the value as `true` if it is a shippable physical product, else pass the value as `false` . |
| `metadata` | `object` | No | A collection of key-value pairs that provides extra information about the product. **Note:** There's a character limit of 65,535. [Learn more](https://docs.corsair.dev/docs/api/advanced-features#metadata) . |

> [accordion] metadata full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `product` | `object \| null` | No | Products are offerings that can be sold to customers either as one-time purchases or as recurring subscriptions. These products could include physical items, digital goods, or services that are delivered over a period of time. Chargebee's API allows developers to interact with and manipulate product data, enabling businesses to seamlessly integrate their product offerings into their subscription management workflows. |

> [accordion] product full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   external_name?: string | null,
>   description?: string | null,
>   has_variant?: boolean | null,
>   status?: string | null,
>   shippable?: boolean | null,
>   sku?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   deleted?: boolean | null,
>   metadata?: {
>   } | null,
>   options?: {
>     id?: string | null,
>     name?: string | null,
>     values?: any[] | null,
>     default_value?: string | null,
>     type?: string | null
>   }[] | null
> } | null
> ```

***

### updateOptions

`products.updateOptions`

Add remove or update options for the product. This API allows you to add, remove, or update product options.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.products.updateOptions({ productId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `productId` | `string` | Yes | — |
| `remove_options` | `string[]` | No | List of options that you want to remove from the product. You can provide option names. |
| `options` | `object` | No | The list of options that you want to add when the `options[name]` are absent in a product, you can use this parameter to update the option values that already exist in a product. |

> [accordion] options full type
>
> ```ts theme={null}
> {
>   name: string[],
>   values?: any[][],
>   default_value?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `product` | `object \| null` | No | Products are offerings that can be sold to customers either as one-time purchases or as recurring subscriptions. These products could include physical items, digital goods, or services that are delivered over a period of time. Chargebee's API allows developers to interact with and manipulate product data, enabling businesses to seamlessly integrate their product offerings into their subscription management workflows. |

> [accordion] product full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   external_name?: string | null,
>   description?: string | null,
>   has_variant?: boolean | null,
>   status?: string | null,
>   shippable?: boolean | null,
>   sku?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   deleted?: boolean | null,
>   metadata?: {
>   } | null,
>   options?: {
>     id?: string | null,
>     name?: string | null,
>     values?: any[] | null,
>     default_value?: string | null,
>     type?: string | null
>   }[] | null
> } | null
> ```

***

## Promotional Credits

### add

`promotionalCredits.add`

Add promotional credits. This API call can be used to add promotional credits to a customer. Learn more about Promotional Credits. For example, if a customer has credits of $10, if you pass the amount as $10, then the customer's credit balance would become \$20.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.promotionalCredits.add({ customer_id: 'example', description: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customer_id` | `string` | Yes | Identifier of the customer. |
| `amount` | `number` | No | Promotional credits amount. |
| `amount_in_decimal` | `string` | No | Amount in decimal. |
| `currency_code` | `string` | No | The currency code (ISO 4217 format) for promotional credit. |
| `description` | `string` | Yes | Detailed description of this promotional credits. |
| `credit_type` | `loyalty_credits \| referral_rewards \| general` | No | Type of promotional credits provided to customer. \* general - General \* referral\_rewards - Referral \* loyalty\_credits - Loyalty Credits |
| `reference` | `string` | No | Describes why promotional credits were provided. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `promotional_credit` | `object \| null` | No | These credits can be provided to the customer for promoting the product. You can use Promotional Credits to offer referral bonuses, cash back offers and more. When a customer has promotional credits, it is automatically applied whenever a new invoice is created. |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] promotional\_credit full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   type?: string | null,
>   amount_in_decimal?: string | null,
>   amount?: number | null,
>   currency_code?: string | null,
>   description?: string | null,
>   credit_type?: string | null,
>   reference?: string | null,
>   closing_balance?: number | null,
>   done_by?: string | null,
>   created_at?: number | null,
>   business_entity_id?: string | null
> } | null
> ```

***

### deduct

`promotionalCredits.deduct`

Deduct promotional credits. This API call can be used to deduct promotional credits for a customer. Learn more about Promotional Credits. For example, if a customer has a credit balance of $20, if you pass the amount as $5, then the customer's credit balance would become \$15.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.promotionalCredits.deduct({ customer_id: 'example', description: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customer_id` | `string` | Yes | Identifier of the customer. |
| `amount` | `number` | No | Promotional credits amount. |
| `amount_in_decimal` | `string` | No | Amount in decimal. |
| `currency_code` | `string` | No | The currency code (ISO 4217 format) for promotional credit. |
| `description` | `string` | Yes | Detailed description of this promotional credits. |
| `credit_type` | `loyalty_credits \| referral_rewards \| general` | No | Type of promotional credits provided to customer. \* general - General \* referral\_rewards - Referral \* loyalty\_credits - Loyalty Credits |
| `reference` | `string` | No | Describes why promotional credits were provided. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `promotional_credit` | `object \| null` | No | These credits can be provided to the customer for promoting the product. You can use Promotional Credits to offer referral bonuses, cash back offers and more. When a customer has promotional credits, it is automatically applied whenever a new invoice is created. |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] promotional\_credit full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   type?: string | null,
>   amount_in_decimal?: string | null,
>   amount?: number | null,
>   currency_code?: string | null,
>   description?: string | null,
>   credit_type?: string | null,
>   reference?: string | null,
>   closing_balance?: number | null,
>   done_by?: string | null,
>   created_at?: number | null,
>   business_entity_id?: string | null
> } | null
> ```

***

### get

`promotionalCredits.get`

Retrieve a promotional credit. This endpoint retrieves the promotional credit based on the promotional credit id.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.promotionalCredits.get({ accountCreditId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `accountCreditId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `promotional_credit` | `object \| null` | No | These credits can be provided to the customer for promoting the product. You can use Promotional Credits to offer referral bonuses, cash back offers and more. When a customer has promotional credits, it is automatically applied whenever a new invoice is created. |

> [accordion] promotional\_credit full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   type?: string | null,
>   amount_in_decimal?: string | null,
>   amount?: number | null,
>   currency_code?: string | null,
>   description?: string | null,
>   credit_type?: string | null,
>   reference?: string | null,
>   closing_balance?: number | null,
>   done_by?: string | null,
>   created_at?: number | null,
>   business_entity_id?: string | null
> } | null
> ```

***

### list

`promotionalCredits.list`

List promotional credits. This endpoint lists the promotional credits set for a customer.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.promotionalCredits.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `id` | `object` | No | optional, string filter Unique reference ID provided for promotional credits. **Supported operators :** is, is\_not, starts\_with **Example →** *id\\\[is\\] = "1bkfc8dw2o"* |
| `created_at` | `object` | No | optional, timestamp(UTC) in seconds filter Timestamp indicating when this promotional credit resource is created. **Supported operators :** after, before, on, between **Example →** *created\_at\\\[on\\] = "1435054328"* |
| `type` | `object` | No | optional, enumerated string filter Type of promotional credits. Possible values are : increment, decrement. **Supported operators :** is, is\_not, in, not\_in **Example →** *type\\\[is\\] = "increment"* |
| `customer_id` | `object` | No | optional, string filter Identifier of the customer. **Supported operators :** is, is\_not, starts\_with **Example →** *customer\_id\\\[is\\] = "4gkYnd21ouvW"* |

> [accordion] id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string
> }
> ```

> [accordion] created\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] type full type
>
> ```ts theme={null}
> {
>   is?: increment | decrement,
>   is_not?: increment | decrement,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] customer\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   promotional_credit?: {
>     id?: string | null,
>     customer_id?: string | null,
>     type?: string | null,
>     amount_in_decimal?: string | null,
>     amount?: number | null,
>     currency_code?: string | null,
>     description?: string | null,
>     credit_type?: string | null,
>     reference?: string | null,
>     closing_balance?: number | null,
>     done_by?: string | null,
>     created_at?: number | null,
>     business_entity_id?: string | null
>   } | null
> }[] | null
> ```

***

### set

`promotionalCredits.set`

Set promotional credits. This API call can be used to set the promotional credits balance of a customer. Learn more about Promotional Credits. For example, \* If a customer has a credit balance of $10 and if you would like to set the balance to $100, you could pass the amount as \$100.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.promotionalCredits.set({ customer_id: 'example', description: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customer_id` | `string` | Yes | Identifier of the customer. |
| `amount` | `number` | No | Promotional credits amount. |
| `amount_in_decimal` | `string` | No | Amount in decimal. |
| `currency_code` | `string` | No | The currency code (ISO 4217 format) for promotional credit. |
| `description` | `string` | Yes | Detailed description of this promotional credits. |
| `credit_type` | `loyalty_credits \| referral_rewards \| general` | No | Type of promotional credits provided to customer. \* general - General \* referral\_rewards - Referral \* loyalty\_credits - Loyalty Credits |
| `reference` | `string` | No | Describes why promotional credits were provided. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `promotional_credit` | `object \| null` | No | These credits can be provided to the customer for promoting the product. You can use Promotional Credits to offer referral bonuses, cash back offers and more. When a customer has promotional credits, it is automatically applied whenever a new invoice is created. |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] promotional\_credit full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   type?: string | null,
>   amount_in_decimal?: string | null,
>   amount?: number | null,
>   currency_code?: string | null,
>   description?: string | null,
>   credit_type?: string | null,
>   reference?: string | null,
>   closing_balance?: number | null,
>   done_by?: string | null,
>   created_at?: number | null,
>   business_entity_id?: string | null
> } | null
> ```

***

## Promotional Grants

### create

`promotionalGrants.create`

Create Promotional Grant. (POST /promotional\_grants)

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.promotionalGrants.create({
	amount: 'example',
	expires_at: 1,
	subscription_id: 'example',
	unit_id: 'example',
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscription_id` | `string` | Yes | — |
| `unit_id` | `string` | Yes | — |
| `id` | `string` | No | — |
| `amount` | `string` | Yes | — |
| `effective_from` | `number` | No | — |
| `expires_at` | `number` | Yes | — |
| `metadata` | `object` | No | — |

> [accordion] metadata full type
>
> ```ts theme={null}
> {
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `ledger_operations` | `object[] \| null` | No | — |
| `grant_blocks` | `object[] \| null` | No | — |

> [accordion] ledger\_operations full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   subscription_id?: string | null,
>   unit_id?: string | null,
>   unit_type?: string | null,
>   type?: string | null,
>   amount?: string | null,
>   provisioned_start_balance?: string | null,
>   provisioned_end_balance?: string | null,
>   overdraft_start_balance?: string | null,
>   overdraft_end_balance?: string | null,
>   parent_ledger_operation_id?: string | null,
>   ledger_operation_timestamp?: number | null,
>   auto_release_timestamp?: number | null,
>   created_at?: number | null,
>   modified_at?: number | null,
>   metadata?: {
>   } | null
> }[] | null
> ```

> [accordion] grant\_blocks full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   subscription_id?: string | null,
>   unit_id?: string | null,
>   unit_type?: string | null,
>   account_type?: string | null,
>   effective_from?: number | null,
>   expires_at?: number | null,
>   origin_grant_block_id?: string | null,
>   status?: string | null,
>   grant_source?: string | null,
>   created_at?: number | null,
>   modified_at?: number | null,
>   resource_version?: number | null,
>   metadata?: {
>   } | null,
>   provisioned_block_balance?: {
>     granted_amount?: string | null,
>     total_balance?: string | null,
>     usable_balance?: string | null,
>     hold_amount?: string | null,
>     used_amount?: string | null,
>     expired_amount?: string | null,
>     rolled_over_amount?: string | null,
>     voided_amount?: string | null
>   } | null,
>   overdraft_block_balance?: {
>     is_unlimited?: boolean | null,
>     limit?: string | null,
>     total_balance?: string | null,
>     usable_balance?: string | null,
>     used_amount?: string | null
>   } | null,
>   billing_metadata?: {
>     item_price_id?: string | null,
>     line_items?: {
>       id?: string | null,
>       invoice_number?: string | null,
>       quantity?: number | null
>     }[] | null
>   } | null
> }[] | null
> ```

***

## Purchases

### create

`purchases.create`

Create a purchase. Creates a purchase resource. A purchase can contain one or more of the following: \* subscriptions (a subscription resource consists of item prices such that at least one of the item prices belongs to an item of type plan.) \* group of one-time charges (aka charge item prices) When you call this API,…

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.purchases.create({ customer_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customer_id` | `string` | Yes | The unique identifier of the [customer](https://docs.corsair.dev/docs/api/customers) that made this purchase. |
| `payment_source_id` | `string` | No | Payment source attached to this purchase. If present, the customer's payment sources won't be used to collect any payment for this purchase. |
| `replace_primary_payment_source` | `boolean` | No | Indicates whether the primary payment source is replaced with this payment source. If a `payment_intent` object is included in the request, `replace_primary` defaults to `true`. For all other cases, the default is `false` . |
| `invoice_info` | `object` | No | Parameters for invoice\_info |
| `payment_schedule` | `object` | No | Parameters for `payment_schedule` |
| `statement_descriptor` | `object` | No | Parameters for statement\_descriptor |
| `payment_intent` | `object` | No | Parameters for payment\_intent |
| `purchase_items` | `object` | No | Parameters for purchase\_items |
| `item_tiers` | `object` | No | Parameters for item\_tiers |
| `shipping_addresses` | `object` | No | Parameters for shipping\_addresses |
| `discounts` | `object` | No | Parameters for discounts |
| `subscription_info` | `object` | No | Parameters for subscription\_info |
| `contract_terms` | `object` | No | Parameters for contract\_terms |

> [accordion] invoice\_info full type
>
> ```ts theme={null}
> {
>   po_number?: string,
>   notes?: string
> }
> ```

> [accordion] payment\_schedule full type
>
> ```ts theme={null}
> {
>   scheme_id?: string,
>   amount?: number
> }
> ```

> [accordion] statement\_descriptor full type
>
> ```ts theme={null}
> {
>   descriptor?: string
> }
> ```

> [accordion] payment\_intent full type
>
> ```ts theme={null}
> {
>   id?: string,
>   gateway_account_id?: string,
>   gw_token?: string,
>   payment_method_type?: card | ideal | sofort | bancontact | google_pay | dotpay | giropay | apple_pay | upi | netbanking_emandates | paypal_express_checkout | direct_debit | boleto | venmo | amazon_payments | pay_to | faster_payments | sepa_instant_transfer | klarna_pay_now | online_banking_poland | payconiq_by_bancontact | electronic_payment_standard | kbc_payment_button | pay_by_bank | trustly | stablecoin | kakao_pay | naver_pay | revolut_pay | cash_app_pay | wechat_pay | alipay | twint | go_pay | grab_pay | pay_co | after_pay | swish | payme | pix | klarna | alipay_hk | paypay | gcash | south_korean_cards | paynow | bizum | promptpay | dana | touch_n_go | tamara | qpay | ovo | momo | mercado_pago | nequi | nupay | picpay | thai_qr | blik | fpx | wero | p24 | affirm_pay | rakuten_pay,
>   reference_id?: string,
>   additional_information?: {
>   }
> }
> ```

> [accordion] purchase\_items full type
>
> ```ts theme={null}
> {
>   index: number[],
>   item_price_id: string[],
>   quantity?: number[],
>   unit_amount?: number[],
>   unit_amount_in_decimal?: string[],
>   quantity_in_decimal?: string[],
>   trial_end?: number[]
> }
> ```

> [accordion] item\_tiers full type
>
> ```ts theme={null}
> {
>   index: number[],
>   item_price_id?: string[],
>   starting_unit?: number[],
>   ending_unit?: number[],
>   price?: number[],
>   starting_unit_in_decimal?: string[],
>   ending_unit_in_decimal?: string[],
>   price_in_decimal?: string[]
> }
> ```

> [accordion] shipping\_addresses full type
>
> ```ts theme={null}
> {
>   first_name?: string[],
>   last_name?: string[],
>   email?: string[],
>   company?: string[],
>   phone?: string[],
>   line1?: string[],
>   line2?: string[],
>   line3?: string[],
>   city?: string[],
>   state?: string[],
>   state_code?: string[],
>   country?: string[],
>   zip?: string[],
>   validation_status?: (not_validated | valid | partially_valid | invalid)[]
> }
> ```

> [accordion] discounts full type
>
> ```ts theme={null}
> {
>   index?: number[],
>   coupon_id?: string[],
>   percentage?: number[],
>   quantity?: number[],
>   amount?: number[],
>   included_in_mrr?: boolean[]
> }
> ```

> [accordion] subscription\_info full type
>
> ```ts theme={null}
> {
>   index: number[],
>   subscription_id?: string[],
>   billing_cycles?: number[],
>   contract_term_billing_cycle_on_renewal?: number[],
>   trial_end?: number[],
>   start_date?: number[],
>   meta_data?: {
>   }[]
> }
> ```

> [accordion] contract\_terms full type
>
> ```ts theme={null}
> {
>   index: number[],
>   action_at_term_end?: (renew | evergreen | cancel | renew_once)[],
>   cancellation_cutoff_period?: number[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `purchase` | `object \| null` | No | The `purchase` resource represents a collection of [item prices](https://docs.corsair.dev/docs/api/item_prices) bought together. A purchase can contain one or more of the following: \* subscriptions (a [subscription](https://docs.corsair.dev/docs/api/subscriptions) resource consists of item prices such that at least one of the item prices belongs to an [item](https://docs.corsair.dev/docs/api/items) of `type` `plan`.) \* group of one-time charges (aka [charge item prices](https://docs.corsair.dev/docs/api/item_prices)) **Prerequisite** Purchases must be enabled explicitly for the site. If not already enabled, contact [eap@chargebee.com](mailto:eap@chargebee.com). Purchases require the following features to work so they're automatically enabled along with them: \* [Consolidated Invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) \* [Manual discounts](https://www.chargebee.com/docs/2.0/subscription-manual-discounts.html) \* [Multiple coupon support](https://www.chargebee.com/docs/2.0/coupons.html#applying-multiple-coupons-to-a-subscription) \* [Multi-decimal pricing and quantities](https://www.chargebee.com/docs/2.0/multi-decimal-support.html) **Note** Once created, Chargebee never modifies a `purchase` resource; it cannot be modified via API either. Change the subscriptions it created with the [subscription](https://docs.corsair.dev/docs/api/subscriptions) operations. |

> [accordion] purchase full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   created_at?: number | null,
>   modified_at?: number | null,
>   subscription_ids?: string[] | null,
>   invoice_ids?: string[] | null
> } | null
> ```

***

### estimate

`purchases.estimate`

Estimates for purchase. Returns an estimate for creating a purchase resource. The operation works exactly like Create a purchase, except that only an estimate resource is returned without an actual purchase resource being created.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.purchases.estimate({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `client_profile_id` | `string` | No | 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. |
| `customer_id` | `string` | No | The unique identifier of the [customer](https://docs.corsair.dev/docs/api/customers) that made this purchase. |
| `customer` | `object` | No | Parameters for customer |
| `billing_address` | `object` | No | Parameters for billing\_address |
| `purchase_items` | `object` | No | Parameters for purchase\_items |
| `item_tiers` | `object` | No | Parameters for item\_tiers |
| `shipping_addresses` | `object` | No | Parameters for shipping\_addresses |
| `discounts` | `object` | No | Parameters for discounts |
| `subscription_info` | `object` | No | Parameters for subscription\_info |
| `contract_terms` | `object` | No | Parameters for contract\_terms |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   vat_number?: string,
>   vat_number_prefix?: string,
>   registered_for_gst?: boolean,
>   taxability?: taxable | exempt | zero_rated,
>   entity_code?: a | b | c | d | e | f | g | h | i | j | k | l | m | n | p | q | r | med1 | med2,
>   exempt_number?: string,
>   exemption_details?: any[],
>   customer_type?: residential | business | senior_citizen | industrial
> }
> ```

> [accordion] billing\_address full type
>
> ```ts theme={null}
> {
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] purchase\_items full type
>
> ```ts theme={null}
> {
>   index: number[],
>   item_price_id: string[],
>   quantity?: number[],
>   unit_amount?: number[],
>   unit_amount_in_decimal?: string[],
>   quantity_in_decimal?: string[],
>   trial_end?: number[]
> }
> ```

> [accordion] item\_tiers full type
>
> ```ts theme={null}
> {
>   index: number[],
>   item_price_id?: string[],
>   starting_unit?: number[],
>   ending_unit?: number[],
>   price?: number[],
>   starting_unit_in_decimal?: string[],
>   ending_unit_in_decimal?: string[],
>   price_in_decimal?: string[]
> }
> ```

> [accordion] shipping\_addresses full type
>
> ```ts theme={null}
> {
>   first_name?: string[],
>   last_name?: string[],
>   email?: string[],
>   company?: string[],
>   phone?: string[],
>   line1?: string[],
>   line2?: string[],
>   line3?: string[],
>   city?: string[],
>   state?: string[],
>   state_code?: string[],
>   country?: string[],
>   zip?: string[],
>   validation_status?: (not_validated | valid | partially_valid | invalid)[]
> }
> ```

> [accordion] discounts full type
>
> ```ts theme={null}
> {
>   index?: number[],
>   coupon_id?: string[],
>   percentage?: number[],
>   quantity?: number[],
>   amount?: number[],
>   included_in_mrr?: boolean[]
> }
> ```

> [accordion] subscription\_info full type
>
> ```ts theme={null}
> {
>   index: number[],
>   subscription_id?: string[],
>   billing_cycles?: number[],
>   contract_term_billing_cycle_on_renewal?: number[],
>   trial_end?: number[],
>   start_date?: number[]
> }
> ```

> [accordion] contract\_terms full type
>
> ```ts theme={null}
> {
>   index: number[],
>   action_at_term_end?: (renew | evergreen | cancel | renew_once)[],
>   cancellation_cutoff_period?: number[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `estimate` | `object \| null` | No | During the process of signing up customers to subscriptions, use the Estimates API to evaluate the details of the purchase before actually signing them up. The details returned by the API include the invoice amounts, next billing date and unbilled charges. For example, consider that you are creating a new subscription or update an existing one. Use the Estimates API before that to deduce the details such as the amount the customer would be charged, the state the subscription would be in after creation or updation, and so on. If you have configured the [Avalara integration](https://www.chargebee.com/docs/2.0/avalara.html), Chargebee retrieves the tax amount from Avalara for the invoice. This counts against your Avalara API limits. |

> [accordion] estimate full type
>
> ```ts theme={null}
> {
>   created_at?: number | null,
>   subscription_estimate?: {
>     id?: string | null,
>     currency_code?: string | null,
>     status?: string | null,
>     trial_end_action?: string | null,
>     next_billing_at?: number | null,
>     pause_date?: number | null,
>     resume_date?: number | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     contract_term?: {
>       id?: string | null,
>       status?: string | null,
>       contract_start?: number | null,
>       contract_end?: number | null,
>       billing_cycle?: number | null,
>       action_at_term_end?: string | null,
>       total_contract_value?: number | null,
>       total_contract_value_before_tax?: number | null,
>       cancellation_cutoff_period?: number | null,
>       created_at?: number | null,
>       subscription_id?: string | null,
>       remaining_billing_cycles?: number | null
>     } | null
>   } | null,
>   subscription_estimates?: {
>     id?: string | null,
>     currency_code?: string | null,
>     status?: string | null,
>     trial_end_action?: string | null,
>     next_billing_at?: number | null,
>     pause_date?: number | null,
>     resume_date?: number | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     contract_term?: {
>       id?: string | null,
>       status?: string | null,
>       contract_start?: number | null,
>       contract_end?: number | null,
>       billing_cycle?: number | null,
>       action_at_term_end?: string | null,
>       total_contract_value?: number | null,
>       total_contract_value_before_tax?: number | null,
>       cancellation_cutoff_period?: number | null,
>       created_at?: number | null,
>       subscription_id?: string | null,
>       remaining_billing_cycles?: number | null
>     } | null
>   }[] | null,
>   invoice_estimate?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   } | null,
>   invoice_estimates?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   }[] | null,
>   payment_schedule_estimates?: {
>     id?: string | null,
>     scheme_id?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     amount?: number | null,
>     currency_code?: string | null,
>     schedule_entries?: {
>       id?: string | null,
>       date?: number | null,
>       amount?: number | null,
>       scheduled_amount?: number | null,
>       status?: string | null
>     }[] | null
>   }[] | null,
>   next_invoice_estimate?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   } | null,
>   credit_note_estimates?: {
>     reference_invoice_id?: string | null,
>     type?: string | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     amount_allocated?: number | null,
>     amount_available?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   }[] | null,
>   unbilled_charge_estimates?: {
>     id?: string | null,
>     customer_id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     pricing_model?: string | null,
>     quantity?: number | null,
>     amount?: number | null,
>     currency_code?: string | null,
>     discount_amount?: number | null,
>     description?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     is_voided?: boolean | null,
>     voided_at?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     is_advance_charge?: boolean | null,
>     business_entity_id?: string | null,
>     deleted?: boolean | null
>   }[] | null
> } | null
> ```

***

## Quotes

### convert

`quotes.convert`

Convert a quote. This API is to convert a quote to an invoice.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.quotes.convert({ quoteId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `quoteId` | `string` | Yes | — |
| `invoice_date` | `number` | No | The document date displayed on the invoice PDF. 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. When not provided, the value is the same as current date. Moreover, if the invoice is created as `pending` , 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. \* The date is not earlier than `quoted_subscription.start_date` or `quoted_subscription.changes_scheduled_at` (whichever is applicable). \* `invoice_immediately` must be `true`. . |
| `invoice_immediately` | `boolean` | No | 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. . |
| `create_pending_invoices` | `boolean` | No | This attribute is set to `true` automatically for the subscription when it has one or more `metered` items. However, when there are no `metered` items, you can pass this parameter as `true` to force all invoices (except the first) to be created as `pending`. This is useful in the following scenarios: \* When you manage metered billing at your end by calculating usage-based charges yourself and add them to the subscription as [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). \* When your workflow involves inspecting all charges before you close invoices. **Note:** \* You must enable [Metered Billing](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing) for this parameter to be acceptable. \* To create the first invoice also as `pending`, pass `first_invoice_pending` as `true`. . |
| `first_invoice_pending` | `boolean` | No | Non-metered items are billed at the beginning of a billing cycle while metered items are billed at the end. Consequently, the first invoice of the subscription contains only the non-metered items. By passing this parameter as `true`, you create the first invoice as `pending` allowing you to add the previous term's metered charges to it before closing. This is useful when the subscription is moved to Chargebee from a different billing system. As applicable to all `pending` invoices, this invoice is also [closed automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via an [API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). **Note:** This parameter is passed only when there are metered items in the subscription or when `create_pending_invoices` is `true`. . |
| `subscription` | `object` | No | Parameters for subscription |

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id?: string,
>   auto_collection?: on | off,
>   po_number?: string,
>   auto_close_invoices?: boolean
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `quote` | `object \| null` | No | A quote is an estimate of the invoice with the charges likely to occur when customers buy an item. A quote can be converted to a regular invoice once the customer accepts it. The line items of a quote are grouped by charge events and are available as a separate [resource](https://docs.corsair.dev/docs/api/quote_line_groups). This resource can be retrieved using the [List quote line groups](https://docs.corsair.dev/docs/api/quotes/list-quote-line-groups) endpoint. Note that the first quote line group is available within the quote resource itself and parsing the quote line groups object is not required. |
| `quoted_subscription` | `object \| null` | No | When a [quote](https://docs.corsair.dev/docs/api/quotes) is created, it generates the `quoted_subscription` resource. This captures most of the details of the subscription that would eventually be created once the quote is invoiced. This resource is returned along with the quote for most of the associated operations. |
| `quoted_charge` | `object \| null` | No | When the [operation\_type](https://docs.corsair.dev/docs/api/quotes/quote-object#operation_type) of a `quote` is `onetime_invoice` , the `quoted_charges` resource contains the details of the invoice that is eventually created once the quote is invoiced. It is always returned along with the quote. |
| `quoted_ramp` | `object \| null` | No | When a [quote](https://docs.corsair.dev/docs/api/quotes) is created, it generates the `quoted_ramps` resource. This captures most of the details of the [ramps](https://docs.corsair.dev/docs/api/ramps) that would eventually be created once the quote is invoiced. This resource is returned along with the quote for most of the associated operations. **Note** Applicable only when Chargebee CPQ and [Subscription Ramps](https://docs.corsair.dev/docs/api/ramps) are enabled. To request access, contact [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). |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `subscription` | `object \| null` | No | A Chargebee subscription connects a customer record to products/services. It describes what the customer has signed up for and how often they're charged for it. The essential components of a subscription are: \* A [plan-item price](https://docs.corsair.dev/docs/api/item_prices). \* Any addon- and charge-item prices applied to the subscription. \* Any [coupons](https://docs.corsair.dev/docs/api/coupons) applied. \* Any [discounts](https://docs.corsair.dev/docs/api/discounts) applied. The charges in a subscription are billed via invoices. **Note:** The maximum number of subscriptions for any given [customer](https://docs.corsair.dev/docs/api/customers) ([active](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#status) or not) is 900. #### Subscription billing frequencies Chargebee offers two billing frequency options for subscriptions: \* **Plan-based billing** (`default`): Subscriptions are billed based on the billing period defined for the item price of the `item_type` `plan`. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/subscriptions#plan-based-billing). \* **Multi-frequency billing** : Subscriptions are billed according to the billing period of each recurring item price within the subscription. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing). **Important** [Limitations](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing#limitations) of Multi-frequency billing. The selection of the billing frequency preference is configured at the site level. #### Item price compatibility in a subscription When creating or updating a subscription, one of the item prices specified under subscription\_items must be a plan-item price. The remaining must be compatible addon- or charge-item prices. An item price is compatible with a plan-item price if their currencies are the same. Additionally, an addon-item price is compatible with a plan-item price only if their billing frequencies meet the following conditions: \| `period_unit` for plan-item price \| Compatible `period_unit` for addon-item price \| Compatible period for addon-item price \| \|-----------------------------------\|-----------------------------------------------\|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `day` \| `day` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `10`, then the period of the addon-item price can be `10`, `5`, `2`, or `1`. \| \| `week` \| `week` or `day` \| The `period` (in days) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the period of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `week`, `period` can be `2` or `1`. \* for `period_unit` as `day`, `period` can be `14`, `7`, `2`, or `1`. \| \| `month` \| `month` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `6`, then the `period` of the addon-item price can be `6`, `3`, `2`, or `1`. \| \| `year` \| `year` or `month` \| The `period` (in months) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the `period` of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `year`, `period` can be `2` or `1`. \* for `period_unit` as `month`, `period` can be `24`, `12`, `8`, `6`, `4`, `3`, `2`, or `1`. \| #### Tax provider fields **Avalara** : Merchants using **Avalara Sales Tax** can optionally associate each item price with a locationCode (from their Avalara company locations), so tax can be resolved correctly at the line item level. \| Field ID \| Field Value \| APIs \| \|--------------------------------------------------------------------------------\|----------------------------------------------------------------------\|--------------------------------------------------------------------------------\| \| `locationCode` \| Merchant to configure it on Avalara Platform under company locations \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| **Anrok**: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation \| Field ID \| Field Value \| APIs \| \|---------------------------------------------------------------------------------------------------------------------------------------\|---------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------\| \| `additionalTaxRegistrationNumber` \| Canadian tax registration numbers in comma separated fashion. \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| **Vertex**: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration **Note:** Field Id like `customerCode` , `customerClass` , and`taxExempted` belong to the customer object. Field Id like `productCode` , `productClass` , `productTaxCode` , and `productClass` belong to the product object. \| Field ID \| Field Value \| APIs \| \|-----------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productCode` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `customerCode` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `customerClass` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **Taxamo:** Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration \| Field Id \| Field Value \| APIs \| \|------------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productTaxCode` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `taxExempted` \| Merchant to configure it on Taxamo Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **cbtaxes**: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India. \| Field ID \| Field Value \| APIs \| \|---------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `indiaSez` \| `SEZ_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaSez` \| `SEZ_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **All**: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level \| Field ID \| Field Value \| APIs \| \|-------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `priceType` \| `TAX_INCLUSIVE` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| \| `TAX_EXCLUSIVE` \| \| \| \| `SITE_DEFAULT` or blank \| Removes price type override, and allows site level configuration to be used for tax calculation. \| #### Ramps API compatibility mode If you want to schedule changes on a subscription, use the [Ramps API](https://docs.corsair.dev/docs/api/ramps). If you are currently scheduling changes through the [Update subscription API](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items), migrate to the Ramps API. To get started, [request access for Subscription Ramps](https://app.chargebee.com/login?forward=https://app.chargebee.com/request_access/subscription-ramps\&ref=feature). Chargebee will enable Ramps compatibility mode for your site. Once enabled, you can test the Ramps API without impacting your existing integrations. The following parts of the Billing API have subtle differences in behavior when the Ramps feature is disabled versus when it is enabled with compatibility mode. (Follow the links to learn more.) \* The value of the [`subscription.has_scheduled_changes`](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#has_scheduled_changes) attribute. \* [Update subscription](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#impact-scheduled-changes) \* [Create Checkout for updating a subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription#impact-scheduled-changes) \* [Remove scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/remove-scheduled-changes) \* [Retrieve with scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/retrieve-with-scheduled-changes) \* [Create a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/create-a-quote-for-update-subscription-items) \* [Edit a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/edit-update-subscription-quote-for-items) \* [Portal sessions](https://docs.corsair.dev/docs/api/portal_sessions#scheduled-subscription-changes) |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |
| `credit_note` | `object \| null` | No | A [Credit Note](https://www.chargebee.com/docs/credit-notes.html) is a document that specifies the money owed by a business to its customer. The seller usually issues a Credit Note for the same or lower amount than the invoice, and then repays the money to the customer or set it off against other 'due' invoices. ### Credit Note Types Credit notes in Chargebee are categorized into three types: 1. `adjustment`: Adjustment credit notes are used to adjust the amount of an existing invoice in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Use this type of credit note to reduce the invoice amount, typically as a discount to the customer. Adjustment credit notes are automatically created in the following cases: \* When an invoice is written off. \* When a subscription is modified with proration enabled, and the invoice for the current term is in the `payment_due` or `not_paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). 2. `refundable`: Refundable credit notes allow you to return a certain amount to the customer. These credits can be: \* Retained for automatic application on future invoices. \* Applied to existing unpaid invoices. \* Refunded to the customer. Refundable credit notes are automatically created in the following cases: \* When an invoice is refunded. \* When a subscription is changed or canceled with proration enabled, the invoice for the current term is in the `paid` [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status). Refundable credits are applied to future invoices or can be refunded to the original payment method. 3. `store`: Store credit notes are created for `paid` or `partially_paid` invoice [status](https://docs.corsair.dev/docs/api/invoices/invoice-object#status) during subscription changes, such as upgrades, downgrades, or cancellations. Key characteristics of store credits: \* No tax component is included at the time of creation. \* A credit note document is generated, similar to refundable credits. \* Store credits are applied before tax calculations on future invoices. **Note:** If you have enabled *consolidated invoicing* , to know the subscriptions attached with a credit note you have to refer [line\_item's](https://docs.corsair.dev/docs/api/credit_notes/credit_note-object#line_items) *subscription\_id* . The credit note's *subscription\_id* should **not** be used (which will be *null* if the credit note has lines from multiple subscriptions). Impact on reference invoice The following updates are made to the reference invoice when a credit note is created/imported: \* If the credit note `type` is `adjustment`: \* The adjustment credit note details are added to the `adjustment_credit_notes[]` attribute of the invoice. \* The invoice `amount_due` is reduced by the credit note `total`. \* The invoice `status` is updated to `paid` if the invoice `amount_due` equals the credit note `total`. \* The invoice `status` does not change if the invoice `amount_due` is greater than credit note `total`. \* If the credit note `type` is `refundable`: \* The refundable credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. \* If the credit note `type` is `store`: \* The store credit note details are added to the `issued_credit_notes[]` attribute of the invoice. \* The invoice `status` does not change. |
| `unbilled_charges` | `object[] \| null` | No | Resource object representing unbilled\_charge |

> [accordion] quote full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   po_number?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   invoice_id?: string | null,
>   status?: string | null,
>   operation_type?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   valid_till?: number | null,
>   date?: number | null,
>   total_payable?: number | null,
>   charge_on_acceptance?: number | null,
>   sub_total?: number | null,
>   total?: number | null,
>   credits_applied?: number | null,
>   amount_paid?: number | null,
>   amount_due?: number | null,
>   version?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   vat_number_prefix?: string | null,
>   tax_category?: string | null,
>   currency_code?: string | null,
>   notes?: any[] | null,
>   contract_term_start?: number | null,
>   contract_term_end?: number | null,
>   contract_term_termination_fee?: number | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null,
>   total_contract_value?: number | null,
>   total_discount?: number | null,
>   has_entitlements?: boolean | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null
> } | null
> ```

> [accordion] quoted\_subscription full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   billing_period?: number | null,
>   billing_period_unit?: string | null,
>   start_date?: number | null,
>   trial_end?: number | null,
>   remaining_billing_cycles?: number | null,
>   po_number?: string | null,
>   auto_collection?: string | null,
>   plan_quantity_in_decimal?: string | null,
>   plan_unit_price_in_decimal?: string | null,
>   changes_scheduled_at?: number | null,
>   change_option?: string | null,
>   free_period?: number | null,
>   free_period_unit?: string | null,
>   contract_term_billing_cycle_on_renewal?: number | null,
>   coupons?: {
>     coupon_id?: string | null
>   }[] | null,
>   discounts?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     description?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     quantity?: number | null,
>     currency_code?: string | null,
>     duration_type?: string | null,
>     period?: number | null,
>     period_unit?: string | null,
>     included_in_mrr?: boolean | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null,
>     apply_till?: number | null,
>     applied_count?: number | null,
>     coupon_id?: string | null,
>     index?: number | null
>   }[] | null,
>   subscription_items?: {
>     item_price_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     amount?: number | null,
>     current_term_start?: number | null,
>     current_term_end?: number | null,
>     next_billing_at?: number | null,
>     amount_in_decimal?: string | null,
>     billing_period?: number | null,
>     billing_period_unit?: string | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     trial_end?: number | null,
>     billing_cycles?: number | null,
>     service_period_days?: number | null,
>     charge_on_event?: string | null,
>     charge_once?: boolean | null,
>     charge_on_option?: string | null,
>     proration_type?: string | null,
>     usage_accumulation_reset_frequency?: string | null,
>     description?: string | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null,
>     index?: number | null
>   }[] | null,
>   quoted_contract_term?: {
>     contract_start?: number | null,
>     contract_end?: number | null,
>     billing_cycle?: number | null,
>     action_at_term_end?: string | null,
>     total_contract_value?: number | null,
>     cancellation_cutoff_period?: number | null
>   } | null
> } | null
> ```

> [accordion] quoted\_charge full type
>
> ```ts theme={null}
> {
>   charges?: {
>     amount?: number | null,
>     amount_in_decimal?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     service_period_in_days?: number | null,
>     avalara_sale_type?: string | null,
>     avalara_transaction_type?: number | null,
>     avalara_service_type?: number | null
>   }[] | null,
>   invoice_items?: {
>     item_price_id?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     service_period_days?: number | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null,
>     index?: number | null
>   }[] | null,
>   coupons?: {
>     coupon_id?: string | null
>   }[] | null,
>   discounts?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     description?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     quantity?: number | null,
>     currency_code?: string | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null,
>     coupon_id?: string | null,
>     index?: number | null
>   }[] | null,
>   coupon_applicability_mappings?: {
>     coupon_id?: string | null,
>     applicable_item_price_ids?: string[] | null
>   }[] | null
> } | null
> ```

> [accordion] quoted\_ramp full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   line_items?: {
>     item_price_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     amount?: number | null,
>     amount_in_decimal?: string | null,
>     billing_period?: number | null,
>     billing_period_unit?: string | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     billing_cycles?: number | null,
>     service_period_days?: number | null,
>     charge_on_event?: string | null,
>     charge_once?: boolean | null,
>     charge_on_option?: string | null,
>     start_date?: number | null,
>     end_date?: number | null,
>     ramp_tier_id?: string | null,
>     discount_per_billing_cycle?: number | null,
>     discount_per_billing_cycle_in_decimal?: string | null,
>     item_level_discount_per_billing_cycle?: number | null,
>     item_level_discount_per_billing_cycle_in_decimal?: string | null,
>     amount_per_billing_cycle?: number | null,
>     amount_per_billing_cycle_in_decimal?: string | null,
>     net_amount_per_billing_cycle?: number | null,
>     net_amount_per_billing_cycle_in_decimal?: string | null,
>     description?: string | null
>   }[] | null,
>   discounts?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     duration_type?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     period?: number | null,
>     period_unit?: string | null,
>     included_in_mrr?: boolean | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     start_date?: number | null,
>     end_date?: number | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     ramp_tier_id?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   coupon_applicability_mappings?: {
>     coupon_id?: string | null,
>     applicable_item_price_ids?: string[] | null
>   }[] | null
> } | null
> ```

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   currency_code?: string | null,
>   billing_period?: number | null,
>   billing_period_unit?: string | null,
>   start_date?: number | null,
>   trial_end?: number | null,
>   remaining_billing_cycles?: number | null,
>   po_number?: string | null,
>   auto_collection?: string | null,
>   plan_quantity_in_decimal?: string | null,
>   plan_unit_price_in_decimal?: string | null,
>   customer_id?: string | null,
>   status?: string | null,
>   trial_start?: number | null,
>   trial_end_action?: string | null,
>   current_term_start?: number | null,
>   current_term_end?: number | null,
>   next_billing_at?: number | null,
>   created_at?: number | null,
>   started_at?: number | null,
>   activated_at?: number | null,
>   contract_term_billing_cycle_on_renewal?: number | null,
>   override_relationship?: boolean | null,
>   pause_date?: number | null,
>   resume_date?: number | null,
>   cancelled_at?: number | null,
>   cancel_reason?: string | null,
>   created_from_ip?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   has_scheduled_advance_invoices?: boolean | null,
>   has_scheduled_changes?: boolean | null,
>   payment_source_id?: string | null,
>   plan_free_quantity_in_decimal?: string | null,
>   plan_amount_in_decimal?: string | null,
>   cancel_schedule_created_at?: number | null,
>   offline_payment_method?: string | null,
>   channel?: string | null,
>   net_term_days?: number | null,
>   active_id?: string | null,
>   due_invoices_count?: number | null,
>   due_since?: number | null,
>   total_dues?: number | null,
>   mrr?: number | null,
>   exchange_rate?: number | null,
>   base_currency_code?: string | null,
>   invoice_notes?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   changes_scheduled_at?: number | null,
>   cancel_reason_code?: string | null,
>   free_period?: number | null,
>   free_period_unit?: string | null,
>   create_pending_invoices?: boolean | null,
>   auto_close_invoices?: boolean | null,
>   business_entity_id?: string | null,
>   decommissioned?: boolean | null,
>   brand_id?: string | null,
>   subscription_items?: {
>     item_price_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     amount?: number | null,
>     current_term_start?: number | null,
>     current_term_end?: number | null,
>     next_billing_at?: number | null,
>     amount_in_decimal?: string | null,
>     billing_period?: number | null,
>     billing_period_unit?: string | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     trial_end?: number | null,
>     billing_cycles?: number | null,
>     service_period_days?: number | null,
>     charge_on_event?: string | null,
>     charge_once?: boolean | null,
>     charge_on_option?: string | null,
>     proration_type?: string | null,
>     usage_accumulation_reset_frequency?: string | null,
>     description?: string | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null,
>     index?: number | null
>   }[] | null,
>   charged_items?: {
>     item_price_id?: string | null,
>     last_charged_at?: number | null
>   }[] | null,
>   coupons?: {
>     coupon_id?: string | null,
>     apply_till?: number | null,
>     applied_count?: number | null,
>     coupon_code?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_info?: {
>     referral_code?: string | null,
>     coupon_code?: string | null,
>     referrer_id?: string | null,
>     external_reference_id?: string | null,
>     reward_status?: string | null,
>     referral_system?: string | null,
>     account_id?: string | null,
>     campaign_id?: string | null,
>     external_campaign_id?: string | null,
>     friend_offer_type?: string | null,
>     referrer_reward_type?: string | null,
>     notify_referral_system?: string | null,
>     destination_url?: string | null,
>     post_purchase_widget_enabled?: boolean | null
>   } | null,
>   billing_override?: {
>     max_excess_payment_usage?: number | null,
>     max_refundable_credits_usage?: number | null
>   } | null,
>   contract_term?: {
>     id?: string | null,
>     status?: string | null,
>     contract_start?: number | null,
>     contract_end?: number | null,
>     billing_cycle?: number | null,
>     action_at_term_end?: string | null,
>     total_contract_value?: number | null,
>     total_contract_value_before_tax?: number | null,
>     cancellation_cutoff_period?: number | null,
>     created_at?: number | null,
>     subscription_id?: string | null,
>     remaining_billing_cycles?: number | null
>   } | null,
>   discounts?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     description?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     quantity?: number | null,
>     currency_code?: string | null,
>     duration_type?: string | null,
>     period?: number | null,
>     period_unit?: string | null,
>     included_in_mrr?: boolean | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null,
>     apply_till?: number | null,
>     applied_count?: number | null,
>     coupon_id?: string | null,
>     index?: number | null
>   }[] | null
> } | null
> ```

> [accordion] invoice full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   payment_owner?: string | null,
>   subscription_id?: string | null,
>   recurring?: boolean | null,
>   status?: string | null,
>   date?: number | null,
>   due_date?: number | null,
>   net_term_days?: number | null,
>   po_number?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   exchange_rate?: number | null,
>   local_currency_exchange_rate?: number | null,
>   currency_code?: string | null,
>   local_currency_code?: string | null,
>   tax?: number | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total?: number | null,
>   total_in_local_currency?: number | null,
>   amount_due?: number | null,
>   amount_adjusted?: number | null,
>   amount_paid?: number | null,
>   paid_at?: number | null,
>   write_off_amount?: number | null,
>   credits_applied?: number | null,
>   dunning_status?: string | null,
>   next_retry_at?: number | null,
>   voided_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   line_items_next_offset?: string | null,
>   first_invoice?: boolean | null,
>   new_sales_amount?: number | null,
>   has_advance_charges?: boolean | null,
>   offline_payment_method?: string | null,
>   term_finalized?: boolean | null,
>   is_gifted?: boolean | null,
>   generated_at?: number | null,
>   expected_payment_date?: number | null,
>   amount_to_collect?: number | null,
>   round_off_amount?: number | null,
>   retry_segment_id?: string | null,
>   void_reason_code?: string | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   vat_number_prefix?: string | null,
>   channel?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     line_item_id?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_taxes_withheld?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   linked_payments?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null
>   }[] | null,
>   reference_transactions?: {
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_id?: string | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     txn_type?: string | null,
>     amount_capturable?: number | null,
>     authorization_reason?: string | null
>   }[] | null,
>   dunning_attempts?: {
>     attempt?: number | null,
>     transaction_id?: string | null,
>     dunning_type?: string | null,
>     created_at?: number | null,
>     txn_status?: string | null,
>     txn_amount?: number | null,
>     retry_engine?: string | null
>   }[] | null,
>   applied_credits?: {
>     cn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   adjustment_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   issued_credit_notes?: {
>     cn_id?: string | null,
>     cn_reason_code?: string | null,
>     cn_create_reason_code?: string | null,
>     cn_date?: number | null,
>     cn_total?: number | null,
>     cn_status?: string | null
>   }[] | null,
>   linked_orders?: {
>     id?: string | null,
>     document_number?: string | null,
>     status?: string | null,
>     order_type?: string | null,
>     reference_id?: string | null,
>     fulfillment_status?: string | null,
>     batch_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   notes?: {
>     note?: string | null,
>     entity_id?: string | null,
>     entity_type?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   statement_descriptor?: {
>     id?: string | null,
>     descriptor?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

> [accordion] credit\_note full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   reference_invoice_id?: string | null,
>   type?: string | null,
>   reason_code?: string | null,
>   status?: string | null,
>   vat_number?: string | null,
>   date?: number | null,
>   price_type?: string | null,
>   currency_code?: string | null,
>   total?: number | null,
>   amount_allocated?: number | null,
>   amount_refunded?: number | null,
>   amount_available?: number | null,
>   refunded_at?: number | null,
>   voided_at?: number | null,
>   generated_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   channel?: string | null,
>   line_items_next_offset?: string | null,
>   sub_total?: number | null,
>   sub_total_in_local_currency?: number | null,
>   total_in_local_currency?: number | null,
>   local_currency_code?: string | null,
>   round_off_amount?: number | null,
>   fractional_correction?: number | null,
>   notes?: string[] | null,
>   deleted?: boolean | null,
>   tax_category?: string | null,
>   local_currency_exchange_rate?: number | null,
>   create_reason_code?: string | null,
>   vat_number_prefix?: string | null,
>   business_entity_id?: string | null,
>   brand_id?: string | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   line_item_addresses?: {
>     line_item_id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   tax_origin?: {
>     country?: string | null,
>     registration_number?: string | null
>   } | null,
>   linked_refunds?: {
>     txn_id?: string | null,
>     applied_amount?: number | null,
>     applied_at?: number | null,
>     txn_status?: string | null,
>     txn_date?: number | null,
>     txn_amount?: number | null,
>     refund_reason_code?: string | null
>   }[] | null,
>   linked_tax_withheld_refunds?: {
>     id?: string | null,
>     amount?: number | null,
>     description?: string | null,
>     date?: number | null,
>     reference_number?: string | null
>   }[] | null,
>   allocations?: {
>     invoice_id?: string | null,
>     allocated_amount?: number | null,
>     allocated_at?: number | null,
>     invoice_date?: number | null,
>     invoice_status?: string | null,
>     tax_application?: string | null
>   }[] | null,
>   exchange_rates?: {
>     currency_code?: string | null,
>     rate?: number | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   einvoice?: {
>     id?: string | null,
>     reference_id?: string | null,
>     reference_number?: string | null,
>     status?: string | null,
>     message?: string | null,
>     provider_references?: any[] | null
>   } | null,
>   site_details_at_creation?: {
>     timezone?: string | null,
>     organization_address?: {
>     } | null
>   } | null
> } | null
> ```

> [accordion] unbilled\_charges full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   date_from?: number | null,
>   date_to?: number | null,
>   unit_amount?: number | null,
>   pricing_model?: string | null,
>   quantity?: number | null,
>   amount?: number | null,
>   currency_code?: string | null,
>   discount_amount?: number | null,
>   description?: string | null,
>   entity_type?: string | null,
>   entity_id?: string | null,
>   is_voided?: boolean | null,
>   voided_at?: number | null,
>   unit_amount_in_decimal?: string | null,
>   quantity_in_decimal?: string | null,
>   amount_in_decimal?: string | null,
>   created_at?: number | null,
>   updated_at?: number | null,
>   is_advance_charge?: boolean | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null,
>   tiers?: {
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null
> }[] | null
> ```

***

### createForChargeItemsAndCharges

`quotes.createForChargeItemsAndCharges`

Create a quote for charges and charge items. Creates a quote using charge-items and one-time charges.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.quotes.createForChargeItemsAndCharges({ customer_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `name` | `string` | No | The quote name will be used as the pdf name of the quote. |
| `customer_id` | `string` | Yes | Identifier of the customer for which the quote needs to be created. |
| `po_number` | `string` | No | Purchase Order Number for this quote. |
| `notes` | `string` | No | Notes specific to this quote that you want customers to see on the quote PDF. |
| `expires_at` | `number` | No | Quotes will be valid till this date. After this quote will be marked as closed. |
| `currency_code` | `string` | No | The currency code (ISO 4217 format) of the quote. |
| `coupon` | `string` | No | The 'One Time' coupon to be applied. |
| `coupon_ids` | `string[]` | No | List of Coupons to be added. |
| `net_term_days` | `number` | No | The number of days from [`invoice.date`](https://docs.corsair.dev/docs/api/invoices/invoice-object#date) until payment for the invoice is due. **Prerequisite** You can use this parameter only when Chargebee CPQ is enabled. Contact [Chargebee Support](https://www.chargebee.com/docs/billing/2.0/kb/getting-started/how-to-contact-chargebees-support-team) to request access. |
| `billing_address` | `object` | No | Parameters for billing\_address |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `item_prices` | `object` | No | Parameters for item\_prices |
| `item_tiers` | `object` | No | Parameters for item\_tiers |
| `charges` | `object` | No | Parameters for charges |
| `discounts` | `object` | No | Parameters for discounts |
| `tax_providers_fields` | `object` | No | Parameters for tax\_providers\_fields |

> [accordion] billing\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] item\_prices full type
>
> ```ts theme={null}
> {
>   item_price_id?: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   unit_price?: number[],
>   unit_price_in_decimal?: string[],
>   service_period_days?: number[]
> }
> ```

> [accordion] item\_tiers full type
>
> ```ts theme={null}
> {
>   item_price_id?: string[],
>   starting_unit?: number[],
>   ending_unit?: number[],
>   price?: number[],
>   starting_unit_in_decimal?: string[],
>   ending_unit_in_decimal?: string[],
>   price_in_decimal?: string[],
>   pricing_type?: (per_unit | flat_fee | package)[],
>   package_size?: number[]
> }
> ```

> [accordion] charges full type
>
> ```ts theme={null}
> {
>   amount?: number[],
>   amount_in_decimal?: string[],
>   description?: string[],
>   avalara_sale_type?: (wholesale | retail | consumed | vendor_use)[],
>   avalara_transaction_type?: number[],
>   avalara_service_type?: number[],
>   service_period?: number[]
> }
> ```

> [accordion] discounts full type
>
> ```ts theme={null}
> {
>   percentage?: number[],
>   quantity?: number[],
>   amount?: number[],
>   apply_on: (invoice_amount | specific_item_price)[],
>   item_price_id?: string[]
> }
> ```

> [accordion] tax\_providers\_fields full type
>
> ```ts theme={null}
> {
>   provider_name?: string[],
>   field_id?: string[],
>   field_value?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `quote` | `object \| null` | No | A quote is an estimate of the invoice with the charges likely to occur when customers buy an item. A quote can be converted to a regular invoice once the customer accepts it. The line items of a quote are grouped by charge events and are available as a separate [resource](https://docs.corsair.dev/docs/api/quote_line_groups). This resource can be retrieved using the [List quote line groups](https://docs.corsair.dev/docs/api/quotes/list-quote-line-groups) endpoint. Note that the first quote line group is available within the quote resource itself and parsing the quote line groups object is not required. |
| `quoted_charge` | `object \| null` | No | When the [operation\_type](https://docs.corsair.dev/docs/api/quotes/quote-object#operation_type) of a `quote` is `onetime_invoice` , the `quoted_charges` resource contains the details of the invoice that is eventually created once the quote is invoiced. It is always returned along with the quote. |

> [accordion] quote full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   po_number?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   invoice_id?: string | null,
>   status?: string | null,
>   operation_type?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   valid_till?: number | null,
>   date?: number | null,
>   total_payable?: number | null,
>   charge_on_acceptance?: number | null,
>   sub_total?: number | null,
>   total?: number | null,
>   credits_applied?: number | null,
>   amount_paid?: number | null,
>   amount_due?: number | null,
>   version?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   vat_number_prefix?: string | null,
>   tax_category?: string | null,
>   currency_code?: string | null,
>   notes?: any[] | null,
>   contract_term_start?: number | null,
>   contract_term_end?: number | null,
>   contract_term_termination_fee?: number | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null,
>   total_contract_value?: number | null,
>   total_discount?: number | null,
>   has_entitlements?: boolean | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null
> } | null
> ```

> [accordion] quoted\_charge full type
>
> ```ts theme={null}
> {
>   charges?: {
>     amount?: number | null,
>     amount_in_decimal?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     service_period_in_days?: number | null,
>     avalara_sale_type?: string | null,
>     avalara_transaction_type?: number | null,
>     avalara_service_type?: number | null
>   }[] | null,
>   invoice_items?: {
>     item_price_id?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     service_period_days?: number | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null,
>     index?: number | null
>   }[] | null,
>   coupons?: {
>     coupon_id?: string | null
>   }[] | null,
>   discounts?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     description?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     quantity?: number | null,
>     currency_code?: string | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null,
>     coupon_id?: string | null,
>     index?: number | null
>   }[] | null,
>   coupon_applicability_mappings?: {
>     coupon_id?: string | null,
>     applicable_item_price_ids?: string[] | null
>   }[] | null
> } | null
> ```

***

### createForOnetimeCharges

`quotes.createForOnetimeCharges`

Create quote for one-time charges. Creates a quote for one-time charges and non-recurring addons. This is applicable only for one-time payment. Recurring charges are not permitted in this quote; use Create quote for a new subscription or Create quote for updating a subscription instead. Product Catalog 1.0 sites only.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.quotes.createForOnetimeCharges({ customer_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `name` | `string` | No | The quote name will be used as the pdf name of the quote. |
| `customer_id` | `string` | Yes | Identifier of the customer for which the quote needs to be created. |
| `po_number` | `string` | No | Purchase Order Number for this quote. |
| `notes` | `string` | No | Notes specific to this quote that you want customers to see on the quote PDF. |
| `expires_at` | `number` | No | Quotes will be valid till this date. After this quote will be marked as closed. |
| `currency_code` | `string` | No | The currency code (ISO 4217 format) of the quote. |
| `coupon` | `string` | No | The 'One Time' coupon to be applied. |
| `coupon_ids` | `string[]` | No | List of Coupons to be added. |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `addons` | `object` | No | Parameters for addons |
| `charges` | `object` | No | Parameters for charges |
| `tax_providers_fields` | `object` | No | Parameters for tax\_providers\_fields |

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   unit_price?: number[],
>   unit_price_in_decimal?: string[],
>   service_period?: number[]
> }
> ```

> [accordion] charges full type
>
> ```ts theme={null}
> {
>   amount?: number[],
>   amount_in_decimal?: string[],
>   description?: string[],
>   avalara_sale_type?: (wholesale | retail | consumed | vendor_use)[],
>   avalara_transaction_type?: number[],
>   avalara_service_type?: number[],
>   service_period?: number[]
> }
> ```

> [accordion] tax\_providers\_fields full type
>
> ```ts theme={null}
> {
>   provider_name?: string[],
>   field_id?: string[],
>   field_value?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `quote` | `object \| null` | No | A quote is an estimate of the invoice with the charges likely to occur when customers buy an item. A quote can be converted to a regular invoice once the customer accepts it. The line items of a quote are grouped by charge events and are available as a separate [resource](https://docs.corsair.dev/docs/api/quote_line_groups). This resource can be retrieved using the [List quote line groups](https://docs.corsair.dev/docs/api/quotes/list-quote-line-groups) endpoint. Note that the first quote line group is available within the quote resource itself and parsing the quote line groups object is not required. |
| `quoted_charge` | `object \| null` | No | When the [operation\_type](https://docs.corsair.dev/docs/api/quotes/quote-object#operation_type) of a `quote` is `onetime_invoice` , the `quoted_charges` resource contains the details of the invoice that is eventually created once the quote is invoiced. It is always returned along with the quote. |

> [accordion] quote full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   po_number?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   invoice_id?: string | null,
>   status?: string | null,
>   operation_type?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   valid_till?: number | null,
>   date?: number | null,
>   total_payable?: number | null,
>   charge_on_acceptance?: number | null,
>   sub_total?: number | null,
>   total?: number | null,
>   credits_applied?: number | null,
>   amount_paid?: number | null,
>   amount_due?: number | null,
>   version?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   vat_number_prefix?: string | null,
>   tax_category?: string | null,
>   currency_code?: string | null,
>   notes?: any[] | null,
>   contract_term_start?: number | null,
>   contract_term_end?: number | null,
>   contract_term_termination_fee?: number | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null,
>   total_contract_value?: number | null,
>   total_discount?: number | null,
>   has_entitlements?: boolean | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null
> } | null
> ```

> [accordion] quoted\_charge full type
>
> ```ts theme={null}
> {
>   charges?: {
>     amount?: number | null,
>     amount_in_decimal?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     service_period_in_days?: number | null,
>     avalara_sale_type?: string | null,
>     avalara_transaction_type?: number | null,
>     avalara_service_type?: number | null
>   }[] | null,
>   addons?: {
>     id?: string | null,
>     quantity?: number | null,
>     unit_price?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price_in_decimal?: string | null,
>     proration_type?: string | null,
>     service_period?: number | null
>   }[] | null,
>   coupons?: {
>     coupon_id?: string | null
>   }[] | null,
>   coupon_applicability_mappings?: {
>     coupon_id?: string | null,
>     applicable_item_price_ids?: string[] | null
>   }[] | null
> } | null
> ```

***

### delete

`quotes.delete`

Delete a quote. using this API. (POST /quotes/\{quote-id}/delete)

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.quotes.delete({ quoteId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `quoteId` | `string` | Yes | — |
| `comment` | `string` | No | An internal [comment](https://docs.corsair.dev/docs/api/comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](https://docs.corsair.dev/docs/api/hosted_pages) or any document such as the [Invoice PDF](https://docs.corsair.dev/docs/api/invoices/retrieve-invoice-as-pdf) . |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `quote` | `object \| null` | No | A quote is an estimate of the invoice with the charges likely to occur when customers buy an item. A quote can be converted to a regular invoice once the customer accepts it. The line items of a quote are grouped by charge events and are available as a separate [resource](https://docs.corsair.dev/docs/api/quote_line_groups). This resource can be retrieved using the [List quote line groups](https://docs.corsair.dev/docs/api/quotes/list-quote-line-groups) endpoint. Note that the first quote line group is available within the quote resource itself and parsing the quote line groups object is not required. |
| `quoted_subscription` | `object \| null` | No | When a [quote](https://docs.corsair.dev/docs/api/quotes) is created, it generates the `quoted_subscription` resource. This captures most of the details of the subscription that would eventually be created once the quote is invoiced. This resource is returned along with the quote for most of the associated operations. |
| `quoted_charge` | `object \| null` | No | When the [operation\_type](https://docs.corsair.dev/docs/api/quotes/quote-object#operation_type) of a `quote` is `onetime_invoice` , the `quoted_charges` resource contains the details of the invoice that is eventually created once the quote is invoiced. It is always returned along with the quote. |
| `quoted_ramp` | `object \| null` | No | When a [quote](https://docs.corsair.dev/docs/api/quotes) is created, it generates the `quoted_ramps` resource. This captures most of the details of the [ramps](https://docs.corsair.dev/docs/api/ramps) that would eventually be created once the quote is invoiced. This resource is returned along with the quote for most of the associated operations. **Note** Applicable only when Chargebee CPQ and [Subscription Ramps](https://docs.corsair.dev/docs/api/ramps) are enabled. To request access, contact [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). |

> [accordion] quote full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   po_number?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   invoice_id?: string | null,
>   status?: string | null,
>   operation_type?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   valid_till?: number | null,
>   date?: number | null,
>   total_payable?: number | null,
>   charge_on_acceptance?: number | null,
>   sub_total?: number | null,
>   total?: number | null,
>   credits_applied?: number | null,
>   amount_paid?: number | null,
>   amount_due?: number | null,
>   version?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   vat_number_prefix?: string | null,
>   tax_category?: string | null,
>   currency_code?: string | null,
>   notes?: any[] | null,
>   contract_term_start?: number | null,
>   contract_term_end?: number | null,
>   contract_term_termination_fee?: number | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null,
>   total_contract_value?: number | null,
>   total_discount?: number | null,
>   has_entitlements?: boolean | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null
> } | null
> ```

> [accordion] quoted\_subscription full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   billing_period?: number | null,
>   billing_period_unit?: string | null,
>   start_date?: number | null,
>   trial_end?: number | null,
>   remaining_billing_cycles?: number | null,
>   po_number?: string | null,
>   auto_collection?: string | null,
>   plan_quantity_in_decimal?: string | null,
>   plan_unit_price_in_decimal?: string | null,
>   changes_scheduled_at?: number | null,
>   change_option?: string | null,
>   free_period?: number | null,
>   free_period_unit?: string | null,
>   contract_term_billing_cycle_on_renewal?: number | null,
>   coupons?: {
>     coupon_id?: string | null
>   }[] | null,
>   discounts?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     description?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     quantity?: number | null,
>     currency_code?: string | null,
>     duration_type?: string | null,
>     period?: number | null,
>     period_unit?: string | null,
>     included_in_mrr?: boolean | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null,
>     apply_till?: number | null,
>     applied_count?: number | null,
>     coupon_id?: string | null,
>     index?: number | null
>   }[] | null,
>   subscription_items?: {
>     item_price_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     amount?: number | null,
>     current_term_start?: number | null,
>     current_term_end?: number | null,
>     next_billing_at?: number | null,
>     amount_in_decimal?: string | null,
>     billing_period?: number | null,
>     billing_period_unit?: string | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     trial_end?: number | null,
>     billing_cycles?: number | null,
>     service_period_days?: number | null,
>     charge_on_event?: string | null,
>     charge_once?: boolean | null,
>     charge_on_option?: string | null,
>     proration_type?: string | null,
>     usage_accumulation_reset_frequency?: string | null,
>     description?: string | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null,
>     index?: number | null
>   }[] | null,
>   quoted_contract_term?: {
>     contract_start?: number | null,
>     contract_end?: number | null,
>     billing_cycle?: number | null,
>     action_at_term_end?: string | null,
>     total_contract_value?: number | null,
>     cancellation_cutoff_period?: number | null
>   } | null
> } | null
> ```

> [accordion] quoted\_charge full type
>
> ```ts theme={null}
> {
>   charges?: {
>     amount?: number | null,
>     amount_in_decimal?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     service_period_in_days?: number | null,
>     avalara_sale_type?: string | null,
>     avalara_transaction_type?: number | null,
>     avalara_service_type?: number | null
>   }[] | null,
>   invoice_items?: {
>     item_price_id?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     service_period_days?: number | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null,
>     index?: number | null
>   }[] | null,
>   coupons?: {
>     coupon_id?: string | null
>   }[] | null,
>   discounts?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     description?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     quantity?: number | null,
>     currency_code?: string | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null,
>     coupon_id?: string | null,
>     index?: number | null
>   }[] | null,
>   coupon_applicability_mappings?: {
>     coupon_id?: string | null,
>     applicable_item_price_ids?: string[] | null
>   }[] | null
> } | null
> ```

> [accordion] quoted\_ramp full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   line_items?: {
>     item_price_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     amount?: number | null,
>     amount_in_decimal?: string | null,
>     billing_period?: number | null,
>     billing_period_unit?: string | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     billing_cycles?: number | null,
>     service_period_days?: number | null,
>     charge_on_event?: string | null,
>     charge_once?: boolean | null,
>     charge_on_option?: string | null,
>     start_date?: number | null,
>     end_date?: number | null,
>     ramp_tier_id?: string | null,
>     discount_per_billing_cycle?: number | null,
>     discount_per_billing_cycle_in_decimal?: string | null,
>     item_level_discount_per_billing_cycle?: number | null,
>     item_level_discount_per_billing_cycle_in_decimal?: string | null,
>     amount_per_billing_cycle?: number | null,
>     amount_per_billing_cycle_in_decimal?: string | null,
>     net_amount_per_billing_cycle?: number | null,
>     net_amount_per_billing_cycle_in_decimal?: string | null,
>     description?: string | null
>   }[] | null,
>   discounts?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     duration_type?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     period?: number | null,
>     period_unit?: string | null,
>     included_in_mrr?: boolean | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     start_date?: number | null,
>     end_date?: number | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     ramp_tier_id?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   coupon_applicability_mappings?: {
>     coupon_id?: string | null,
>     applicable_item_price_ids?: string[] | null
>   }[] | null
> } | null
> ```

***

### editCreateSubscriptionQuote

`quotes.editCreateSubscriptionQuote`

Edit quote for a new subscription. Edits a quote. This endpoint is for quotes that are for new subscriptions. To edit a quote that is for updating a subscription, use Edit quote for updating a subscription. Product Catalog 1.0 sites only.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.quotes.editCreateSubscriptionQuote({ quoteId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `quoteId` | `string` | Yes | — |
| `notes` | `string` | No | Notes specific to this quote that you want customers to see on the quote PDF. |
| `expires_at` | `number` | No | Quotes will be valid till this date. After this quote will be marked as closed. |
| `billing_cycles` | `number` | No | Number of cycles(plan interval) this subscription should be charged. After the billing cycles exhausted, the subscription will be cancelled. |
| `mandatory_addons_to_remove` | `string[]` | No | List of addons IDs that are mandatory to the plan and has to be removed from the subscription. |
| `terms_to_charge` | `number` | No | 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` | `immediate \| delayed` | No | 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. \* delayed - Subscription period will be aligned with the configured billing date at the next renewal. \* immediate - Subscription period will be aligned with the configured billing date immediately, with credits or charges raised accordingly.. |
| `coupon_ids` | `string[]` | No | Identifier of the coupon as a List. Coupon Codes can also be passed. |
| `subscription` | `object` | No | Parameters for subscription |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `contract_term` | `object` | No | Parameters for contract\_term |
| `addons` | `object` | No | Parameters for addons |
| `event_based_addons` | `object` | No | Parameters for event\_based\_addons |

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id?: string,
>   po_number?: string,
>   plan_id: string,
>   plan_quantity?: number,
>   plan_quantity_in_decimal?: string,
>   plan_unit_price?: number,
>   plan_unit_price_in_decimal?: string,
>   setup_fee?: number,
>   trial_end?: number,
>   start_date?: number,
>   offline_payment_method?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
>   contract_term_billing_cycle_on_renewal?: number
> }
> ```

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] contract\_term full type
>
> ```ts theme={null}
> {
>   action_at_term_end?: renew | evergreen | cancel,
>   cancellation_cutoff_period?: number
> }
> ```

> [accordion] addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   unit_price?: number[],
>   unit_price_in_decimal?: string[],
>   billing_cycles?: number[],
>   trial_end?: number[]
> }
> ```

> [accordion] event\_based\_addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   unit_price?: number[],
>   quantity_in_decimal?: string[],
>   unit_price_in_decimal?: string[],
>   service_period_in_days?: number[],
>   on_event?: (subscription_creation | subscription_trial_start | plan_activation | subscription_activation | contract_termination)[],
>   charge_once?: boolean[],
>   charge_on?: (immediately | on_event)[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `quote` | `object \| null` | No | A quote is an estimate of the invoice with the charges likely to occur when customers buy an item. A quote can be converted to a regular invoice once the customer accepts it. The line items of a quote are grouped by charge events and are available as a separate [resource](https://docs.corsair.dev/docs/api/quote_line_groups). This resource can be retrieved using the [List quote line groups](https://docs.corsair.dev/docs/api/quotes/list-quote-line-groups) endpoint. Note that the first quote line group is available within the quote resource itself and parsing the quote line groups object is not required. |
| `quoted_subscription` | `object \| null` | No | When a [quote](https://docs.corsair.dev/docs/api/quotes) is created, it generates the `quoted_subscription` resource. This captures most of the details of the subscription that would eventually be created once the quote is invoiced. This resource is returned along with the quote for most of the associated operations. |

> [accordion] quote full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   po_number?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   invoice_id?: string | null,
>   status?: string | null,
>   operation_type?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   valid_till?: number | null,
>   date?: number | null,
>   total_payable?: number | null,
>   charge_on_acceptance?: number | null,
>   sub_total?: number | null,
>   total?: number | null,
>   credits_applied?: number | null,
>   amount_paid?: number | null,
>   amount_due?: number | null,
>   version?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   vat_number_prefix?: string | null,
>   tax_category?: string | null,
>   currency_code?: string | null,
>   notes?: any[] | null,
>   contract_term_start?: number | null,
>   contract_term_end?: number | null,
>   contract_term_termination_fee?: number | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null,
>   total_contract_value?: number | null,
>   total_discount?: number | null,
>   has_entitlements?: boolean | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null
> } | null
> ```

> [accordion] quoted\_subscription full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   plan_id?: string | null,
>   plan_quantity?: number | null,
>   plan_unit_price?: number | null,
>   setup_fee?: number | null,
>   billing_period?: number | null,
>   billing_period_unit?: string | null,
>   start_date?: number | null,
>   trial_end?: number | null,
>   remaining_billing_cycles?: number | null,
>   po_number?: string | null,
>   auto_collection?: string | null,
>   plan_quantity_in_decimal?: string | null,
>   plan_unit_price_in_decimal?: string | null,
>   changes_scheduled_at?: number | null,
>   change_option?: string | null,
>   free_period?: number | null,
>   free_period_unit?: string | null,
>   contract_term_billing_cycle_on_renewal?: number | null,
>   addons?: {
>     id?: string | null,
>     quantity?: number | null,
>     unit_price?: number | null,
>     amount?: number | null,
>     trial_end?: number | null,
>     remaining_billing_cycles?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     proration_type?: string | null
>   }[] | null,
>   event_based_addons?: {
>     id?: string | null,
>     quantity?: number | null,
>     unit_price?: number | null,
>     on_event?: string | null,
>     charge_once?: boolean | null,
>     quantity_in_decimal?: string | null,
>     unit_price_in_decimal?: string | null
>   }[] | null,
>   coupons?: {
>     coupon_id?: string | null
>   }[] | null,
>   quoted_contract_term?: {
>     contract_start?: number | null,
>     contract_end?: number | null,
>     billing_cycle?: number | null,
>     action_at_term_end?: string | null,
>     total_contract_value?: number | null,
>     cancellation_cutoff_period?: number | null
>   } | null
> } | null
> ```

***

### editCreateSubscriptionQuoteForItems

`quotes.editCreateSubscriptionQuoteForItems`

Edit a quote for subscription creation. Changes the quote produced for creating a new subscription items.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.quotes.editCreateSubscriptionQuoteForItems({ quoteId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `quoteId` | `string` | Yes | — |
| `notes` | `string` | No | Notes specific to this quote that you want customers to see on the quote PDF. |
| `expires_at` | `number` | No | Quotes will be valid till this date. After this quote will be marked as closed. |
| `billing_cycles` | `number` | No | The number of billing cycles the subscription runs before canceling. If not provided, then the billing cycles [set for the plan-item price](https://docs.corsair.dev/docs/api/item_prices/item_price-object#billing_cycles) is used. |
| `mandatory_items_to_remove` | `string[]` | No | Item ids of [mandatorily attached addons](https://docs.corsair.dev/docs/api/attached_items) that are to be removed from the subscription. |
| `terms_to_charge` | `number` | No | 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` | `immediate \| delayed` | No | 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. \* 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` | `string[]` | No | The list of [IDs](https://docs.corsair.dev/docs/api/coupons/coupon-object#id) of the coupons to be applied. [Coupon codes](https://docs.corsair.dev/docs/api/coupon_codes) are also supported. **Note** Not applicable when Chargebee CPQ is enabled. Use `coupons[]` array instead. |
| `billing_start_option` | `immediately \| on_specific_date` | No | When the quote is converted, this attribute determines the date/time as of when the subscription start is to be carried out. **Note** The parameter applies only when Chargebee CPQ is enabled. To request access, contact [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). \* on\_specific\_date - Upon quote conversion, the subscription is scheduled to start on the specified date. \* immediately - The subscription starts immediately upon conversion of the quote to a subscription. |
| `net_term_days` | `number` | No | The number of days from [`invoice.date`](https://docs.corsair.dev/docs/api/invoices/invoice-object#date) until payment for the invoice is due. **Note** The parameter applies only when Chargebee CPQ is enabled. To request access, contact [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). |
| `subscription` | `object` | No | Parameters for subscription |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `contract_term` | `object` | No | Parameters for contract\_term |
| `billing_address` | `object` | No | Parameters for billing\_address |
| `subscription_items` | `object` | No | Parameters for subscription\_items |
| `discounts` | `object` | No | Parameters for discounts |
| `item_tiers` | `object` | No | Parameters for item\_tiers |
| `coupons` | `object` | No | — |
| `entitlement_overrides` | `object` | No | The set of entitlement overrides to apply on this quote. Each entry targets a feature for an entity on the quote. Overrides are always upserted. |

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id?: string,
>   po_number?: string,
>   trial_end?: number,
>   start_date?: number,
>   offline_payment_method?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
>   contract_term_billing_cycle_on_renewal?: number,
>   free_period?: number,
>   free_period_unit?: day | week | month | year
> }
> ```

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] contract\_term full type
>
> ```ts theme={null}
> {
>   action_at_term_end?: renew | evergreen | cancel,
>   cancellation_cutoff_period?: number
> }
> ```

> [accordion] billing\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] subscription\_items full type
>
> ```ts theme={null}
> {
>   item_price_id: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   unit_price?: number[],
>   unit_price_in_decimal?: string[],
>   billing_cycles?: number[],
>   trial_end?: number[],
>   service_period_days?: number[],
>   charge_on_event?: (subscription_creation | subscription_trial_start | plan_activation | subscription_activation | contract_termination)[],
>   charge_once?: boolean[],
>   charge_on_option?: (immediately | on_event)[],
>   start_date?: number[],
>   end_date?: number[],
>   description?: string[],
>   ramp_tier_id?: string[]
> }
> ```

> [accordion] discounts full type
>
> ```ts theme={null}
> {
>   apply_on?: (invoice_amount | specific_item_price)[],
>   duration_type: (one_time | forever | limited_period)[],
>   percentage?: number[],
>   amount?: number[],
>   period?: number[],
>   period_unit?: (day | week | month | year)[],
>   included_in_mrr?: boolean[],
>   item_price_id?: string[],
>   quantity?: number[],
>   start_date?: number[],
>   end_date?: number[]
> }
> ```

> [accordion] item\_tiers full type
>
> ```ts theme={null}
> {
>   item_price_id?: string[],
>   starting_unit?: number[],
>   ending_unit?: number[],
>   price?: number[],
>   starting_unit_in_decimal?: string[],
>   ending_unit_in_decimal?: string[],
>   price_in_decimal?: string[],
>   pricing_type?: (per_unit | flat_fee | package)[],
>   package_size?: number[],
>   ramp_tier_id?: string[]
> }
> ```

> [accordion] coupons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   start_date?: number[],
>   end_date?: number[]
> }
> ```

> [accordion] entitlement\_overrides full type
>
> ```ts theme={null}
> {
>   feature_id?: string[],
>   entity_id?: string[],
>   entity_type?: (plan_price | addon_price | charge_price)[],
>   value?: string[],
>   is_enabled?: boolean[],
>   start_date?: number[],
>   end_date?: number[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `quote` | `object \| null` | No | A quote is an estimate of the invoice with the charges likely to occur when customers buy an item. A quote can be converted to a regular invoice once the customer accepts it. The line items of a quote are grouped by charge events and are available as a separate [resource](https://docs.corsair.dev/docs/api/quote_line_groups). This resource can be retrieved using the [List quote line groups](https://docs.corsair.dev/docs/api/quotes/list-quote-line-groups) endpoint. Note that the first quote line group is available within the quote resource itself and parsing the quote line groups object is not required. |
| `quoted_subscription` | `object \| null` | No | When a [quote](https://docs.corsair.dev/docs/api/quotes) is created, it generates the `quoted_subscription` resource. This captures most of the details of the subscription that would eventually be created once the quote is invoiced. This resource is returned along with the quote for most of the associated operations. |
| `quoted_ramp` | `object \| null` | No | When a [quote](https://docs.corsair.dev/docs/api/quotes) is created, it generates the `quoted_ramps` resource. This captures most of the details of the [ramps](https://docs.corsair.dev/docs/api/ramps) that would eventually be created once the quote is invoiced. This resource is returned along with the quote for most of the associated operations. **Note** Applicable only when Chargebee CPQ and [Subscription Ramps](https://docs.corsair.dev/docs/api/ramps) are enabled. To request access, contact [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). |

> [accordion] quote full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   po_number?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   invoice_id?: string | null,
>   status?: string | null,
>   operation_type?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   valid_till?: number | null,
>   date?: number | null,
>   total_payable?: number | null,
>   charge_on_acceptance?: number | null,
>   sub_total?: number | null,
>   total?: number | null,
>   credits_applied?: number | null,
>   amount_paid?: number | null,
>   amount_due?: number | null,
>   version?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   vat_number_prefix?: string | null,
>   tax_category?: string | null,
>   currency_code?: string | null,
>   notes?: any[] | null,
>   contract_term_start?: number | null,
>   contract_term_end?: number | null,
>   contract_term_termination_fee?: number | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null,
>   total_contract_value?: number | null,
>   total_discount?: number | null,
>   has_entitlements?: boolean | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null
> } | null
> ```

> [accordion] quoted\_subscription full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   billing_period?: number | null,
>   billing_period_unit?: string | null,
>   start_date?: number | null,
>   trial_end?: number | null,
>   remaining_billing_cycles?: number | null,
>   po_number?: string | null,
>   auto_collection?: string | null,
>   plan_quantity_in_decimal?: string | null,
>   plan_unit_price_in_decimal?: string | null,
>   changes_scheduled_at?: number | null,
>   change_option?: string | null,
>   free_period?: number | null,
>   free_period_unit?: string | null,
>   contract_term_billing_cycle_on_renewal?: number | null,
>   coupons?: {
>     coupon_id?: string | null
>   }[] | null,
>   discounts?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     description?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     quantity?: number | null,
>     currency_code?: string | null,
>     duration_type?: string | null,
>     period?: number | null,
>     period_unit?: string | null,
>     included_in_mrr?: boolean | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null,
>     apply_till?: number | null,
>     applied_count?: number | null,
>     coupon_id?: string | null,
>     index?: number | null
>   }[] | null,
>   subscription_items?: {
>     item_price_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     amount?: number | null,
>     current_term_start?: number | null,
>     current_term_end?: number | null,
>     next_billing_at?: number | null,
>     amount_in_decimal?: string | null,
>     billing_period?: number | null,
>     billing_period_unit?: string | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     trial_end?: number | null,
>     billing_cycles?: number | null,
>     service_period_days?: number | null,
>     charge_on_event?: string | null,
>     charge_once?: boolean | null,
>     charge_on_option?: string | null,
>     proration_type?: string | null,
>     usage_accumulation_reset_frequency?: string | null,
>     description?: string | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null,
>     index?: number | null
>   }[] | null,
>   quoted_contract_term?: {
>     contract_start?: number | null,
>     contract_end?: number | null,
>     billing_cycle?: number | null,
>     action_at_term_end?: string | null,
>     total_contract_value?: number | null,
>     cancellation_cutoff_period?: number | null
>   } | null
> } | null
> ```

> [accordion] quoted\_ramp full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   line_items?: {
>     item_price_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     amount?: number | null,
>     amount_in_decimal?: string | null,
>     billing_period?: number | null,
>     billing_period_unit?: string | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     billing_cycles?: number | null,
>     service_period_days?: number | null,
>     charge_on_event?: string | null,
>     charge_once?: boolean | null,
>     charge_on_option?: string | null,
>     start_date?: number | null,
>     end_date?: number | null,
>     ramp_tier_id?: string | null,
>     discount_per_billing_cycle?: number | null,
>     discount_per_billing_cycle_in_decimal?: string | null,
>     item_level_discount_per_billing_cycle?: number | null,
>     item_level_discount_per_billing_cycle_in_decimal?: string | null,
>     amount_per_billing_cycle?: number | null,
>     amount_per_billing_cycle_in_decimal?: string | null,
>     net_amount_per_billing_cycle?: number | null,
>     net_amount_per_billing_cycle_in_decimal?: string | null,
>     description?: string | null
>   }[] | null,
>   discounts?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     duration_type?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     period?: number | null,
>     period_unit?: string | null,
>     included_in_mrr?: boolean | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     start_date?: number | null,
>     end_date?: number | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     ramp_tier_id?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   coupon_applicability_mappings?: {
>     coupon_id?: string | null,
>     applicable_item_price_ids?: string[] | null
>   }[] | null
> } | null
> ```

***

### editForChargeItemsAndCharges

`quotes.editForChargeItemsAndCharges`

Edit a quote for charges and charge items. Changes the quote produced for adding one-time charges and charge items.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.quotes.editForChargeItemsAndCharges({ quoteId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `quoteId` | `string` | Yes | — |
| `po_number` | `string` | No | Purchase Order Number for this quote. |
| `notes` | `string` | No | Notes specific to this quote that you want customers to see on the quote PDF. |
| `expires_at` | `number` | No | Quotes will be valid till this date. After this quote will be marked as closed. |
| `currency_code` | `string` | No | The currency code (ISO 4217 format) of the quote. |
| `coupon` | `string` | No | The 'One Time' coupon to be applied. |
| `coupon_ids` | `string[]` | No | List of Coupons to be added. |
| `net_term_days` | `number` | No | The number of days within which the customer has to make payment for the invoice. **Note** The parameter applies only when Chargebee CPQ is enabled. To request access, contact [Chargebee Support](https://www.chargebee.com/docs/billing/2.0/kb/getting-started/how-to-contact-chargebees-support-team). |
| `billing_address` | `object` | No | Parameters for billing\_address |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `item_prices` | `object` | No | Parameters for item\_prices |
| `item_tiers` | `object` | No | Parameters for item\_tiers |
| `charges` | `object` | No | Parameters for charges |
| `discounts` | `object` | No | Parameters for discounts |
| `tax_providers_fields` | `object` | No | Parameters for tax\_providers\_fields |

> [accordion] billing\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] item\_prices full type
>
> ```ts theme={null}
> {
>   item_price_id?: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   unit_price?: number[],
>   unit_price_in_decimal?: string[],
>   service_period_days?: number[]
> }
> ```

> [accordion] item\_tiers full type
>
> ```ts theme={null}
> {
>   item_price_id?: string[],
>   starting_unit?: number[],
>   ending_unit?: number[],
>   price?: number[],
>   starting_unit_in_decimal?: string[],
>   ending_unit_in_decimal?: string[],
>   price_in_decimal?: string[],
>   pricing_type?: (per_unit | flat_fee | package)[],
>   package_size?: number[]
> }
> ```

> [accordion] charges full type
>
> ```ts theme={null}
> {
>   amount?: number[],
>   amount_in_decimal?: string[],
>   description?: string[],
>   avalara_sale_type?: (wholesale | retail | consumed | vendor_use)[],
>   avalara_transaction_type?: number[],
>   avalara_service_type?: number[],
>   service_period?: number[]
> }
> ```

> [accordion] discounts full type
>
> ```ts theme={null}
> {
>   percentage?: number[],
>   quantity?: number[],
>   amount?: number[],
>   apply_on: (invoice_amount | specific_item_price)[],
>   item_price_id?: string[]
> }
> ```

> [accordion] tax\_providers\_fields full type
>
> ```ts theme={null}
> {
>   provider_name?: string[],
>   field_id?: string[],
>   field_value?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `quote` | `object \| null` | No | A quote is an estimate of the invoice with the charges likely to occur when customers buy an item. A quote can be converted to a regular invoice once the customer accepts it. The line items of a quote are grouped by charge events and are available as a separate [resource](https://docs.corsair.dev/docs/api/quote_line_groups). This resource can be retrieved using the [List quote line groups](https://docs.corsair.dev/docs/api/quotes/list-quote-line-groups) endpoint. Note that the first quote line group is available within the quote resource itself and parsing the quote line groups object is not required. |
| `quoted_charge` | `object \| null` | No | When the [operation\_type](https://docs.corsair.dev/docs/api/quotes/quote-object#operation_type) of a `quote` is `onetime_invoice` , the `quoted_charges` resource contains the details of the invoice that is eventually created once the quote is invoiced. It is always returned along with the quote. |

> [accordion] quote full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   po_number?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   invoice_id?: string | null,
>   status?: string | null,
>   operation_type?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   valid_till?: number | null,
>   date?: number | null,
>   total_payable?: number | null,
>   charge_on_acceptance?: number | null,
>   sub_total?: number | null,
>   total?: number | null,
>   credits_applied?: number | null,
>   amount_paid?: number | null,
>   amount_due?: number | null,
>   version?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   vat_number_prefix?: string | null,
>   tax_category?: string | null,
>   currency_code?: string | null,
>   notes?: any[] | null,
>   contract_term_start?: number | null,
>   contract_term_end?: number | null,
>   contract_term_termination_fee?: number | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null,
>   total_contract_value?: number | null,
>   total_discount?: number | null,
>   has_entitlements?: boolean | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null
> } | null
> ```

> [accordion] quoted\_charge full type
>
> ```ts theme={null}
> {
>   charges?: {
>     amount?: number | null,
>     amount_in_decimal?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     service_period_in_days?: number | null,
>     avalara_sale_type?: string | null,
>     avalara_transaction_type?: number | null,
>     avalara_service_type?: number | null
>   }[] | null,
>   invoice_items?: {
>     item_price_id?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     service_period_days?: number | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null,
>     index?: number | null
>   }[] | null,
>   coupons?: {
>     coupon_id?: string | null
>   }[] | null,
>   discounts?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     description?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     quantity?: number | null,
>     currency_code?: string | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null,
>     coupon_id?: string | null,
>     index?: number | null
>   }[] | null,
>   coupon_applicability_mappings?: {
>     coupon_id?: string | null,
>     applicable_item_price_ids?: string[] | null
>   }[] | null
> } | null
> ```

***

### editOneTimeQuote

`quotes.editOneTimeQuote`

Edit quote for one-time charges. Edits a quote. The quote must be for one-time charges or non-recurring addons. To edit quotes created for subscriptions, use: \* ​​Edit quote for new subscription. \* Edit quote for updating a subscription. Product Catalog 1.0 sites only.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.quotes.editOneTimeQuote({ quoteId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `quoteId` | `string` | Yes | — |
| `po_number` | `string` | No | Purchase Order Number for this quote. |
| `notes` | `string` | No | Notes specific to this quote that you want customers to see on the quote PDF. |
| `expires_at` | `number` | No | Quotes will be valid till this date. After this quote will be marked as closed. |
| `currency_code` | `string` | No | The currency code (ISO 4217 format) of the quote. |
| `coupon` | `string` | No | The 'One Time' coupon to be applied. |
| `coupon_ids` | `string[]` | No | List of Coupons to be added. |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `addons` | `object` | No | Parameters for addons |
| `charges` | `object` | No | Parameters for charges |
| `tax_providers_fields` | `object` | No | Parameters for tax\_providers\_fields |

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   unit_price?: number[],
>   unit_price_in_decimal?: string[],
>   service_period?: number[]
> }
> ```

> [accordion] charges full type
>
> ```ts theme={null}
> {
>   amount?: number[],
>   amount_in_decimal?: string[],
>   description?: string[],
>   avalara_sale_type?: (wholesale | retail | consumed | vendor_use)[],
>   avalara_transaction_type?: number[],
>   avalara_service_type?: number[],
>   service_period?: number[]
> }
> ```

> [accordion] tax\_providers\_fields full type
>
> ```ts theme={null}
> {
>   provider_name?: string[],
>   field_id?: string[],
>   field_value?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `quote` | `object \| null` | No | A quote is an estimate of the invoice with the charges likely to occur when customers buy an item. A quote can be converted to a regular invoice once the customer accepts it. The line items of a quote are grouped by charge events and are available as a separate [resource](https://docs.corsair.dev/docs/api/quote_line_groups). This resource can be retrieved using the [List quote line groups](https://docs.corsair.dev/docs/api/quotes/list-quote-line-groups) endpoint. Note that the first quote line group is available within the quote resource itself and parsing the quote line groups object is not required. |
| `quoted_charge` | `object \| null` | No | When the [operation\_type](https://docs.corsair.dev/docs/api/quotes/quote-object#operation_type) of a `quote` is `onetime_invoice` , the `quoted_charges` resource contains the details of the invoice that is eventually created once the quote is invoiced. It is always returned along with the quote. |

> [accordion] quote full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   po_number?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   invoice_id?: string | null,
>   status?: string | null,
>   operation_type?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   valid_till?: number | null,
>   date?: number | null,
>   total_payable?: number | null,
>   charge_on_acceptance?: number | null,
>   sub_total?: number | null,
>   total?: number | null,
>   credits_applied?: number | null,
>   amount_paid?: number | null,
>   amount_due?: number | null,
>   version?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   vat_number_prefix?: string | null,
>   tax_category?: string | null,
>   currency_code?: string | null,
>   notes?: any[] | null,
>   contract_term_start?: number | null,
>   contract_term_end?: number | null,
>   contract_term_termination_fee?: number | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null,
>   total_contract_value?: number | null,
>   total_discount?: number | null,
>   has_entitlements?: boolean | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null
> } | null
> ```

> [accordion] quoted\_charge full type
>
> ```ts theme={null}
> {
>   charges?: {
>     amount?: number | null,
>     amount_in_decimal?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     service_period_in_days?: number | null,
>     avalara_sale_type?: string | null,
>     avalara_transaction_type?: number | null,
>     avalara_service_type?: number | null
>   }[] | null,
>   addons?: {
>     id?: string | null,
>     quantity?: number | null,
>     unit_price?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price_in_decimal?: string | null,
>     proration_type?: string | null,
>     service_period?: number | null
>   }[] | null,
>   coupons?: {
>     coupon_id?: string | null
>   }[] | null,
>   coupon_applicability_mappings?: {
>     coupon_id?: string | null,
>     applicable_item_price_ids?: string[] | null
>   }[] | null
> } | null
> ```

***

### editUpdateSubscriptionQuote

`quotes.editUpdateSubscriptionQuote`

Edit quote for updating a subscription. Edits a quote. This endpoint is for editing quotes that are for updating a subscription. To edit a quote for a new subscription, use Edit quote for a new subscription. Product Catalog 1.0 sites only.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.quotes.editUpdateSubscriptionQuote({ quoteId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `quoteId` | `string` | Yes | — |
| `notes` | `string` | No | Notes specific to this quote that you want customers to see on the quote PDF. |
| `expires_at` | `number` | No | Quotes will be valid till this date. After this quote will be marked as closed. |
| `replace_addon_list` | `boolean` | No | Should be true if the existing addons should be replaced with the ones that are being passed. |
| `mandatory_addons_to_remove` | `string[]` | No | List of addons IDs that are mandatory to the plan and has to be removed from the subscription. |
| `billing_cycles` | `number` | No | 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` | `number` | No | 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` | `number` | No | 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` | `immediate \| delayed` | No | 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. \* 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` | `string[]` | No | Identifier of the coupon as a List. Coupon Codes can also be passed. |
| `replace_coupon_list` | `boolean` | No | Should be true if the existing coupons should be replaced with the ones that are being passed. |
| `change_option` | `immediately \| specific_date` | No | When the quote is converted, this attribute determines the date/time as of when the subscription change is to be carried out. \* specific\_date - The change is carried out as of the date specified under `changes_scheduled_at` . \* immediately - The change is carried out immediately. |
| `changes_scheduled_at` | `number` | No | When `change_option` is set to `specific_date` , then set the date/time at which the subscription change is to happen or has happened. `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 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 subscription's plan is 2 months and today is 14th April, `changes_scheduled_at` cannot be earlier than 14th February. . |
| `force_term_reset` | `boolean` | No | Applicable for 'Active' \\& 'Non Renewing' states alone. Generally, subscription's term will be reset (i.e current term is ended and a new term starts immediately) when a new plan having different billing frequency is specified in the input. For all the other cases, the subscription's term will remain intact. Now for this later scenario, if you want to force a term reset you can specify this param as 'true'. **Note**: Specifying this value as 'false' has no impact on the default behaviour. |
| `reactivate` | `boolean` | No | Applicable only for cancelled subscriptions. Once this is passed as true, cancelled subscription will become active; otherwise subscription changes will be made but the subscription state will remain cancelled. If not passed, subscription will be activated only if there is any change in subscription data. |
| `subscription` | `object` | No | Parameters for subscription |
| `billing_address` | `object` | No | Parameters for billing\_address |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `customer` | `object` | No | Parameters for customer |
| `contract_term` | `object` | No | Parameters for contract\_term |
| `addons` | `object` | No | Parameters for addons |
| `event_based_addons` | `object` | No | Parameters for event\_based\_addons |

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   plan_id?: string,
>   plan_quantity?: number,
>   plan_unit_price?: number,
>   setup_fee?: number,
>   plan_quantity_in_decimal?: string,
>   plan_unit_price_in_decimal?: string,
>   start_date?: number,
>   trial_end?: number,
>   auto_collection?: on | off,
>   offline_payment_method?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
>   contract_term_billing_cycle_on_renewal?: number
> }
> ```

> [accordion] billing\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   vat_number?: string,
>   vat_number_prefix?: string,
>   registered_for_gst?: boolean
> }
> ```

> [accordion] contract\_term full type
>
> ```ts theme={null}
> {
>   action_at_term_end?: renew | evergreen | cancel | renew_once,
>   cancellation_cutoff_period?: number
> }
> ```

> [accordion] addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   unit_price?: number[],
>   billing_cycles?: number[],
>   quantity_in_decimal?: string[],
>   unit_price_in_decimal?: string[],
>   trial_end?: number[]
> }
> ```

> [accordion] event\_based\_addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   unit_price?: number[],
>   service_period_in_days?: number[],
>   charge_on?: (immediately | on_event)[],
>   on_event?: (subscription_creation | subscription_trial_start | plan_activation | subscription_activation | contract_termination)[],
>   charge_once?: boolean[],
>   quantity_in_decimal?: string[],
>   unit_price_in_decimal?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `quote` | `object \| null` | No | A quote is an estimate of the invoice with the charges likely to occur when customers buy an item. A quote can be converted to a regular invoice once the customer accepts it. The line items of a quote are grouped by charge events and are available as a separate [resource](https://docs.corsair.dev/docs/api/quote_line_groups). This resource can be retrieved using the [List quote line groups](https://docs.corsair.dev/docs/api/quotes/list-quote-line-groups) endpoint. Note that the first quote line group is available within the quote resource itself and parsing the quote line groups object is not required. |
| `quoted_subscription` | `object \| null` | No | When a [quote](https://docs.corsair.dev/docs/api/quotes) is created, it generates the `quoted_subscription` resource. This captures most of the details of the subscription that would eventually be created once the quote is invoiced. This resource is returned along with the quote for most of the associated operations. |

> [accordion] quote full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   po_number?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   invoice_id?: string | null,
>   status?: string | null,
>   operation_type?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   valid_till?: number | null,
>   date?: number | null,
>   total_payable?: number | null,
>   charge_on_acceptance?: number | null,
>   sub_total?: number | null,
>   total?: number | null,
>   credits_applied?: number | null,
>   amount_paid?: number | null,
>   amount_due?: number | null,
>   version?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   vat_number_prefix?: string | null,
>   tax_category?: string | null,
>   currency_code?: string | null,
>   notes?: any[] | null,
>   contract_term_start?: number | null,
>   contract_term_end?: number | null,
>   contract_term_termination_fee?: number | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null,
>   total_contract_value?: number | null,
>   total_discount?: number | null,
>   has_entitlements?: boolean | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null
> } | null
> ```

> [accordion] quoted\_subscription full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   plan_id?: string | null,
>   plan_quantity?: number | null,
>   plan_unit_price?: number | null,
>   setup_fee?: number | null,
>   billing_period?: number | null,
>   billing_period_unit?: string | null,
>   start_date?: number | null,
>   trial_end?: number | null,
>   remaining_billing_cycles?: number | null,
>   po_number?: string | null,
>   auto_collection?: string | null,
>   plan_quantity_in_decimal?: string | null,
>   plan_unit_price_in_decimal?: string | null,
>   changes_scheduled_at?: number | null,
>   change_option?: string | null,
>   free_period?: number | null,
>   free_period_unit?: string | null,
>   contract_term_billing_cycle_on_renewal?: number | null,
>   addons?: {
>     id?: string | null,
>     quantity?: number | null,
>     unit_price?: number | null,
>     amount?: number | null,
>     trial_end?: number | null,
>     remaining_billing_cycles?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     proration_type?: string | null
>   }[] | null,
>   event_based_addons?: {
>     id?: string | null,
>     quantity?: number | null,
>     unit_price?: number | null,
>     on_event?: string | null,
>     charge_once?: boolean | null,
>     quantity_in_decimal?: string | null,
>     unit_price_in_decimal?: string | null
>   }[] | null,
>   coupons?: {
>     coupon_id?: string | null
>   }[] | null,
>   quoted_contract_term?: {
>     contract_start?: number | null,
>     contract_end?: number | null,
>     billing_cycle?: number | null,
>     action_at_term_end?: string | null,
>     total_contract_value?: number | null,
>     cancellation_cutoff_period?: number | null
>   } | null
> } | null
> ```

***

### editUpdateSubscriptionQuoteForItems

`quotes.editUpdateSubscriptionQuoteForItems`

Edit a quote for subscription update. Edits a quote for updating a subscription. ### Impacts #### Quote and related resources If the quote is for a scheduled change, then the following resources are updated: \* When Ramps are disabled, the quote and the quoted\_subscription are updated.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.quotes.editUpdateSubscriptionQuoteForItems({ quoteId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `quoteId` | `string` | Yes | — |
| `notes` | `string` | No | Notes specific to this quote that you want customers to see on the quote PDF. |
| `expires_at` | `number` | No | Quotes will be valid till this date. After this quote will be marked as closed. |
| `mandatory_items_to_remove` | `string[]` | No | Item ids of [mandatorily attached addons](https://docs.corsair.dev/docs/api/attached_items) that are to be removed from the subscription. |
| `replace_items_list` | `boolean` | No | If `true` then the existing `subscription_items` list for the subscription is replaced by the one provided. If `false` then the provided `subscription_items` list gets added to the existing list. |
| `billing_cycles` | `number` | No | Billing cycles set for plan-item price is used by default. |
| `terms_to_charge` | `number` | No | 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` | `number` | No | 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` | `immediate \| delayed` | No | 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. \* 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` | `string[]` | No | The list of [IDs](https://docs.corsair.dev/docs/api/coupons/coupon-object#id) of the coupons to be applied. [Coupon codes](https://docs.corsair.dev/docs/api/coupon_codes) are also supported. **Note** Not applicable when Chargebee CPQ is enabled. Use `coupons[]` array instead. |
| `replace_coupon_list` | `boolean` | No | Should be true if the existing coupons should be replaced with the ones that are being passed. |
| `change_option` | `immediately \| specific_date` | No | When the quote is converted, this attribute determines the date/time as of when the subscription change is to be carried out. \* specific\_date - The change is carried out as of the date specified under `changes_scheduled_at` . \* immediately - The change is carried out immediately. |
| `changes_scheduled_at` | `number` | No | When `change_option` is set to `specific_date`, then set the date-time at which the subscription change is to happen or has happened. **Constraints** \* Do not pass this parameter along with `reactivate_from`. \* The `changes_scheduled_at` parameter does not apply to `auto_collection`, `shipping_address`, and `po_number`; these parameters take effect **immediately** when scheduling a subscription update. **Backdated changes** `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](https://www.chargebee.com/docs/billing/2.0/subscriptions/backdating#configuring-backdated-subscription-actions-and-invoicing) 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. **Renewing a fixed-term subscription through Chargebee CPQ** For Chargebee CPQ, set `change_option` to `specific_date` and set `changes_scheduled_at` to the current subscription's end timestamp (UTC, in seconds). That timestamp is the start of the new term. When the subscription has an active contract term, use the contract end. The API accepts only that exact value. Also set `subscription_items[start_date]` to the same timestamp and `subscription_items[end_date]` to the end of the new term. The subscription must have remaining billing cycles, and its `status` must be `active`, `non_renewing`, or `paused`. |
| `force_term_reset` | `boolean` | No | Applicable for 'Active' \\& 'Non Renewing' states alone. Generally, subscription's term will be reset (i.e current term is ended and a new term starts immediately) when a new plan having different billing frequency is specified in the input. For all the other cases, the subscription's term will remain intact. Now for this later scenario, if you want to force a term reset you can specify this param as 'true'. **Note**: Specifying this value as 'false' has no impact on the default behaviour. |
| `reactivate` | `boolean` | No | Applicable only for cancelled subscriptions. Once this is passed as true, cancelled subscription will become active; otherwise subscription changes will be made but the subscription state will remain cancelled. If not passed, subscription will be activated only if there is any change in subscription data. |
| `net_term_days` | `number` | No | The number of days from [`invoice.date`](https://docs.corsair.dev/docs/api/invoices/invoice-object#date) until payment for the invoice is due. **Note** The parameter applies only when Chargebee CPQ is enabled. To request access, contact [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). |
| `subscription` | `object` | No | Parameters for subscription |
| `billing_address` | `object` | No | Parameters for billing\_address |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `customer` | `object` | No | Parameters for customer |
| `contract_term` | `object` | No | Parameters for contract\_term |
| `subscription_items` | `object` | No | Parameters for subscription\_items |
| `discounts` | `object` | No | Parameters for discounts |
| `item_tiers` | `object` | No | Parameters for item\_tiers |
| `coupons` | `object` | No | — |
| `entitlement_overrides` | `object` | No | The set of entitlement overrides to apply on this quote. Each entry targets a feature for an entity on the quote. Overrides are always upserted. |

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   start_date?: number,
>   trial_end?: number,
>   auto_collection?: on | off,
>   offline_payment_method?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
>   contract_term_billing_cycle_on_renewal?: number
> }
> ```

> [accordion] billing\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   vat_number?: string,
>   vat_number_prefix?: string,
>   registered_for_gst?: boolean
> }
> ```

> [accordion] contract\_term full type
>
> ```ts theme={null}
> {
>   action_at_term_end?: renew | evergreen | cancel | renew_once,
>   cancellation_cutoff_period?: number
> }
> ```

> [accordion] subscription\_items full type
>
> ```ts theme={null}
> {
>   item_price_id: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   unit_price?: number[],
>   unit_price_in_decimal?: string[],
>   billing_cycles?: number[],
>   trial_end?: number[],
>   service_period_days?: number[],
>   charge_on_event?: (subscription_creation | subscription_trial_start | plan_activation | subscription_activation | contract_termination)[],
>   charge_once?: boolean[],
>   charge_on_option?: (immediately | on_event)[],
>   start_date?: number[],
>   end_date?: number[],
>   description?: string[],
>   ramp_tier_id?: string[]
> }
> ```

> [accordion] discounts full type
>
> ```ts theme={null}
> {
>   apply_on?: (invoice_amount | specific_item_price)[],
>   duration_type: (one_time | forever | limited_period)[],
>   percentage?: number[],
>   amount?: number[],
>   period?: number[],
>   period_unit?: (day | week | month | year)[],
>   included_in_mrr?: boolean[],
>   item_price_id?: string[],
>   quantity?: number[],
>   operation_type: (add | remove)[],
>   id?: string[],
>   start_date?: number[],
>   end_date?: number[]
> }
> ```

> [accordion] item\_tiers full type
>
> ```ts theme={null}
> {
>   item_price_id?: string[],
>   starting_unit?: number[],
>   ending_unit?: number[],
>   price?: number[],
>   starting_unit_in_decimal?: string[],
>   ending_unit_in_decimal?: string[],
>   price_in_decimal?: string[],
>   pricing_type?: (per_unit | flat_fee | package)[],
>   package_size?: number[],
>   ramp_tier_id?: string[]
> }
> ```

> [accordion] coupons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   start_date?: number[],
>   end_date?: number[]
> }
> ```

> [accordion] entitlement\_overrides full type
>
> ```ts theme={null}
> {
>   feature_id?: string[],
>   entity_id?: string[],
>   entity_type?: (plan_price | addon_price | charge_price)[],
>   value?: string[],
>   is_enabled?: boolean[],
>   start_date?: number[],
>   end_date?: number[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `quote` | `object \| null` | No | A quote is an estimate of the invoice with the charges likely to occur when customers buy an item. A quote can be converted to a regular invoice once the customer accepts it. The line items of a quote are grouped by charge events and are available as a separate [resource](https://docs.corsair.dev/docs/api/quote_line_groups). This resource can be retrieved using the [List quote line groups](https://docs.corsair.dev/docs/api/quotes/list-quote-line-groups) endpoint. Note that the first quote line group is available within the quote resource itself and parsing the quote line groups object is not required. |
| `quoted_subscription` | `object \| null` | No | When a [quote](https://docs.corsair.dev/docs/api/quotes) is created, it generates the `quoted_subscription` resource. This captures most of the details of the subscription that would eventually be created once the quote is invoiced. This resource is returned along with the quote for most of the associated operations. |
| `quoted_ramp` | `object \| null` | No | When a [quote](https://docs.corsair.dev/docs/api/quotes) is created, it generates the `quoted_ramps` resource. This captures most of the details of the [ramps](https://docs.corsair.dev/docs/api/ramps) that would eventually be created once the quote is invoiced. This resource is returned along with the quote for most of the associated operations. **Note** Applicable only when Chargebee CPQ and [Subscription Ramps](https://docs.corsair.dev/docs/api/ramps) are enabled. To request access, contact [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). |

> [accordion] quote full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   po_number?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   invoice_id?: string | null,
>   status?: string | null,
>   operation_type?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   valid_till?: number | null,
>   date?: number | null,
>   total_payable?: number | null,
>   charge_on_acceptance?: number | null,
>   sub_total?: number | null,
>   total?: number | null,
>   credits_applied?: number | null,
>   amount_paid?: number | null,
>   amount_due?: number | null,
>   version?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   vat_number_prefix?: string | null,
>   tax_category?: string | null,
>   currency_code?: string | null,
>   notes?: any[] | null,
>   contract_term_start?: number | null,
>   contract_term_end?: number | null,
>   contract_term_termination_fee?: number | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null,
>   total_contract_value?: number | null,
>   total_discount?: number | null,
>   has_entitlements?: boolean | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null
> } | null
> ```

> [accordion] quoted\_subscription full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   billing_period?: number | null,
>   billing_period_unit?: string | null,
>   start_date?: number | null,
>   trial_end?: number | null,
>   remaining_billing_cycles?: number | null,
>   po_number?: string | null,
>   auto_collection?: string | null,
>   plan_quantity_in_decimal?: string | null,
>   plan_unit_price_in_decimal?: string | null,
>   changes_scheduled_at?: number | null,
>   change_option?: string | null,
>   free_period?: number | null,
>   free_period_unit?: string | null,
>   contract_term_billing_cycle_on_renewal?: number | null,
>   coupons?: {
>     coupon_id?: string | null
>   }[] | null,
>   discounts?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     description?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     quantity?: number | null,
>     currency_code?: string | null,
>     duration_type?: string | null,
>     period?: number | null,
>     period_unit?: string | null,
>     included_in_mrr?: boolean | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null,
>     apply_till?: number | null,
>     applied_count?: number | null,
>     coupon_id?: string | null,
>     index?: number | null
>   }[] | null,
>   subscription_items?: {
>     item_price_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     amount?: number | null,
>     current_term_start?: number | null,
>     current_term_end?: number | null,
>     next_billing_at?: number | null,
>     amount_in_decimal?: string | null,
>     billing_period?: number | null,
>     billing_period_unit?: string | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     trial_end?: number | null,
>     billing_cycles?: number | null,
>     service_period_days?: number | null,
>     charge_on_event?: string | null,
>     charge_once?: boolean | null,
>     charge_on_option?: string | null,
>     proration_type?: string | null,
>     usage_accumulation_reset_frequency?: string | null,
>     description?: string | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null,
>     index?: number | null
>   }[] | null,
>   quoted_contract_term?: {
>     contract_start?: number | null,
>     contract_end?: number | null,
>     billing_cycle?: number | null,
>     action_at_term_end?: string | null,
>     total_contract_value?: number | null,
>     cancellation_cutoff_period?: number | null
>   } | null
> } | null
> ```

> [accordion] quoted\_ramp full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   line_items?: {
>     item_price_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     amount?: number | null,
>     amount_in_decimal?: string | null,
>     billing_period?: number | null,
>     billing_period_unit?: string | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     billing_cycles?: number | null,
>     service_period_days?: number | null,
>     charge_on_event?: string | null,
>     charge_once?: boolean | null,
>     charge_on_option?: string | null,
>     start_date?: number | null,
>     end_date?: number | null,
>     ramp_tier_id?: string | null,
>     discount_per_billing_cycle?: number | null,
>     discount_per_billing_cycle_in_decimal?: string | null,
>     item_level_discount_per_billing_cycle?: number | null,
>     item_level_discount_per_billing_cycle_in_decimal?: string | null,
>     amount_per_billing_cycle?: number | null,
>     amount_per_billing_cycle_in_decimal?: string | null,
>     net_amount_per_billing_cycle?: number | null,
>     net_amount_per_billing_cycle_in_decimal?: string | null,
>     description?: string | null
>   }[] | null,
>   discounts?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     duration_type?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     period?: number | null,
>     period_unit?: string | null,
>     included_in_mrr?: boolean | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     start_date?: number | null,
>     end_date?: number | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     ramp_tier_id?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   coupon_applicability_mappings?: {
>     coupon_id?: string | null,
>     applicable_item_price_ids?: string[] | null
>   }[] | null
> } | null
> ```

***

### extendExpiryDate

`quotes.extendExpiryDate`

Extend expiry date. Can be used to extend the expiry date of a quote.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.quotes.extendExpiryDate({ quoteId: 'example', valid_till: 1 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `quoteId` | `string` | Yes | — |
| `valid_till` | `number` | Yes | Quote will be valid till this date. After this date quote will be marked as closed. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `quote` | `object \| null` | No | A quote is an estimate of the invoice with the charges likely to occur when customers buy an item. A quote can be converted to a regular invoice once the customer accepts it. The line items of a quote are grouped by charge events and are available as a separate [resource](https://docs.corsair.dev/docs/api/quote_line_groups). This resource can be retrieved using the [List quote line groups](https://docs.corsair.dev/docs/api/quotes/list-quote-line-groups) endpoint. Note that the first quote line group is available within the quote resource itself and parsing the quote line groups object is not required. |
| `quoted_subscription` | `object \| null` | No | When a [quote](https://docs.corsair.dev/docs/api/quotes) is created, it generates the `quoted_subscription` resource. This captures most of the details of the subscription that would eventually be created once the quote is invoiced. This resource is returned along with the quote for most of the associated operations. |
| `quoted_charge` | `object \| null` | No | When the [operation\_type](https://docs.corsair.dev/docs/api/quotes/quote-object#operation_type) of a `quote` is `onetime_invoice` , the `quoted_charges` resource contains the details of the invoice that is eventually created once the quote is invoiced. It is always returned along with the quote. |
| `quoted_ramp` | `object \| null` | No | When a [quote](https://docs.corsair.dev/docs/api/quotes) is created, it generates the `quoted_ramps` resource. This captures most of the details of the [ramps](https://docs.corsair.dev/docs/api/ramps) that would eventually be created once the quote is invoiced. This resource is returned along with the quote for most of the associated operations. **Note** Applicable only when Chargebee CPQ and [Subscription Ramps](https://docs.corsair.dev/docs/api/ramps) are enabled. To request access, contact [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). |

> [accordion] quote full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   po_number?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   invoice_id?: string | null,
>   status?: string | null,
>   operation_type?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   valid_till?: number | null,
>   date?: number | null,
>   total_payable?: number | null,
>   charge_on_acceptance?: number | null,
>   sub_total?: number | null,
>   total?: number | null,
>   credits_applied?: number | null,
>   amount_paid?: number | null,
>   amount_due?: number | null,
>   version?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   vat_number_prefix?: string | null,
>   tax_category?: string | null,
>   currency_code?: string | null,
>   notes?: any[] | null,
>   contract_term_start?: number | null,
>   contract_term_end?: number | null,
>   contract_term_termination_fee?: number | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null,
>   total_contract_value?: number | null,
>   total_discount?: number | null,
>   has_entitlements?: boolean | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null
> } | null
> ```

> [accordion] quoted\_subscription full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   billing_period?: number | null,
>   billing_period_unit?: string | null,
>   start_date?: number | null,
>   trial_end?: number | null,
>   remaining_billing_cycles?: number | null,
>   po_number?: string | null,
>   auto_collection?: string | null,
>   plan_quantity_in_decimal?: string | null,
>   plan_unit_price_in_decimal?: string | null,
>   changes_scheduled_at?: number | null,
>   change_option?: string | null,
>   free_period?: number | null,
>   free_period_unit?: string | null,
>   contract_term_billing_cycle_on_renewal?: number | null,
>   coupons?: {
>     coupon_id?: string | null
>   }[] | null,
>   discounts?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     description?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     quantity?: number | null,
>     currency_code?: string | null,
>     duration_type?: string | null,
>     period?: number | null,
>     period_unit?: string | null,
>     included_in_mrr?: boolean | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null,
>     apply_till?: number | null,
>     applied_count?: number | null,
>     coupon_id?: string | null,
>     index?: number | null
>   }[] | null,
>   subscription_items?: {
>     item_price_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     amount?: number | null,
>     current_term_start?: number | null,
>     current_term_end?: number | null,
>     next_billing_at?: number | null,
>     amount_in_decimal?: string | null,
>     billing_period?: number | null,
>     billing_period_unit?: string | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     trial_end?: number | null,
>     billing_cycles?: number | null,
>     service_period_days?: number | null,
>     charge_on_event?: string | null,
>     charge_once?: boolean | null,
>     charge_on_option?: string | null,
>     proration_type?: string | null,
>     usage_accumulation_reset_frequency?: string | null,
>     description?: string | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null,
>     index?: number | null
>   }[] | null,
>   quoted_contract_term?: {
>     contract_start?: number | null,
>     contract_end?: number | null,
>     billing_cycle?: number | null,
>     action_at_term_end?: string | null,
>     total_contract_value?: number | null,
>     cancellation_cutoff_period?: number | null
>   } | null
> } | null
> ```

> [accordion] quoted\_charge full type
>
> ```ts theme={null}
> {
>   charges?: {
>     amount?: number | null,
>     amount_in_decimal?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     service_period_in_days?: number | null,
>     avalara_sale_type?: string | null,
>     avalara_transaction_type?: number | null,
>     avalara_service_type?: number | null
>   }[] | null,
>   invoice_items?: {
>     item_price_id?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     service_period_days?: number | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null,
>     index?: number | null
>   }[] | null,
>   coupons?: {
>     coupon_id?: string | null
>   }[] | null,
>   discounts?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     description?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     quantity?: number | null,
>     currency_code?: string | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null,
>     coupon_id?: string | null,
>     index?: number | null
>   }[] | null,
>   coupon_applicability_mappings?: {
>     coupon_id?: string | null,
>     applicable_item_price_ids?: string[] | null
>   }[] | null
> } | null
> ```

> [accordion] quoted\_ramp full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   line_items?: {
>     item_price_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     amount?: number | null,
>     amount_in_decimal?: string | null,
>     billing_period?: number | null,
>     billing_period_unit?: string | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     billing_cycles?: number | null,
>     service_period_days?: number | null,
>     charge_on_event?: string | null,
>     charge_once?: boolean | null,
>     charge_on_option?: string | null,
>     start_date?: number | null,
>     end_date?: number | null,
>     ramp_tier_id?: string | null,
>     discount_per_billing_cycle?: number | null,
>     discount_per_billing_cycle_in_decimal?: string | null,
>     item_level_discount_per_billing_cycle?: number | null,
>     item_level_discount_per_billing_cycle_in_decimal?: string | null,
>     amount_per_billing_cycle?: number | null,
>     amount_per_billing_cycle_in_decimal?: string | null,
>     net_amount_per_billing_cycle?: number | null,
>     net_amount_per_billing_cycle_in_decimal?: string | null,
>     description?: string | null
>   }[] | null,
>   discounts?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     duration_type?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     period?: number | null,
>     period_unit?: string | null,
>     included_in_mrr?: boolean | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     start_date?: number | null,
>     end_date?: number | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     ramp_tier_id?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   coupon_applicability_mappings?: {
>     coupon_id?: string | null,
>     applicable_item_price_ids?: string[] | null
>   }[] | null
> } | null
> ```

***

### get

`quotes.get`

Retrieve a quote. Retrieves the quotes identified by the 'number' specified in the url.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.quotes.get({ quoteId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `quoteId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `quote` | `object \| null` | No | A quote is an estimate of the invoice with the charges likely to occur when customers buy an item. A quote can be converted to a regular invoice once the customer accepts it. The line items of a quote are grouped by charge events and are available as a separate [resource](https://docs.corsair.dev/docs/api/quote_line_groups). This resource can be retrieved using the [List quote line groups](https://docs.corsair.dev/docs/api/quotes/list-quote-line-groups) endpoint. Note that the first quote line group is available within the quote resource itself and parsing the quote line groups object is not required. |
| `quoted_subscription` | `object \| null` | No | When a [quote](https://docs.corsair.dev/docs/api/quotes) is created, it generates the `quoted_subscription` resource. This captures most of the details of the subscription that would eventually be created once the quote is invoiced. This resource is returned along with the quote for most of the associated operations. |
| `quoted_charge` | `object \| null` | No | When the [operation\_type](https://docs.corsair.dev/docs/api/quotes/quote-object#operation_type) of a `quote` is `onetime_invoice` , the `quoted_charges` resource contains the details of the invoice that is eventually created once the quote is invoiced. It is always returned along with the quote. |
| `quoted_ramp` | `object \| null` | No | When a [quote](https://docs.corsair.dev/docs/api/quotes) is created, it generates the `quoted_ramps` resource. This captures most of the details of the [ramps](https://docs.corsair.dev/docs/api/ramps) that would eventually be created once the quote is invoiced. This resource is returned along with the quote for most of the associated operations. **Note** Applicable only when Chargebee CPQ and [Subscription Ramps](https://docs.corsair.dev/docs/api/ramps) are enabled. To request access, contact [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). |

> [accordion] quote full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   po_number?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   invoice_id?: string | null,
>   status?: string | null,
>   operation_type?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   valid_till?: number | null,
>   date?: number | null,
>   total_payable?: number | null,
>   charge_on_acceptance?: number | null,
>   sub_total?: number | null,
>   total?: number | null,
>   credits_applied?: number | null,
>   amount_paid?: number | null,
>   amount_due?: number | null,
>   version?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   vat_number_prefix?: string | null,
>   tax_category?: string | null,
>   currency_code?: string | null,
>   notes?: any[] | null,
>   contract_term_start?: number | null,
>   contract_term_end?: number | null,
>   contract_term_termination_fee?: number | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null,
>   total_contract_value?: number | null,
>   total_discount?: number | null,
>   has_entitlements?: boolean | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null
> } | null
> ```

> [accordion] quoted\_subscription full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   billing_period?: number | null,
>   billing_period_unit?: string | null,
>   start_date?: number | null,
>   trial_end?: number | null,
>   remaining_billing_cycles?: number | null,
>   po_number?: string | null,
>   auto_collection?: string | null,
>   plan_quantity_in_decimal?: string | null,
>   plan_unit_price_in_decimal?: string | null,
>   changes_scheduled_at?: number | null,
>   change_option?: string | null,
>   free_period?: number | null,
>   free_period_unit?: string | null,
>   contract_term_billing_cycle_on_renewal?: number | null,
>   coupons?: {
>     coupon_id?: string | null
>   }[] | null,
>   discounts?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     description?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     quantity?: number | null,
>     currency_code?: string | null,
>     duration_type?: string | null,
>     period?: number | null,
>     period_unit?: string | null,
>     included_in_mrr?: boolean | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null,
>     apply_till?: number | null,
>     applied_count?: number | null,
>     coupon_id?: string | null,
>     index?: number | null
>   }[] | null,
>   subscription_items?: {
>     item_price_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     amount?: number | null,
>     current_term_start?: number | null,
>     current_term_end?: number | null,
>     next_billing_at?: number | null,
>     amount_in_decimal?: string | null,
>     billing_period?: number | null,
>     billing_period_unit?: string | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     trial_end?: number | null,
>     billing_cycles?: number | null,
>     service_period_days?: number | null,
>     charge_on_event?: string | null,
>     charge_once?: boolean | null,
>     charge_on_option?: string | null,
>     proration_type?: string | null,
>     usage_accumulation_reset_frequency?: string | null,
>     description?: string | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null,
>     index?: number | null
>   }[] | null,
>   quoted_contract_term?: {
>     contract_start?: number | null,
>     contract_end?: number | null,
>     billing_cycle?: number | null,
>     action_at_term_end?: string | null,
>     total_contract_value?: number | null,
>     cancellation_cutoff_period?: number | null
>   } | null
> } | null
> ```

> [accordion] quoted\_charge full type
>
> ```ts theme={null}
> {
>   charges?: {
>     amount?: number | null,
>     amount_in_decimal?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     service_period_in_days?: number | null,
>     avalara_sale_type?: string | null,
>     avalara_transaction_type?: number | null,
>     avalara_service_type?: number | null
>   }[] | null,
>   invoice_items?: {
>     item_price_id?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     service_period_days?: number | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null,
>     index?: number | null
>   }[] | null,
>   coupons?: {
>     coupon_id?: string | null
>   }[] | null,
>   discounts?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     description?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     quantity?: number | null,
>     currency_code?: string | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null,
>     coupon_id?: string | null,
>     index?: number | null
>   }[] | null,
>   coupon_applicability_mappings?: {
>     coupon_id?: string | null,
>     applicable_item_price_ids?: string[] | null
>   }[] | null
> } | null
> ```

> [accordion] quoted\_ramp full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   line_items?: {
>     item_price_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     amount?: number | null,
>     amount_in_decimal?: string | null,
>     billing_period?: number | null,
>     billing_period_unit?: string | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     billing_cycles?: number | null,
>     service_period_days?: number | null,
>     charge_on_event?: string | null,
>     charge_once?: boolean | null,
>     charge_on_option?: string | null,
>     start_date?: number | null,
>     end_date?: number | null,
>     ramp_tier_id?: string | null,
>     discount_per_billing_cycle?: number | null,
>     discount_per_billing_cycle_in_decimal?: string | null,
>     item_level_discount_per_billing_cycle?: number | null,
>     item_level_discount_per_billing_cycle_in_decimal?: string | null,
>     amount_per_billing_cycle?: number | null,
>     amount_per_billing_cycle_in_decimal?: string | null,
>     net_amount_per_billing_cycle?: number | null,
>     net_amount_per_billing_cycle_in_decimal?: string | null,
>     description?: string | null
>   }[] | null,
>   discounts?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     duration_type?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     period?: number | null,
>     period_unit?: string | null,
>     included_in_mrr?: boolean | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     start_date?: number | null,
>     end_date?: number | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     ramp_tier_id?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   coupon_applicability_mappings?: {
>     coupon_id?: string | null,
>     applicable_item_price_ids?: string[] | null
>   }[] | null
> } | null
> ```

***

### getPdf

`quotes.getPdf`

Retrieve a quote as PDF. Retrieves the quote as a PDF. The returned URL is secure, allows download and expires in 60 minutes.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.quotes.getPdf({ quoteId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `quoteId` | `string` | Yes | — |
| `consolidated_view` | `boolean` | No | When true, the quote PDF has summary of all charges on the quote. When false, the quote PDF has a detailed view of charges grouped by charge event. This parameter does not affect one-time quotes. |
| `disposition_type` | `attachment \| inline` | No | Determines the pdf should be rendered as inline or attachment in the browser. \* attachment - PDF is rendered as attachment in the browser \* inline - PDF is rendered as inline in the browser |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `download` | `object \| null` | No | Requesting to download a file through this API will return the `download_url` attribute as the response. This attribute will contain a URL that will allow the requested content to be downloaded. |

> [accordion] download full type
>
> ```ts theme={null}
> {
>   download_url?: string | null,
>   valid_till?: number | null,
>   mime_type?: string | null
> } | null
> ```

***

### list

`quotes.list`

List quotes. List all quotes. (GET /quotes)

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.quotes.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `include_deleted` | `boolean` | No | If set to true, includes the deleted resources in the response. For the deleted resources in the response, the '**deleted** ' attribute will be '**true** '. |
| `id` | `object` | No | optional, string filter The quote number. Acts as a identifier for quote and typically generated sequentially. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *id\\\[is\\] = "123"* |
| `customer_id` | `object` | No | optional, string filter The identifier of the customer this quote belongs to. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *customer\_id\\\[is\_not\\] = "4gmiXbsjdm"* |
| `subscription_id` | `object` | No | optional, string filter To filter based on subscription\_id. NOTE: Not to be used if *consolidated invoicing* feature is enabled. **Supported operators :** is, is\_not, starts\_with, is\_present, in, not\_in **Example →** *subscription\_id\\\[is\_not\\] = "4gmiXbsjdm"* |
| `status` | `object` | No | optional, enumerated string filter Current status of this quote. Possible values are : open, accepted, declined, invoiced, closed. **Supported operators :** is, is\_not, in, not\_in **Example →** *status\\\[is\\] = "open"* |
| `date` | `object` | No | optional, timestamp(UTC) in seconds filter Creation date of the quote. Typically this is the date on which quote is generated. **Supported operators :** after, before, on, between **Example →** *date\\\[on\\] = "1435054328"* |
| `updated_at` | `object` | No | optional, timestamp(UTC) in seconds filter To filter based on updated at. This attribute will be present only if the resource has been updated after 2016-09-28. **Supported operators :** after, before, on, between **Example →** *updated\_at\\\[on\\] = "1243545465"* |
| `sort_by` | `object` | No | optional, string filter Sorts based on the specified attribute. **Supported attributes :** date **Supported sort-orders :** asc, desc **Example →** *sort\_by\\\[asc\\] = "date"* This will sort the result based on the 'date' attribute in ascending(earliest first) order. |

> [accordion] id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] customer\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] subscription\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string,
>   is_present?: true | false,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] status full type
>
> ```ts theme={null}
> {
>   is?: open | accepted | declined | invoiced | closed | pending_approval | approval_rejected | proposed | voided | expired,
>   is_not?: open | accepted | declined | invoiced | closed | pending_approval | approval_rejected | proposed | voided | expired,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] date full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] updated\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] sort\_by full type
>
> ```ts theme={null}
> {
>   asc?: date,
>   desc?: date
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   quote?: {
>     id?: string | null,
>     name?: string | null,
>     po_number?: string | null,
>     customer_id?: string | null,
>     subscription_id?: string | null,
>     invoice_id?: string | null,
>     status?: string | null,
>     operation_type?: string | null,
>     vat_number?: string | null,
>     price_type?: string | null,
>     valid_till?: number | null,
>     date?: number | null,
>     total_payable?: number | null,
>     charge_on_acceptance?: number | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     version?: number | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     vat_number_prefix?: string | null,
>     tax_category?: string | null,
>     currency_code?: string | null,
>     notes?: any[] | null,
>     contract_term_start?: number | null,
>     contract_term_end?: number | null,
>     contract_term_termination_fee?: number | null,
>     business_entity_id?: string | null,
>     deleted?: boolean | null,
>     total_contract_value?: number | null,
>     total_discount?: number | null,
>     has_entitlements?: boolean | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     billing_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null
>   } | null,
>   quoted_subscription?: {
>     id?: string | null,
>     billing_period?: number | null,
>     billing_period_unit?: string | null,
>     start_date?: number | null,
>     trial_end?: number | null,
>     remaining_billing_cycles?: number | null,
>     po_number?: string | null,
>     auto_collection?: string | null,
>     plan_quantity_in_decimal?: string | null,
>     plan_unit_price_in_decimal?: string | null,
>     changes_scheduled_at?: number | null,
>     change_option?: string | null,
>     free_period?: number | null,
>     free_period_unit?: string | null,
>     contract_term_billing_cycle_on_renewal?: number | null,
>     coupons?: {
>       coupon_id?: string | null
>     }[] | null,
>     discounts?: {
>       id?: string | null,
>       invoice_name?: string | null,
>       description?: string | null,
>       type?: string | null,
>       percentage?: number | null,
>       amount?: number | null,
>       quantity?: number | null,
>       currency_code?: string | null,
>       duration_type?: string | null,
>       period?: number | null,
>       period_unit?: string | null,
>       included_in_mrr?: boolean | null,
>       apply_on?: string | null,
>       item_price_id?: string | null,
>       created_at?: number | null,
>       apply_till?: number | null,
>       applied_count?: number | null,
>       coupon_id?: string | null,
>       index?: number | null
>     }[] | null,
>     subscription_items?: {
>       item_price_id?: string | null,
>       item_type?: string | null,
>       quantity?: number | null,
>       quantity_in_decimal?: string | null,
>       unit_price?: number | null,
>       unit_price_in_decimal?: string | null,
>       amount?: number | null,
>       current_term_start?: number | null,
>       current_term_end?: number | null,
>       next_billing_at?: number | null,
>       amount_in_decimal?: string | null,
>       billing_period?: number | null,
>       billing_period_unit?: string | null,
>       free_quantity?: number | null,
>       free_quantity_in_decimal?: string | null,
>       trial_end?: number | null,
>       billing_cycles?: number | null,
>       service_period_days?: number | null,
>       charge_on_event?: string | null,
>       charge_once?: boolean | null,
>       charge_on_option?: string | null,
>       proration_type?: string | null,
>       usage_accumulation_reset_frequency?: string | null,
>       description?: string | null
>     }[] | null,
>     item_tiers?: {
>       item_price_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       price?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       price_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null,
>       index?: number | null
>     }[] | null,
>     quoted_contract_term?: {
>       contract_start?: number | null,
>       contract_end?: number | null,
>       billing_cycle?: number | null,
>       action_at_term_end?: string | null,
>       total_contract_value?: number | null,
>       cancellation_cutoff_period?: number | null
>     } | null
>   } | null,
>   quoted_ramp?: {
>     id?: string | null,
>     line_items?: {
>       item_price_id?: string | null,
>       item_type?: string | null,
>       quantity?: number | null,
>       quantity_in_decimal?: string | null,
>       unit_price?: number | null,
>       unit_price_in_decimal?: string | null,
>       amount?: number | null,
>       amount_in_decimal?: string | null,
>       billing_period?: number | null,
>       billing_period_unit?: string | null,
>       free_quantity?: number | null,
>       free_quantity_in_decimal?: string | null,
>       billing_cycles?: number | null,
>       service_period_days?: number | null,
>       charge_on_event?: string | null,
>       charge_once?: boolean | null,
>       charge_on_option?: string | null,
>       start_date?: number | null,
>       end_date?: number | null,
>       ramp_tier_id?: string | null,
>       discount_per_billing_cycle?: number | null,
>       discount_per_billing_cycle_in_decimal?: string | null,
>       item_level_discount_per_billing_cycle?: number | null,
>       item_level_discount_per_billing_cycle_in_decimal?: string | null,
>       amount_per_billing_cycle?: number | null,
>       amount_per_billing_cycle_in_decimal?: string | null,
>       net_amount_per_billing_cycle?: number | null,
>       net_amount_per_billing_cycle_in_decimal?: string | null,
>       description?: string | null
>     }[] | null,
>     discounts?: {
>       id?: string | null,
>       invoice_name?: string | null,
>       type?: string | null,
>       percentage?: number | null,
>       amount?: number | null,
>       duration_type?: string | null,
>       entity_type?: string | null,
>       entity_id?: string | null,
>       period?: number | null,
>       period_unit?: string | null,
>       included_in_mrr?: boolean | null,
>       apply_on?: string | null,
>       item_price_id?: string | null,
>       created_at?: number | null,
>       updated_at?: number | null,
>       start_date?: number | null,
>       end_date?: number | null
>     }[] | null,
>     item_tiers?: {
>       item_price_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       price?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       price_in_decimal?: string | null,
>       ramp_tier_id?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     coupon_applicability_mappings?: {
>       coupon_id?: string | null,
>       applicable_item_price_ids?: string[] | null
>     }[] | null
>   } | null
> }[] | null
> ```

***

### listEntitlements

`quotes.listEntitlements`

List Quote Entitlements. Retrieves the list of quote\_entitlements for the quote.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.quotes.listEntitlements({ quoteId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `quoteId` | `string` | Yes | — |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `entity_id` | `object` | No | Filter quote entitlements by `entity_id`. **Supported operators :** is **Example →** *entity\_id\\\[is\\] = "price-usd"* |
| `start_date` | `object` | No | Filter entitlements by ramp start date (unix timestamp). Use with `end_date[on]`. **Supported operators :** on **Example →** *start\_date\\\[on\\] = "1780252200"* |
| `end_date` | `object` | No | Filter entitlements by ramp end date (unix timestamp). Use with `start_date[on]`. **Supported operators :** on **Example →** *end\_date\\\[on\\] = "1782844200"* |

> [accordion] entity\_id full type
>
> ```ts theme={null}
> {
>   is?: string
> }
> ```

> [accordion] start\_date full type
>
> ```ts theme={null}
> {
>   on?: string
> }
> ```

> [accordion] end\_date full type
>
> ```ts theme={null}
> {
>   on?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   quote_entitlement?: {
>     entity_id?: string | null,
>     entity_type?: string | null,
>     feature_id?: string | null,
>     value?: string | null,
>     is_enabled?: boolean | null,
>     start_date?: number | null,
>     end_date?: number | null,
>     created_at?: number | null,
>     modified_at?: number | null,
>     is_overridden?: boolean | null,
>     feature_name?: string | null,
>     feature_unit?: string | null,
>     feature_type?: string | null,
>     name?: string | null,
>     metered?: boolean | null
>   } | null
> }[] | null
> ```

***

### listLineGroups

`quotes.listLineGroups`

List quote line groups. This API retrieves all the quote line groups and lineitems for a quote.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.quotes.listLineGroups({ quoteId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `quoteId` | `string` | Yes | — |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   quote_line_group?: {
>     version?: number | null,
>     id?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     charge_event?: string | null,
>     billing_cycle_number?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null
>   } | null
> }[] | null
> ```

***

### updateStatus

`quotes.updateStatus`

Update quote status. Updates the status of the quote.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.quotes.updateStatus({ quoteId: 'example', status: 'accepted' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `quoteId` | `string` | Yes | — |
| `status` | `accepted \| declined \| proposed \| voided \| closed` | Yes | The status to which the quote should be updated. \* accepted - The customer has accepted the quote. \* closed - The quote has been marked as closed. **Note** Not applicable when Chargebee CPQ is enabled. \* declined - The customer declined/rejected the quote. \* proposed - The quote has been shared with the customer via email or e-signature and is awaiting their response. **Note** Applicable only when Chargebee CPQ is enabled. To request access, contact [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). \* voided - The quote has been invalidated and can no longer be acted upon. **Note** Applicable only when Chargebee CPQ is enabled. To request access, contact [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). |
| `comment` | `string` | No | An internal [comment](https://docs.corsair.dev/docs/api/comments) to be added for this operation, to the quote. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](https://docs.corsair.dev/docs/api/hosted_pages) or any document such as the [Quote PDF](https://docs.corsair.dev/docs/api/quotes/retrieve-quote-as-pdf) . |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `quote` | `object \| null` | No | A quote is an estimate of the invoice with the charges likely to occur when customers buy an item. A quote can be converted to a regular invoice once the customer accepts it. The line items of a quote are grouped by charge events and are available as a separate [resource](https://docs.corsair.dev/docs/api/quote_line_groups). This resource can be retrieved using the [List quote line groups](https://docs.corsair.dev/docs/api/quotes/list-quote-line-groups) endpoint. Note that the first quote line group is available within the quote resource itself and parsing the quote line groups object is not required. |
| `quoted_subscription` | `object \| null` | No | When a [quote](https://docs.corsair.dev/docs/api/quotes) is created, it generates the `quoted_subscription` resource. This captures most of the details of the subscription that would eventually be created once the quote is invoiced. This resource is returned along with the quote for most of the associated operations. |
| `quoted_charge` | `object \| null` | No | When the [operation\_type](https://docs.corsair.dev/docs/api/quotes/quote-object#operation_type) of a `quote` is `onetime_invoice` , the `quoted_charges` resource contains the details of the invoice that is eventually created once the quote is invoiced. It is always returned along with the quote. |
| `quoted_ramp` | `object \| null` | No | When a [quote](https://docs.corsair.dev/docs/api/quotes) is created, it generates the `quoted_ramps` resource. This captures most of the details of the [ramps](https://docs.corsair.dev/docs/api/ramps) that would eventually be created once the quote is invoiced. This resource is returned along with the quote for most of the associated operations. **Note** Applicable only when Chargebee CPQ and [Subscription Ramps](https://docs.corsair.dev/docs/api/ramps) are enabled. To request access, contact [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). |

> [accordion] quote full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   po_number?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   invoice_id?: string | null,
>   status?: string | null,
>   operation_type?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   valid_till?: number | null,
>   date?: number | null,
>   total_payable?: number | null,
>   charge_on_acceptance?: number | null,
>   sub_total?: number | null,
>   total?: number | null,
>   credits_applied?: number | null,
>   amount_paid?: number | null,
>   amount_due?: number | null,
>   version?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   vat_number_prefix?: string | null,
>   tax_category?: string | null,
>   currency_code?: string | null,
>   notes?: any[] | null,
>   contract_term_start?: number | null,
>   contract_term_end?: number | null,
>   contract_term_termination_fee?: number | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null,
>   total_contract_value?: number | null,
>   total_discount?: number | null,
>   has_entitlements?: boolean | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null
> } | null
> ```

> [accordion] quoted\_subscription full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   billing_period?: number | null,
>   billing_period_unit?: string | null,
>   start_date?: number | null,
>   trial_end?: number | null,
>   remaining_billing_cycles?: number | null,
>   po_number?: string | null,
>   auto_collection?: string | null,
>   plan_quantity_in_decimal?: string | null,
>   plan_unit_price_in_decimal?: string | null,
>   changes_scheduled_at?: number | null,
>   change_option?: string | null,
>   free_period?: number | null,
>   free_period_unit?: string | null,
>   contract_term_billing_cycle_on_renewal?: number | null,
>   coupons?: {
>     coupon_id?: string | null
>   }[] | null,
>   discounts?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     description?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     quantity?: number | null,
>     currency_code?: string | null,
>     duration_type?: string | null,
>     period?: number | null,
>     period_unit?: string | null,
>     included_in_mrr?: boolean | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null,
>     apply_till?: number | null,
>     applied_count?: number | null,
>     coupon_id?: string | null,
>     index?: number | null
>   }[] | null,
>   subscription_items?: {
>     item_price_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     amount?: number | null,
>     current_term_start?: number | null,
>     current_term_end?: number | null,
>     next_billing_at?: number | null,
>     amount_in_decimal?: string | null,
>     billing_period?: number | null,
>     billing_period_unit?: string | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     trial_end?: number | null,
>     billing_cycles?: number | null,
>     service_period_days?: number | null,
>     charge_on_event?: string | null,
>     charge_once?: boolean | null,
>     charge_on_option?: string | null,
>     proration_type?: string | null,
>     usage_accumulation_reset_frequency?: string | null,
>     description?: string | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null,
>     index?: number | null
>   }[] | null,
>   quoted_contract_term?: {
>     contract_start?: number | null,
>     contract_end?: number | null,
>     billing_cycle?: number | null,
>     action_at_term_end?: string | null,
>     total_contract_value?: number | null,
>     cancellation_cutoff_period?: number | null
>   } | null
> } | null
> ```

> [accordion] quoted\_charge full type
>
> ```ts theme={null}
> {
>   charges?: {
>     amount?: number | null,
>     amount_in_decimal?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     service_period_in_days?: number | null,
>     avalara_sale_type?: string | null,
>     avalara_transaction_type?: number | null,
>     avalara_service_type?: number | null
>   }[] | null,
>   invoice_items?: {
>     item_price_id?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     service_period_days?: number | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null,
>     index?: number | null
>   }[] | null,
>   coupons?: {
>     coupon_id?: string | null
>   }[] | null,
>   discounts?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     description?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     quantity?: number | null,
>     currency_code?: string | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null,
>     coupon_id?: string | null,
>     index?: number | null
>   }[] | null,
>   coupon_applicability_mappings?: {
>     coupon_id?: string | null,
>     applicable_item_price_ids?: string[] | null
>   }[] | null
> } | null
> ```

> [accordion] quoted\_ramp full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   line_items?: {
>     item_price_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     amount?: number | null,
>     amount_in_decimal?: string | null,
>     billing_period?: number | null,
>     billing_period_unit?: string | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     billing_cycles?: number | null,
>     service_period_days?: number | null,
>     charge_on_event?: string | null,
>     charge_once?: boolean | null,
>     charge_on_option?: string | null,
>     start_date?: number | null,
>     end_date?: number | null,
>     ramp_tier_id?: string | null,
>     discount_per_billing_cycle?: number | null,
>     discount_per_billing_cycle_in_decimal?: string | null,
>     item_level_discount_per_billing_cycle?: number | null,
>     item_level_discount_per_billing_cycle_in_decimal?: string | null,
>     amount_per_billing_cycle?: number | null,
>     amount_per_billing_cycle_in_decimal?: string | null,
>     net_amount_per_billing_cycle?: number | null,
>     net_amount_per_billing_cycle_in_decimal?: string | null,
>     description?: string | null
>   }[] | null,
>   discounts?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     duration_type?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     period?: number | null,
>     period_unit?: string | null,
>     included_in_mrr?: boolean | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     start_date?: number | null,
>     end_date?: number | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     ramp_tier_id?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   coupon_applicability_mappings?: {
>     coupon_id?: string | null,
>     applicable_item_price_ids?: string[] | null
>   }[] | null
> } | null
> ```

***

### updateSubscriptionQuote

`quotes.updateSubscriptionQuote`

Create quote for updating a subscription. Creates a quote for updating a subscription under the customer specified. To send this quote, use "Send Email" quote action in the Chargebee application. Product Catalog 1.0 sites only.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.quotes.updateSubscriptionQuote({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `name` | `string` | No | The quote name will be used as the pdf name of the quote. |
| `notes` | `string` | No | Notes specific to this quote that you want customers to see on the quote PDF. |
| `expires_at` | `number` | No | Quotes will be valid till this date. After this quote will be marked as closed. |
| `replace_addon_list` | `boolean` | No | Should be true if the existing addons should be replaced with the ones that are being passed. |
| `mandatory_addons_to_remove` | `string[]` | No | List of addons IDs that are mandatory to the plan and has to be removed from the subscription. |
| `billing_cycles` | `number` | No | 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` | `number` | No | 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` | `number` | No | 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` | `immediate \| delayed` | No | 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. \* 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` | `string[]` | No | Identifier of the coupon as a List. Coupon Codes can also be passed. |
| `replace_coupon_list` | `boolean` | No | Should be true if the existing coupons should be replaced with the ones that are being passed. |
| `change_option` | `immediately \| specific_date` | No | When the quote is converted, this attribute determines the date/time as of when the subscription change is to be carried out. \* specific\_date - The change is carried out as of the date specified under `changes_scheduled_at` . \* immediately - The change is carried out immediately. |
| `changes_scheduled_at` | `number` | No | When `change_option` is set to `specific_date` , then set the date/time at which the subscription change is to happen or has happened. `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 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 subscription's plan is 2 months and today is 14th April, `changes_scheduled_at` cannot be earlier than 14th February.. **Note:** The `changes_scheduled_at` parameter does not apply to `auto_collection` , `shipping_address` , and `po_number` ; these parameters take effect **immediately** when scheduling a subscription update. |
| `force_term_reset` | `boolean` | No | Applicable for 'Active' \\& 'Non Renewing' states alone. Generally, subscription's term will be reset (i.e current term is ended and a new term starts immediately) when a new plan having different billing frequency is specified in the input. For all the other cases, the subscription's term will remain intact. Now for this later scenario, if you want to force a term reset you can specify this param as 'true'. **Note**: Specifying this value as 'false' has no impact on the default behaviour. |
| `reactivate` | `boolean` | No | Applicable only for cancelled subscriptions. Once this is passed as true, cancelled subscription will become active; otherwise subscription changes will be made but the subscription state will remain cancelled. If not passed, subscription will be activated only if there is any change in subscription data. |
| `subscription` | `object` | No | Parameters for subscription |
| `billing_address` | `object` | No | Parameters for billing\_address |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `customer` | `object` | No | Parameters for customer |
| `contract_term` | `object` | No | Parameters for contract\_term |
| `addons` | `object` | No | Parameters for addons |
| `event_based_addons` | `object` | No | Parameters for event\_based\_addons |

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id: string,
>   plan_id?: string,
>   plan_quantity?: number,
>   plan_unit_price?: number,
>   setup_fee?: number,
>   plan_quantity_in_decimal?: string,
>   plan_unit_price_in_decimal?: string,
>   start_date?: number,
>   trial_end?: number,
>   auto_collection?: on | off,
>   offline_payment_method?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
>   contract_term_billing_cycle_on_renewal?: number
> }
> ```

> [accordion] billing\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   vat_number?: string,
>   vat_number_prefix?: string,
>   registered_for_gst?: boolean
> }
> ```

> [accordion] contract\_term full type
>
> ```ts theme={null}
> {
>   action_at_term_end?: renew | evergreen | cancel | renew_once,
>   cancellation_cutoff_period?: number
> }
> ```

> [accordion] addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   unit_price?: number[],
>   billing_cycles?: number[],
>   quantity_in_decimal?: string[],
>   unit_price_in_decimal?: string[],
>   trial_end?: number[]
> }
> ```

> [accordion] event\_based\_addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   unit_price?: number[],
>   service_period_in_days?: number[],
>   charge_on?: (immediately | on_event)[],
>   on_event?: (subscription_creation | subscription_trial_start | plan_activation | subscription_activation | contract_termination)[],
>   charge_once?: boolean[],
>   quantity_in_decimal?: string[],
>   unit_price_in_decimal?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `quote` | `object \| null` | No | A quote is an estimate of the invoice with the charges likely to occur when customers buy an item. A quote can be converted to a regular invoice once the customer accepts it. The line items of a quote are grouped by charge events and are available as a separate [resource](https://docs.corsair.dev/docs/api/quote_line_groups). This resource can be retrieved using the [List quote line groups](https://docs.corsair.dev/docs/api/quotes/list-quote-line-groups) endpoint. Note that the first quote line group is available within the quote resource itself and parsing the quote line groups object is not required. |
| `quoted_subscription` | `object \| null` | No | When a [quote](https://docs.corsair.dev/docs/api/quotes) is created, it generates the `quoted_subscription` resource. This captures most of the details of the subscription that would eventually be created once the quote is invoiced. This resource is returned along with the quote for most of the associated operations. |

> [accordion] quote full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   po_number?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   invoice_id?: string | null,
>   status?: string | null,
>   operation_type?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   valid_till?: number | null,
>   date?: number | null,
>   total_payable?: number | null,
>   charge_on_acceptance?: number | null,
>   sub_total?: number | null,
>   total?: number | null,
>   credits_applied?: number | null,
>   amount_paid?: number | null,
>   amount_due?: number | null,
>   version?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   vat_number_prefix?: string | null,
>   tax_category?: string | null,
>   currency_code?: string | null,
>   notes?: any[] | null,
>   contract_term_start?: number | null,
>   contract_term_end?: number | null,
>   contract_term_termination_fee?: number | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null,
>   total_contract_value?: number | null,
>   total_discount?: number | null,
>   has_entitlements?: boolean | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null
> } | null
> ```

> [accordion] quoted\_subscription full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   plan_id?: string | null,
>   plan_quantity?: number | null,
>   plan_unit_price?: number | null,
>   setup_fee?: number | null,
>   billing_period?: number | null,
>   billing_period_unit?: string | null,
>   start_date?: number | null,
>   trial_end?: number | null,
>   remaining_billing_cycles?: number | null,
>   po_number?: string | null,
>   auto_collection?: string | null,
>   plan_quantity_in_decimal?: string | null,
>   plan_unit_price_in_decimal?: string | null,
>   changes_scheduled_at?: number | null,
>   change_option?: string | null,
>   free_period?: number | null,
>   free_period_unit?: string | null,
>   contract_term_billing_cycle_on_renewal?: number | null,
>   addons?: {
>     id?: string | null,
>     quantity?: number | null,
>     unit_price?: number | null,
>     amount?: number | null,
>     trial_end?: number | null,
>     remaining_billing_cycles?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     proration_type?: string | null
>   }[] | null,
>   event_based_addons?: {
>     id?: string | null,
>     quantity?: number | null,
>     unit_price?: number | null,
>     on_event?: string | null,
>     charge_once?: boolean | null,
>     quantity_in_decimal?: string | null,
>     unit_price_in_decimal?: string | null
>   }[] | null,
>   coupons?: {
>     coupon_id?: string | null
>   }[] | null,
>   quoted_contract_term?: {
>     contract_start?: number | null,
>     contract_end?: number | null,
>     billing_cycle?: number | null,
>     action_at_term_end?: string | null,
>     total_contract_value?: number | null,
>     cancellation_cutoff_period?: number | null
>   } | null
> } | null
> ```

***

### updateSubscriptionQuoteForItems

`quotes.updateSubscriptionQuoteForItems`

Create a quote for subscription update. Creates a quote for updating a subscription. Use this endpoint for amendments, and for renewals when Chargebee CPQ is enabled. \* Amendment: Changes the subscription within its current term, for example adding items or changing quantities or prices.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.quotes.updateSubscriptionQuoteForItems({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `name` | `string` | No | The quote name will be used as the pdf name of the quote. |
| `notes` | `string` | No | Notes specific to this quote that you want customers to see on the quote PDF. |
| `expires_at` | `number` | No | Quotes will be valid till this date. After this quote will be marked as closed. |
| `mandatory_items_to_remove` | `string[]` | No | Item ids of [mandatorily attached addons](https://docs.corsair.dev/docs/api/attached_items) that are to be removed from the subscription. |
| `replace_items_list` | `boolean` | No | If `true` then the existing `subscription_items` list for the subscription is replaced by the one provided. If `false` then the provided `subscription_items` list gets added to the existing list. |
| `billing_cycles` | `number` | No | Billing cycles set for plan-item price is used by default. |
| `terms_to_charge` | `number` | No | 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` | `number` | No | 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` | `immediate \| delayed` | No | 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. \* 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` | `string[]` | No | The list of [IDs](https://docs.corsair.dev/docs/api/coupons/coupon-object#id) of the coupons to be applied. [Coupon codes](https://docs.corsair.dev/docs/api/coupon_codes) are also supported. **Note** Not applicable when Chargebee CPQ is enabled. Use `coupons[]` array instead. |
| `replace_coupon_list` | `boolean` | No | Should be true if the existing coupons should be replaced with the ones that are being passed. |
| `change_option` | `immediately \| specific_date` | No | When the quote is converted, this attribute determines the date/time as of when the subscription change is to be carried out. \* specific\_date - The change is carried out as of the date specified under `changes_scheduled_at` . \* immediately - The change is carried out immediately. |
| `changes_scheduled_at` | `number` | No | When `change_option` is set to `specific_date`, then set the date-time at which the subscription change is to happen or has happened. **Constraints** \* Do not pass this parameter along with `reactivate_from`. \* The `changes_scheduled_at` parameter does not apply to `auto_collection`, `shipping_address`, and `po_number`; these parameters take effect **immediately** when scheduling a subscription update. **Backdated changes** `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](https://www.chargebee.com/docs/billing/2.0/subscriptions/backdating#configuring-backdated-subscription-actions-and-invoicing) 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. **Renewing a fixed-term subscription through Chargebee CPQ** For Chargebee CPQ, set `change_option` to `specific_date` and set `changes_scheduled_at` to the current subscription's end timestamp (UTC, in seconds). That timestamp is the start of the new term. When the subscription has an active contract term, use the contract end. The API accepts only that exact value. Also set `subscription_items[start_date]` to the same timestamp and `subscription_items[end_date]` to the end of the new term. The subscription must have remaining billing cycles, and its `status` must be `active`, `non_renewing`, or `paused`. |
| `force_term_reset` | `boolean` | No | Applicable for 'Active' \\& 'Non Renewing' states alone. Generally, subscription's term will be reset (i.e current term is ended and a new term starts immediately) when a new plan having different billing frequency is specified in the input. For all the other cases, the subscription's term will remain intact. Now for this later scenario, if you want to force a term reset you can specify this param as 'true'. **Note**: Specifying this value as 'false' has no impact on the default behaviour. |
| `reactivate` | `boolean` | No | Applicable only for cancelled subscriptions. Once this is passed as true, cancelled subscription will become active; otherwise subscription changes will be made but the subscription state will remain cancelled. If not passed, subscription will be activated only if there is any change in subscription data. |
| `net_term_days` | `number` | No | The number of days from [`invoice.date`](https://docs.corsair.dev/docs/api/invoices/invoice-object#date) until payment for the invoice is due. **Note:** This parameter applies only when Chargebee CPQ is enabled. To request access, please contact [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) |
| `subscription` | `object` | No | Parameters for subscription |
| `billing_address` | `object` | No | Parameters for billing\_address |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `customer` | `object` | No | Parameters for customer |
| `contract_term` | `object` | No | Parameters for contract\_term |
| `subscription_items` | `object` | No | Parameters for subscription\_items |
| `discounts` | `object` | No | Parameters for discounts |
| `item_tiers` | `object` | No | Parameters for item\_tiers |
| `coupons` | `object` | No | — |
| `entitlement_overrides` | `object` | No | The set of entitlement overrides to apply on this quote. Each entry targets a feature for an entity on the quote. Overrides are always upserted. |

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id: string,
>   start_date?: number,
>   trial_end?: number,
>   auto_collection?: on | off,
>   offline_payment_method?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
>   contract_term_billing_cycle_on_renewal?: number
> }
> ```

> [accordion] billing\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] shipping\_address full type
>
> ```ts theme={null}
> {
>   first_name?: string,
>   last_name?: string,
>   email?: string,
>   company?: string,
>   phone?: string,
>   line1?: string,
>   line2?: string,
>   line3?: string,
>   city?: string,
>   state_code?: string,
>   state?: string,
>   zip?: string,
>   country?: string,
>   validation_status?: not_validated | valid | partially_valid | invalid
> }
> ```

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   vat_number?: string,
>   vat_number_prefix?: string,
>   registered_for_gst?: boolean
> }
> ```

> [accordion] contract\_term full type
>
> ```ts theme={null}
> {
>   action_at_term_end?: renew | evergreen | cancel | renew_once,
>   cancellation_cutoff_period?: number
> }
> ```

> [accordion] subscription\_items full type
>
> ```ts theme={null}
> {
>   item_price_id: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   unit_price?: number[],
>   unit_price_in_decimal?: string[],
>   billing_cycles?: number[],
>   trial_end?: number[],
>   service_period_days?: number[],
>   charge_on_event?: (subscription_creation | subscription_trial_start | plan_activation | subscription_activation | contract_termination)[],
>   charge_once?: boolean[],
>   charge_on_option?: (immediately | on_event)[],
>   start_date?: number[],
>   end_date?: number[],
>   description?: string[],
>   ramp_tier_id?: string[]
> }
> ```

> [accordion] discounts full type
>
> ```ts theme={null}
> {
>   apply_on?: (invoice_amount | specific_item_price)[],
>   duration_type: (one_time | forever | limited_period)[],
>   percentage?: number[],
>   amount?: number[],
>   period?: number[],
>   period_unit?: (day | week | month | year)[],
>   included_in_mrr?: boolean[],
>   item_price_id?: string[],
>   quantity?: number[],
>   operation_type: (add | remove)[],
>   id?: string[],
>   start_date?: number[],
>   end_date?: number[]
> }
> ```

> [accordion] item\_tiers full type
>
> ```ts theme={null}
> {
>   item_price_id?: string[],
>   starting_unit?: number[],
>   ending_unit?: number[],
>   price?: number[],
>   starting_unit_in_decimal?: string[],
>   ending_unit_in_decimal?: string[],
>   price_in_decimal?: string[],
>   pricing_type?: (per_unit | flat_fee | package)[],
>   package_size?: number[],
>   ramp_tier_id?: string[]
> }
> ```

> [accordion] coupons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   start_date?: number[],
>   end_date?: number[]
> }
> ```

> [accordion] entitlement\_overrides full type
>
> ```ts theme={null}
> {
>   feature_id?: string[],
>   entity_id?: string[],
>   entity_type?: (plan_price | addon_price | charge_price)[],
>   value?: string[],
>   is_enabled?: boolean[],
>   start_date?: number[],
>   end_date?: number[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `quote` | `object \| null` | No | A quote is an estimate of the invoice with the charges likely to occur when customers buy an item. A quote can be converted to a regular invoice once the customer accepts it. The line items of a quote are grouped by charge events and are available as a separate [resource](https://docs.corsair.dev/docs/api/quote_line_groups). This resource can be retrieved using the [List quote line groups](https://docs.corsair.dev/docs/api/quotes/list-quote-line-groups) endpoint. Note that the first quote line group is available within the quote resource itself and parsing the quote line groups object is not required. |
| `quoted_subscription` | `object \| null` | No | When a [quote](https://docs.corsair.dev/docs/api/quotes) is created, it generates the `quoted_subscription` resource. This captures most of the details of the subscription that would eventually be created once the quote is invoiced. This resource is returned along with the quote for most of the associated operations. |
| `quoted_ramp` | `object \| null` | No | When a [quote](https://docs.corsair.dev/docs/api/quotes) is created, it generates the `quoted_ramps` resource. This captures most of the details of the [ramps](https://docs.corsair.dev/docs/api/ramps) that would eventually be created once the quote is invoiced. This resource is returned along with the quote for most of the associated operations. **Note** Applicable only when Chargebee CPQ and [Subscription Ramps](https://docs.corsair.dev/docs/api/ramps) are enabled. To request access, contact [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). |

> [accordion] quote full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   po_number?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   invoice_id?: string | null,
>   status?: string | null,
>   operation_type?: string | null,
>   vat_number?: string | null,
>   price_type?: string | null,
>   valid_till?: number | null,
>   date?: number | null,
>   total_payable?: number | null,
>   charge_on_acceptance?: number | null,
>   sub_total?: number | null,
>   total?: number | null,
>   credits_applied?: number | null,
>   amount_paid?: number | null,
>   amount_due?: number | null,
>   version?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   vat_number_prefix?: string | null,
>   tax_category?: string | null,
>   currency_code?: string | null,
>   notes?: any[] | null,
>   contract_term_start?: number | null,
>   contract_term_end?: number | null,
>   contract_term_termination_fee?: number | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null,
>   total_contract_value?: number | null,
>   total_discount?: number | null,
>   has_entitlements?: boolean | null,
>   line_items?: {
>     id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     quantity?: number | null,
>     amount?: number | null,
>     pricing_model?: string | null,
>     is_taxed?: boolean | null,
>     tax_amount?: number | null,
>     tax_rate?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     discount_amount?: number | null,
>     item_level_discount_amount?: number | null,
>     metered?: boolean | null,
>     is_percentage_pricing?: boolean | null,
>     reference_line_item_id?: string | null,
>     description?: string | null,
>     entity_description?: string | null,
>     entity_type?: string | null,
>     tax_exempt_reason?: string | null,
>     entity_id?: string | null,
>     customer_id?: string | null,
>     proration_mode?: string | null
>   }[] | null,
>   line_item_tiers?: {
>     line_item_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   line_item_discounts?: {
>     line_item_id?: string | null,
>     discount_type?: string | null,
>     coupon_id?: string | null,
>     entity_id?: string | null,
>     discount_amount?: number | null
>   }[] | null,
>   line_item_taxes?: {
>     line_item_id?: string | null,
>     tax_name?: string | null,
>     tax_rate?: number | null,
>     date_to?: number | null,
>     date_from?: number | null,
>     prorated_taxable_amount?: number | null,
>     is_partial_tax_applied?: boolean | null,
>     is_non_compliance_tax?: boolean | null,
>     taxable_amount?: number | null,
>     tax_amount?: number | null,
>     tax_juris_type?: string | null,
>     tax_juris_name?: string | null,
>     tax_juris_code?: string | null,
>     tax_amount_in_local_currency?: number | null,
>     local_currency_code?: string | null
>   }[] | null,
>   discounts?: {
>     amount?: number | null,
>     description?: string | null,
>     line_item_id?: string | null,
>     entity_type?: string | null,
>     discount_type?: string | null,
>     entity_id?: string | null,
>     coupon_set_code?: string | null
>   }[] | null,
>   taxes?: {
>     name?: string | null,
>     amount?: number | null,
>     description?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null
> } | null
> ```

> [accordion] quoted\_subscription full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   billing_period?: number | null,
>   billing_period_unit?: string | null,
>   start_date?: number | null,
>   trial_end?: number | null,
>   remaining_billing_cycles?: number | null,
>   po_number?: string | null,
>   auto_collection?: string | null,
>   plan_quantity_in_decimal?: string | null,
>   plan_unit_price_in_decimal?: string | null,
>   changes_scheduled_at?: number | null,
>   change_option?: string | null,
>   free_period?: number | null,
>   free_period_unit?: string | null,
>   contract_term_billing_cycle_on_renewal?: number | null,
>   coupons?: {
>     coupon_id?: string | null
>   }[] | null,
>   discounts?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     description?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     quantity?: number | null,
>     currency_code?: string | null,
>     duration_type?: string | null,
>     period?: number | null,
>     period_unit?: string | null,
>     included_in_mrr?: boolean | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null,
>     apply_till?: number | null,
>     applied_count?: number | null,
>     coupon_id?: string | null,
>     index?: number | null
>   }[] | null,
>   subscription_items?: {
>     item_price_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     amount?: number | null,
>     current_term_start?: number | null,
>     current_term_end?: number | null,
>     next_billing_at?: number | null,
>     amount_in_decimal?: string | null,
>     billing_period?: number | null,
>     billing_period_unit?: string | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     trial_end?: number | null,
>     billing_cycles?: number | null,
>     service_period_days?: number | null,
>     charge_on_event?: string | null,
>     charge_once?: boolean | null,
>     charge_on_option?: string | null,
>     proration_type?: string | null,
>     usage_accumulation_reset_frequency?: string | null,
>     description?: string | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null,
>     index?: number | null
>   }[] | null,
>   quoted_contract_term?: {
>     contract_start?: number | null,
>     contract_end?: number | null,
>     billing_cycle?: number | null,
>     action_at_term_end?: string | null,
>     total_contract_value?: number | null,
>     cancellation_cutoff_period?: number | null
>   } | null
> } | null
> ```

> [accordion] quoted\_ramp full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   line_items?: {
>     item_price_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     amount?: number | null,
>     amount_in_decimal?: string | null,
>     billing_period?: number | null,
>     billing_period_unit?: string | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     billing_cycles?: number | null,
>     service_period_days?: number | null,
>     charge_on_event?: string | null,
>     charge_once?: boolean | null,
>     charge_on_option?: string | null,
>     start_date?: number | null,
>     end_date?: number | null,
>     ramp_tier_id?: string | null,
>     discount_per_billing_cycle?: number | null,
>     discount_per_billing_cycle_in_decimal?: string | null,
>     item_level_discount_per_billing_cycle?: number | null,
>     item_level_discount_per_billing_cycle_in_decimal?: string | null,
>     amount_per_billing_cycle?: number | null,
>     amount_per_billing_cycle_in_decimal?: string | null,
>     net_amount_per_billing_cycle?: number | null,
>     net_amount_per_billing_cycle_in_decimal?: string | null,
>     description?: string | null
>   }[] | null,
>   discounts?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     duration_type?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     period?: number | null,
>     period_unit?: string | null,
>     included_in_mrr?: boolean | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     start_date?: number | null,
>     end_date?: number | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     ramp_tier_id?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null,
>   coupon_applicability_mappings?: {
>     coupon_id?: string | null,
>     applicable_item_price_ids?: string[] | null
>   }[] | null
> } | null
> ```

***

## Ramps

### delete

`ramps.delete`

Delete a subscription ramp. Deletes the specified subscription ramp. However, Chargebee only allows deleting a ramp if it does not conflict with future ramps on the subscription.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.ramps.delete({ rampId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `rampId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `ramp` | `object \| null` | No | A `ramp` resource, or subscription ramp, represents a planned change to a [`subscription`](https://docs.corsair.dev/docs/api/subscriptions) that occurs at a future date. Use this resource to define and schedule subscription modifications, such as updating pricing, altering quantity, or transitioning to a different plan, without immediately applying them. **Note** \* **Upcoming ramps limit** : A subscription can have a maximum of 12 upcoming ramps at any given time, excluding deleted ramps. Upcoming ramps are ramps with `status` as [`scheduled`](https://docs.corsair.dev/docs/api/ramps/ramp-object#status). \* **Total ramps limit**: A subscription can have a maximum of 100 ramps at any given time, excluding deleted ramps. #### Auto-draft conditions When you create or update a ramp, Chargebee automatically moves any existing ramps scheduled after that ramp to `draft` status if either of the following conditions is met: \* The new or updated ramp changes the subscription [term end date](subscriptions#subscription_current_term_end). \* The new or updated ramp changes the subscription billing frequency. That is, either of the following [attributes](subscriptions#subscription_items) is changed: \* `subscription_items[i].billing_period` \* `subscription_items[i].billing_period_unit` \* where `i` is the index where `subscription_items[i].item_type` is `plan`. \* The new or updated ramp introduces an [addon](item_prices#item_price_item_type) that is not [applicable](attached_items) to the plan in one or more of the subsequent ramps. |

> [accordion] ramp full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   description?: string | null,
>   subscription_id?: string | null,
>   effective_from?: number | null,
>   status?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   items_to_remove?: string[] | null,
>   coupons_to_remove?: string[] | null,
>   discounts_to_remove?: string[] | null,
>   deleted?: boolean | null,
>   items_to_add?: {
>     item_price_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     amount?: number | null,
>     amount_in_decimal?: string | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     billing_cycles?: number | null,
>     service_period_days?: number | null,
>     metered_quantity?: string | null,
>     charge_once?: boolean | null,
>     charge_on_option?: string | null,
>     description?: string | null,
>     charge_on_event?: string | null
>   }[] | null,
>   items_to_update?: {
>     item_price_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     amount?: number | null,
>     amount_in_decimal?: string | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     billing_cycles?: number | null,
>     service_period_days?: number | null,
>     metered_quantity?: string | null,
>     charge_once?: boolean | null,
>     charge_on_option?: string | null,
>     description?: string | null,
>     charge_on_event?: string | null
>   }[] | null,
>   coupons_to_add?: {
>     coupon_id?: string | null,
>     apply_till?: number | null
>   }[] | null,
>   discounts_to_add?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     quantity?: number | null,
>     duration_type?: string | null,
>     period?: number | null,
>     period_unit?: string | null,
>     included_in_mrr?: boolean | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null,
>     index?: number | null
>   }[] | null,
>   contract_term?: {
>     cancellation_cutoff_period?: number | null,
>     renewal_billing_cycles?: number | null,
>     action_at_term_end?: string | null
>   } | null,
>   billing_configuration?: {
>     po_number?: string | null
>   } | null,
>   status_transition_reason?: {
>     code?: string | null,
>     message?: string | null
>   } | null,
>   entitlement_overrides_to_add?: {
>     entity_id?: string | null,
>     entity_type?: string | null,
>     feature_id?: string | null,
>     value?: string | null,
>     is_enabled?: boolean | null
>   }[] | null,
>   entitlement_overrides_to_update?: {
>     entity_id?: string | null,
>     entity_type?: string | null,
>     feature_id?: string | null,
>     value?: string | null,
>     is_enabled?: boolean | null
>   }[] | null,
>   entitlement_overrides_to_remove?: {
>     entity_id?: string | null,
>     entity_type?: string | null,
>     feature_id?: string | null
>   }[] | null,
>   credit_unit_grants_to_add?: {
>     entity_id?: string | null,
>     entity_type?: string | null,
>     unit_id?: string | null,
>     unit_type?: string | null,
>     is_enabled?: boolean | null,
>     grant_policies?: any[] | null
>   }[] | null,
>   credit_unit_grants_to_update?: {
>     entity_id?: string | null,
>     entity_type?: string | null,
>     unit_id?: string | null,
>     unit_type?: string | null,
>     is_enabled?: boolean | null,
>     grant_policies?: any[] | null
>   }[] | null,
>   credit_unit_grants_to_remove?: {
>     entity_id?: string | null,
>     entity_type?: string | null,
>     unit_id?: string | null,
>     unit_type?: string | null
>   }[] | null
> } | null
> ```

***

### get

`ramps.get`

Retrieve a subscription ramp. Retrieves a specific subscription ramp.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.ramps.get({ rampId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `rampId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `ramp` | `object \| null` | No | A `ramp` resource, or subscription ramp, represents a planned change to a [`subscription`](https://docs.corsair.dev/docs/api/subscriptions) that occurs at a future date. Use this resource to define and schedule subscription modifications, such as updating pricing, altering quantity, or transitioning to a different plan, without immediately applying them. **Note** \* **Upcoming ramps limit** : A subscription can have a maximum of 12 upcoming ramps at any given time, excluding deleted ramps. Upcoming ramps are ramps with `status` as [`scheduled`](https://docs.corsair.dev/docs/api/ramps/ramp-object#status). \* **Total ramps limit**: A subscription can have a maximum of 100 ramps at any given time, excluding deleted ramps. #### Auto-draft conditions When you create or update a ramp, Chargebee automatically moves any existing ramps scheduled after that ramp to `draft` status if either of the following conditions is met: \* The new or updated ramp changes the subscription [term end date](subscriptions#subscription_current_term_end). \* The new or updated ramp changes the subscription billing frequency. That is, either of the following [attributes](subscriptions#subscription_items) is changed: \* `subscription_items[i].billing_period` \* `subscription_items[i].billing_period_unit` \* where `i` is the index where `subscription_items[i].item_type` is `plan`. \* The new or updated ramp introduces an [addon](item_prices#item_price_item_type) that is not [applicable](attached_items) to the plan in one or more of the subsequent ramps. |

> [accordion] ramp full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   description?: string | null,
>   subscription_id?: string | null,
>   effective_from?: number | null,
>   status?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   items_to_remove?: string[] | null,
>   coupons_to_remove?: string[] | null,
>   discounts_to_remove?: string[] | null,
>   deleted?: boolean | null,
>   items_to_add?: {
>     item_price_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     amount?: number | null,
>     amount_in_decimal?: string | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     billing_cycles?: number | null,
>     service_period_days?: number | null,
>     metered_quantity?: string | null,
>     charge_once?: boolean | null,
>     charge_on_option?: string | null,
>     description?: string | null,
>     charge_on_event?: string | null
>   }[] | null,
>   items_to_update?: {
>     item_price_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     amount?: number | null,
>     amount_in_decimal?: string | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     billing_cycles?: number | null,
>     service_period_days?: number | null,
>     metered_quantity?: string | null,
>     charge_once?: boolean | null,
>     charge_on_option?: string | null,
>     description?: string | null,
>     charge_on_event?: string | null
>   }[] | null,
>   coupons_to_add?: {
>     coupon_id?: string | null,
>     apply_till?: number | null
>   }[] | null,
>   discounts_to_add?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     quantity?: number | null,
>     duration_type?: string | null,
>     period?: number | null,
>     period_unit?: string | null,
>     included_in_mrr?: boolean | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null,
>     index?: number | null
>   }[] | null,
>   contract_term?: {
>     cancellation_cutoff_period?: number | null,
>     renewal_billing_cycles?: number | null,
>     action_at_term_end?: string | null
>   } | null,
>   billing_configuration?: {
>     po_number?: string | null
>   } | null,
>   status_transition_reason?: {
>     code?: string | null,
>     message?: string | null
>   } | null,
>   entitlement_overrides_to_add?: {
>     entity_id?: string | null,
>     entity_type?: string | null,
>     feature_id?: string | null,
>     value?: string | null,
>     is_enabled?: boolean | null
>   }[] | null,
>   entitlement_overrides_to_update?: {
>     entity_id?: string | null,
>     entity_type?: string | null,
>     feature_id?: string | null,
>     value?: string | null,
>     is_enabled?: boolean | null
>   }[] | null,
>   entitlement_overrides_to_remove?: {
>     entity_id?: string | null,
>     entity_type?: string | null,
>     feature_id?: string | null
>   }[] | null,
>   credit_unit_grants_to_add?: {
>     entity_id?: string | null,
>     entity_type?: string | null,
>     unit_id?: string | null,
>     unit_type?: string | null,
>     is_enabled?: boolean | null,
>     grant_policies?: any[] | null
>   }[] | null,
>   credit_unit_grants_to_update?: {
>     entity_id?: string | null,
>     entity_type?: string | null,
>     unit_id?: string | null,
>     unit_type?: string | null,
>     is_enabled?: boolean | null,
>     grant_policies?: any[] | null
>   }[] | null,
>   credit_unit_grants_to_remove?: {
>     entity_id?: string | null,
>     entity_type?: string | null,
>     unit_id?: string | null,
>     unit_type?: string | null
>   }[] | null
> } | null
> ```

***

### list

`ramps.list`

List subscription ramps. Lists the subscription ramps that match the criteria provided in the filter parameters. Note By default, the ramps are returned sorted in descending order (latest first) by updated\_at.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.ramps.list({
	subscription_id: {},
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `include_deleted` | `boolean` | No | Specifies whether to include deleted resources in the response. Deleted resources are those with the [deleted](https://docs.corsair.dev/docs/api/ramps/ramp-object#deleted) attribute set to `true`. **Caution** `status` or `effective_from` filters must not be passed when `include_deleted` is set to `true`. . |
| `status` | `object` | No | optional, enumerated string filter Filter subscription ramps based on `status` . **Caution** \* The `subscription_id` filter must be passed when filtering by `status`. \* `status` filter should not be passed when `include_deleted` is set to `true`. Possible values are : scheduled, succeeded, failed. **Supported operators :** is, in **Example →** *status\\\[is\\] = "SCHEDULED"* |
| `subscription_id` | `object` | Yes | optional, string filter Filter subscription ramps based on `subscription_id` . **Caution** This filter is mandatory when filtering by `status` or `effective_from`. **Supported operators :** is, in **Example →** *subscription\_id\\\[is\\] = "8gsnbYfsMLds"* |
| `effective_from` | `object` | No | optional, timestamp(UTC) in seconds filter Filter subscription ramps based on `effective_from`. **Caution** \* The `subscription_id` filter must be passed when filtering by `effective_from`. \* `effective_from` filter should not be passed when `include_deleted` is set to `true`. **Supported operators :** after, before, on, between **Example →** *effective\_from\\\[after\\] = "1435054328"* |
| `updated_at` | `object` | No | optional, timestamp(UTC) in seconds filter Filter subscription ramps based on `updated_at` . **Tip** Specify `sort_by` = `updated_at` (whether `asc` oor `desc`) for a faster response when using this filter. **Supported operators :** after, before, on, between **Example →** *updated\_at\\\[after\\] = "1435052328"* |
| `sort_by` | `object` | No | optional, string filter Sorts based on the specified attribute. **Supported attributes :** effective\_from, created\_at, updated\_at **Supported sort-orders :** asc, desc **Example →** *sort\_by\\\[asc\\] = "effective\_from"* This will sort the result based on the 'effective\_from' attribute in ascending(earliest first) order. |

> [accordion] status full type
>
> ```ts theme={null}
> {
>   is?: scheduled | succeeded | failed | draft,
>   in?: string
> }
> ```

> [accordion] subscription\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   in?: string
> }
> ```

> [accordion] effective\_from full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] updated\_at full type
>
> ```ts theme={null}
> {
>   after?: string,
>   before?: string,
>   on?: string,
>   between?: string
> }
> ```

> [accordion] sort\_by full type
>
> ```ts theme={null}
> {
>   asc?: effective_from | updated_at,
>   desc?: effective_from | updated_at
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   ramp?: {
>     id?: string | null,
>     description?: string | null,
>     subscription_id?: string | null,
>     effective_from?: number | null,
>     status?: string | null,
>     created_at?: number | null,
>     resource_version?: number | null,
>     updated_at?: number | null,
>     items_to_remove?: string[] | null,
>     coupons_to_remove?: string[] | null,
>     discounts_to_remove?: string[] | null,
>     deleted?: boolean | null,
>     items_to_add?: {
>       item_price_id?: string | null,
>       item_type?: string | null,
>       quantity?: number | null,
>       quantity_in_decimal?: string | null,
>       unit_price?: number | null,
>       unit_price_in_decimal?: string | null,
>       amount?: number | null,
>       amount_in_decimal?: string | null,
>       free_quantity?: number | null,
>       free_quantity_in_decimal?: string | null,
>       billing_cycles?: number | null,
>       service_period_days?: number | null,
>       metered_quantity?: string | null,
>       charge_once?: boolean | null,
>       charge_on_option?: string | null,
>       description?: string | null,
>       charge_on_event?: string | null
>     }[] | null,
>     items_to_update?: {
>       item_price_id?: string | null,
>       item_type?: string | null,
>       quantity?: number | null,
>       quantity_in_decimal?: string | null,
>       unit_price?: number | null,
>       unit_price_in_decimal?: string | null,
>       amount?: number | null,
>       amount_in_decimal?: string | null,
>       free_quantity?: number | null,
>       free_quantity_in_decimal?: string | null,
>       billing_cycles?: number | null,
>       service_period_days?: number | null,
>       metered_quantity?: string | null,
>       charge_once?: boolean | null,
>       charge_on_option?: string | null,
>       description?: string | null,
>       charge_on_event?: string | null
>     }[] | null,
>     coupons_to_add?: {
>       coupon_id?: string | null,
>       apply_till?: number | null
>     }[] | null,
>     discounts_to_add?: {
>       id?: string | null,
>       invoice_name?: string | null,
>       type?: string | null,
>       percentage?: number | null,
>       amount?: number | null,
>       quantity?: number | null,
>       duration_type?: string | null,
>       period?: number | null,
>       period_unit?: string | null,
>       included_in_mrr?: boolean | null,
>       apply_on?: string | null,
>       item_price_id?: string | null,
>       created_at?: number | null
>     }[] | null,
>     item_tiers?: {
>       item_price_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       price?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       price_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null,
>       index?: number | null
>     }[] | null,
>     contract_term?: {
>       cancellation_cutoff_period?: number | null,
>       renewal_billing_cycles?: number | null,
>       action_at_term_end?: string | null
>     } | null,
>     billing_configuration?: {
>       po_number?: string | null
>     } | null,
>     status_transition_reason?: {
>       code?: string | null,
>       message?: string | null
>     } | null,
>     entitlement_overrides_to_add?: {
>       entity_id?: string | null,
>       entity_type?: string | null,
>       feature_id?: string | null,
>       value?: string | null,
>       is_enabled?: boolean | null
>     }[] | null,
>     entitlement_overrides_to_update?: {
>       entity_id?: string | null,
>       entity_type?: string | null,
>       feature_id?: string | null,
>       value?: string | null,
>       is_enabled?: boolean | null
>     }[] | null,
>     entitlement_overrides_to_remove?: {
>       entity_id?: string | null,
>       entity_type?: string | null,
>       feature_id?: string | null
>     }[] | null,
>     credit_unit_grants_to_add?: {
>       entity_id?: string | null,
>       entity_type?: string | null,
>       unit_id?: string | null,
>       unit_type?: string | null,
>       is_enabled?: boolean | null,
>       grant_policies?: any[] | null
>     }[] | null,
>     credit_unit_grants_to_update?: {
>       entity_id?: string | null,
>       entity_type?: string | null,
>       unit_id?: string | null,
>       unit_type?: string | null,
>       is_enabled?: boolean | null,
>       grant_policies?: any[] | null
>     }[] | null,
>     credit_unit_grants_to_remove?: {
>       entity_id?: string | null,
>       entity_type?: string | null,
>       unit_id?: string | null,
>       unit_type?: string | null
>     }[] | null
>   } | null
> }[] | null
> ```

***

### update

`ramps.update`

Update a subscription ramp. Updates an existing subscription ramp by replacing its current attribute values with the new parameters provided. When using this API to modify a ramp, make sure to include all the ramp's attributes as you would do during creation of the ramp with the necessary values updated.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.ramps.update({ rampId: 'example', effective_from: 1 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `rampId` | `string` | Yes | — |
| `effective_from` | `number` | Yes | The time when this ramp takes effect. **Caution** \* Ensure the time is within **five** years from the current time. \* Ensure there is a minimum 24-hour interval between `effective_from` of two consecutive ramps. \* If the subscription is scheduled to be paused or canceled in the future, ensure the time is not on or after [pause\_date](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#pause_date) or [cancelled\_at](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#cancelled_at). |
| `description` | `string` | No | A brief summary of the pricing changes applied with this ramp. |
| `coupons_to_remove` | `string[]` | No | List of [coupons](https://docs.corsair.dev/docs/api/coupons) removed from the subscription through this ramp. **Caution** Ensure this list does **not** include: \* Coupons being added through this ramp. \* Coupons already removed by a previous ramp. |
| `discounts_to_remove` | `string[]` | No | List of [discounts](https://docs.corsair.dev/docs/api/discounts) removed from the subscription through this ramp. **Caution** Ensure this list does not include discounts already removed by a previous ramp. |
| `items_to_remove` | `string[]` | No | List of [item prices](https://docs.corsair.dev/docs/api/item_prices) removed from the subscription through this ramp. **Caution** Ensure this list does **not** include: \* Item prices being added or updated through this ramp. \* Item prices already removed by a previous ramp. |
| `billing_configuration` | `object` | No | Billing-related settings to update when this ramp is executed. |
| `contract_term` | `object` | No | An object that specifies the contract term details. |
| `items_to_add` | `object` | No | Details about the [item prices](https://docs.corsair.dev/docs/api/item_prices) added to the subscription through this ramp. |
| `items_to_update` | `object` | No | Details about the [item prices](https://docs.corsair.dev/docs/api/item_prices) updated in the subscription through this ramp. |
| `item_tiers` | `object` | No | **Note** Allowed only when both of these conditions are met: \* Price overriding is enabled for the site. \* pricing\_model of the item price is either tiered, volume, or stairstep. Replaces the existing item\_tiers for specific `item_price`s within the subscription. You must provide the complete tier set for any `item_price`, even if you're changing the price for only one tier. |
| `coupons_to_add` | `object` | No | Details about the [coupons](https://docs.corsair.dev/docs/api/coupons) added to the subscription through this ramp. |
| `discounts_to_add` | `object` | No | Details about the [discounts](https://docs.corsair.dev/docs/api/discounts) added to the subscription through this ramp. |

> [accordion] billing\_configuration full type
>
> ```ts theme={null}
> {
>   po_number?: string
> }
> ```

> [accordion] contract\_term full type
>
> ```ts theme={null}
> {
>   action_at_term_end?: renew | evergreen | cancel | renew_once,
>   cancellation_cutoff_period?: number,
>   renewal_billing_cycles?: number
> }
> ```

> [accordion] items\_to\_add full type
>
> ```ts theme={null}
> {
>   item_price_id: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   unit_price?: number[],
>   unit_price_in_decimal?: string[],
>   billing_cycles?: number[],
>   service_period_days?: number[],
>   charge_on_event?: (subscription_trial_start | plan_activation | subscription_activation | contract_termination)[],
>   charge_once?: boolean[],
>   charge_on_option?: (immediately | on_event)[],
>   description?: string[]
> }
> ```

> [accordion] items\_to\_update full type
>
> ```ts theme={null}
> {
>   item_price_id: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   unit_price?: number[],
>   unit_price_in_decimal?: string[],
>   billing_cycles?: number[],
>   service_period_days?: number[],
>   charge_on_event?: (subscription_trial_start | plan_activation | subscription_activation | contract_termination)[],
>   charge_once?: boolean[],
>   charge_on_option?: (immediately | on_event)[],
>   description?: string[]
> }
> ```

> [accordion] item\_tiers full type
>
> ```ts theme={null}
> {
>   item_price_id?: string[],
>   starting_unit?: number[],
>   ending_unit?: number[],
>   price?: number[],
>   starting_unit_in_decimal?: string[],
>   ending_unit_in_decimal?: string[],
>   price_in_decimal?: string[],
>   pricing_type?: (per_unit | flat_fee | package)[],
>   package_size?: number[]
> }
> ```

> [accordion] coupons\_to\_add full type
>
> ```ts theme={null}
> {
>   coupon_id?: string[],
>   apply_till?: number[]
> }
> ```

> [accordion] discounts\_to\_add full type
>
> ```ts theme={null}
> {
>   apply_on: (invoice_amount | specific_item_price)[],
>   duration_type: (one_time | forever | limited_period)[],
>   percentage?: number[],
>   amount?: number[],
>   quantity?: number[],
>   period?: number[],
>   period_unit?: (day | week | month | year)[],
>   included_in_mrr?: boolean[],
>   item_price_id?: string[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `ramp` | `object \| null` | No | A `ramp` resource, or subscription ramp, represents a planned change to a [`subscription`](https://docs.corsair.dev/docs/api/subscriptions) that occurs at a future date. Use this resource to define and schedule subscription modifications, such as updating pricing, altering quantity, or transitioning to a different plan, without immediately applying them. **Note** \* **Upcoming ramps limit** : A subscription can have a maximum of 12 upcoming ramps at any given time, excluding deleted ramps. Upcoming ramps are ramps with `status` as [`scheduled`](https://docs.corsair.dev/docs/api/ramps/ramp-object#status). \* **Total ramps limit**: A subscription can have a maximum of 100 ramps at any given time, excluding deleted ramps. #### Auto-draft conditions When you create or update a ramp, Chargebee automatically moves any existing ramps scheduled after that ramp to `draft` status if either of the following conditions is met: \* The new or updated ramp changes the subscription [term end date](subscriptions#subscription_current_term_end). \* The new or updated ramp changes the subscription billing frequency. That is, either of the following [attributes](subscriptions#subscription_items) is changed: \* `subscription_items[i].billing_period` \* `subscription_items[i].billing_period_unit` \* where `i` is the index where `subscription_items[i].item_type` is `plan`. \* The new or updated ramp introduces an [addon](item_prices#item_price_item_type) that is not [applicable](attached_items) to the plan in one or more of the subsequent ramps. |

> [accordion] ramp full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   description?: string | null,
>   subscription_id?: string | null,
>   effective_from?: number | null,
>   status?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   items_to_remove?: string[] | null,
>   coupons_to_remove?: string[] | null,
>   discounts_to_remove?: string[] | null,
>   deleted?: boolean | null,
>   items_to_add?: {
>     item_price_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     amount?: number | null,
>     amount_in_decimal?: string | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     billing_cycles?: number | null,
>     service_period_days?: number | null,
>     metered_quantity?: string | null,
>     charge_once?: boolean | null,
>     charge_on_option?: string | null,
>     description?: string | null,
>     charge_on_event?: string | null
>   }[] | null,
>   items_to_update?: {
>     item_price_id?: string | null,
>     item_type?: string | null,
>     quantity?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price?: number | null,
>     unit_price_in_decimal?: string | null,
>     amount?: number | null,
>     amount_in_decimal?: string | null,
>     free_quantity?: number | null,
>     free_quantity_in_decimal?: string | null,
>     billing_cycles?: number | null,
>     service_period_days?: number | null,
>     metered_quantity?: string | null,
>     charge_once?: boolean | null,
>     charge_on_option?: string | null,
>     description?: string | null,
>     charge_on_event?: string | null
>   }[] | null,
>   coupons_to_add?: {
>     coupon_id?: string | null,
>     apply_till?: number | null
>   }[] | null,
>   discounts_to_add?: {
>     id?: string | null,
>     invoice_name?: string | null,
>     type?: string | null,
>     percentage?: number | null,
>     amount?: number | null,
>     quantity?: number | null,
>     duration_type?: string | null,
>     period?: number | null,
>     period_unit?: string | null,
>     included_in_mrr?: boolean | null,
>     apply_on?: string | null,
>     item_price_id?: string | null,
>     created_at?: number | null
>   }[] | null,
>   item_tiers?: {
>     item_price_id?: string | null,
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     price?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     price_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null,
>     index?: number | null
>   }[] | null,
>   contract_term?: {
>     cancellation_cutoff_period?: number | null,
>     renewal_billing_cycles?: number | null,
>     action_at_term_end?: string | null
>   } | null,
>   billing_configuration?: {
>     po_number?: string | null
>   } | null,
>   status_transition_reason?: {
>     code?: string | null,
>     message?: string | null
>   } | null,
>   entitlement_overrides_to_add?: {
>     entity_id?: string | null,
>     entity_type?: string | null,
>     feature_id?: string | null,
>     value?: string | null,
>     is_enabled?: boolean | null
>   }[] | null,
>   entitlement_overrides_to_update?: {
>     entity_id?: string | null,
>     entity_type?: string | null,
>     feature_id?: string | null,
>     value?: string | null,
>     is_enabled?: boolean | null
>   }[] | null,
>   entitlement_overrides_to_remove?: {
>     entity_id?: string | null,
>     entity_type?: string | null,
>     feature_id?: string | null
>   }[] | null,
>   credit_unit_grants_to_add?: {
>     entity_id?: string | null,
>     entity_type?: string | null,
>     unit_id?: string | null,
>     unit_type?: string | null,
>     is_enabled?: boolean | null,
>     grant_policies?: any[] | null
>   }[] | null,
>   credit_unit_grants_to_update?: {
>     entity_id?: string | null,
>     entity_type?: string | null,
>     unit_id?: string | null,
>     unit_type?: string | null,
>     is_enabled?: boolean | null,
>     grant_policies?: any[] | null
>   }[] | null,
>   credit_unit_grants_to_remove?: {
>     entity_id?: string | null,
>     entity_type?: string | null,
>     unit_id?: string | null,
>     unit_type?: string | null
>   }[] | null
> } | null
> ```

***

## Recorded Purchases

### create

`recordedPurchases.create`

Record a purchase. Records an in-app purchase from Apple App Store or Google Play Store in Chargebee. The API starts an asynchronous verification job and returns a recorded\_purchase resource. Track progress with status: in\_process, completed, failed, or ignored. Handle the synchronous API response first.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.recordedPurchases.create({ app_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `app_id` | `string` | Yes | App Identifier in Chargebee. This is the handle created by Chargebee for your app. To get the `app_id`: \* For **Apple** , follow [these steps](https://www.chargebee.com/docs/billing/2.0/mobile-subscriptions/omnichannel-app-store#create-an-omnichannel-subscription-for-in-app-purchases). \* For **Google** , follow [these steps](https://www.chargebee.com/docs/billing/2.0/mobile-subscriptions/omnichannel-play-store#connect-google-app-to-chargebee-to-generate-unique-app-id-and-notifications-url). |
| `customer` | `object` | No | Customer parameters for associating (or creating) the Chargebee customer for this purchase. |
| `apple_app_store` | `object` | No | Apple App Store--specific payload used to record the purchase. Provide parameters as `apple_app_store[...]`. **Google Play Store**: Not applicable. Do not send this object for Google purchases. |
| `google_play_store` | `object` | No | Google Play Store--specific payload used to record the purchase. Provide parameters as `google_play_store[...]`. **Apple App Store**: Not applicable. Do not send this object for Apple purchases. |
| `omnichannel_subscription` | `object` | No | Optional parameters for the omnichannel subscription created from this purchase. |

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id: string,
>   email?: string,
>   first_name?: string,
>   last_name?: string
> }
> ```

> [accordion] apple\_app\_store full type
>
> ```ts theme={null}
> {
>   transaction_id?: string,
>   receipt?: string,
>   product_id?: string
> }
> ```

> [accordion] google\_play\_store full type
>
> ```ts theme={null}
> {
>   purchase_token?: string,
>   product_id?: string,
>   order_id?: string
> }
> ```

> [accordion] omnichannel\_subscription full type
>
> ```ts theme={null}
> {
>   id?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `recorded_purchase` | `object \| null` | No | **Important** \* Handle the **synchronous** API response first. Record a Purchase can fail immediately (for example, an incorrect `app_id`, a malformed URL or request, or recording a purchase that already belongs to a different customer) before a job is created---treat these as standard API errors (`4xx`). To reassign an existing omnichannel subscription to another customer, use [Move an omnichannel subscription](https://docs.corsair.dev/docs/api/omnichannel_subscriptions/move-an-omnichannel-subscription) instead of re-recording the purchase. \* After the call is accepted, purchase validation with Apple or Google is **asynchronous** . Track the job with `status` (`in_process` → `completed`, `failed`, or `ignored`). Omnichannel subscription or one-time order creation happens only after successful async completion. \* This resource is applicable for Apple App Store and Google Play Store. The recorded purchase resource represents a background job that syncs in-app purchases made through Apple App Store and Google Play Store with Chargebee. The [status](https://docs.corsair.dev/docs/api/recorded_purchases/recorded_purchase-object#status) (`in_process`, `completed`, `failed`, and `ignored`) attribute represents the current status of the background job. ### Record Apple and Google in-app purchases and retrieve linked omnichannel resources You can record subscription and one-time-order purchases made on Apple App Store or Google Play Store, then retrieve the resulting omnichannel resources. To record a purchase and retrieve details, follow these steps: 1. Use the [Record a Purchase API](https://docs.corsair.dev/docs/api/recorded_purchases/record-a-purchase) with `app_id`, `customer[id]`, and exactly one store payload: \* **Apple App Store (preferred)** : `apple_app_store[transaction_id]` for a new subscription, expired re-purchase, or one-time product. \* **Apple App Store (receipt path)** : `apple_app_store[receipt]` and `apple_app_store[product_id]`. \* **Google Play Store (preferred)** : `google_play_store[order_id]` for a subscription or one-time order. \* **Google Play Store (subscription token path)** : `google_play_store[purchase_token]`. \* **Google Play Store (one-time order token path)** : `google_play_store[purchase_token]` and `google_play_store[product_id]`. 2. The API response includes a `recorded_purchase` object with the [status](https://docs.corsair.dev/docs/api/recorded_purchases/recorded_purchase-object#status) of the job. 3. When recording completes successfully, `status` updates from `in_process` to `completed` and Chargebee sets `omnichannel_transaction_id` plus either: \* **Subscription** : `linked_omnichannel_subscriptions`, with webhook [`omnichannel_subscription_created`](https://docs.corsair.dev/docs/api/events/webhook/omnichannel_subscription_created) (or [`omnichannel_subscription_imported`](https://docs.corsair.dev/docs/api/events/webhook/omnichannel_subscription_imported)). \* **One-time order** : `linked_omnichannel_one_time_orders`, with webhook [`omnichannel_one_time_order_created`](https://docs.corsair.dev/docs/api/events/webhook/omnichannel_one_time_order_created). 4. In addition to webhooks, retrieve the job by the `recorded_purchase` [id](https://docs.corsair.dev/docs/api/recorded_purchases/recorded_purchase-object#id) returned when you record the purchase. If `status` is `failed`, review [error\_detail](https://docs.corsair.dev/docs/api/recorded_purchases/recorded_purchase-object#error_detail) and see [`record_purchase_failed`](https://docs.corsair.dev/docs/api/events/webhook/record_purchase_failed). If `status` is `ignored`, the purchase was already recorded in Chargebee as an omnichannel subscription or one-time order. Chargebee does not create a new linked resource for this job---use the existing omnichannel subscription or one-time order. Linked IDs and `omnichannel_transaction_id` are populated when `status` is `completed`, not for `ignored`. See also [omnichannel events](https://docs.corsair.dev/docs/api/omnichannel_events). |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |

> [accordion] recorded\_purchase full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   app_id?: string | null,
>   source?: string | null,
>   status?: string | null,
>   omnichannel_transaction_id?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   linked_omnichannel_subscriptions?: {
>     omnichannel_subscription_id?: string | null
>   }[] | null,
>   linked_omnichannel_one_time_orders?: {
>     omnichannel_one_time_order_id?: string | null
>   }[] | null,
>   error_detail?: {
>     error_message?: string | null
>   } | null
> } | null
> ```

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

***

### get

`recordedPurchases.get`

Retrieve a recorded purchase. Retrieves a recorded\_purchase object using the recorded\_purchase.id returned by the Record a Purchase API.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.recordedPurchases.get({ recordedPurchaseId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `recordedPurchaseId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `recorded_purchase` | `object \| null` | No | **Important** \* Handle the **synchronous** API response first. Record a Purchase can fail immediately (for example, an incorrect `app_id`, a malformed URL or request, or recording a purchase that already belongs to a different customer) before a job is created---treat these as standard API errors (`4xx`). To reassign an existing omnichannel subscription to another customer, use [Move an omnichannel subscription](https://docs.corsair.dev/docs/api/omnichannel_subscriptions/move-an-omnichannel-subscription) instead of re-recording the purchase. \* After the call is accepted, purchase validation with Apple or Google is **asynchronous** . Track the job with `status` (`in_process` → `completed`, `failed`, or `ignored`). Omnichannel subscription or one-time order creation happens only after successful async completion. \* This resource is applicable for Apple App Store and Google Play Store. The recorded purchase resource represents a background job that syncs in-app purchases made through Apple App Store and Google Play Store with Chargebee. The [status](https://docs.corsair.dev/docs/api/recorded_purchases/recorded_purchase-object#status) (`in_process`, `completed`, `failed`, and `ignored`) attribute represents the current status of the background job. ### Record Apple and Google in-app purchases and retrieve linked omnichannel resources You can record subscription and one-time-order purchases made on Apple App Store or Google Play Store, then retrieve the resulting omnichannel resources. To record a purchase and retrieve details, follow these steps: 1. Use the [Record a Purchase API](https://docs.corsair.dev/docs/api/recorded_purchases/record-a-purchase) with `app_id`, `customer[id]`, and exactly one store payload: \* **Apple App Store (preferred)** : `apple_app_store[transaction_id]` for a new subscription, expired re-purchase, or one-time product. \* **Apple App Store (receipt path)** : `apple_app_store[receipt]` and `apple_app_store[product_id]`. \* **Google Play Store (preferred)** : `google_play_store[order_id]` for a subscription or one-time order. \* **Google Play Store (subscription token path)** : `google_play_store[purchase_token]`. \* **Google Play Store (one-time order token path)** : `google_play_store[purchase_token]` and `google_play_store[product_id]`. 2. The API response includes a `recorded_purchase` object with the [status](https://docs.corsair.dev/docs/api/recorded_purchases/recorded_purchase-object#status) of the job. 3. When recording completes successfully, `status` updates from `in_process` to `completed` and Chargebee sets `omnichannel_transaction_id` plus either: \* **Subscription** : `linked_omnichannel_subscriptions`, with webhook [`omnichannel_subscription_created`](https://docs.corsair.dev/docs/api/events/webhook/omnichannel_subscription_created) (or [`omnichannel_subscription_imported`](https://docs.corsair.dev/docs/api/events/webhook/omnichannel_subscription_imported)). \* **One-time order** : `linked_omnichannel_one_time_orders`, with webhook [`omnichannel_one_time_order_created`](https://docs.corsair.dev/docs/api/events/webhook/omnichannel_one_time_order_created). 4. In addition to webhooks, retrieve the job by the `recorded_purchase` [id](https://docs.corsair.dev/docs/api/recorded_purchases/recorded_purchase-object#id) returned when you record the purchase. If `status` is `failed`, review [error\_detail](https://docs.corsair.dev/docs/api/recorded_purchases/recorded_purchase-object#error_detail) and see [`record_purchase_failed`](https://docs.corsair.dev/docs/api/events/webhook/record_purchase_failed). If `status` is `ignored`, the purchase was already recorded in Chargebee as an omnichannel subscription or one-time order. Chargebee does not create a new linked resource for this job---use the existing omnichannel subscription or one-time order. Linked IDs and `omnichannel_transaction_id` are populated when `status` is `completed`, not for `ignored`. See also [omnichannel events](https://docs.corsair.dev/docs/api/omnichannel_events). |

> [accordion] recorded\_purchase full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   app_id?: string | null,
>   source?: string | null,
>   status?: string | null,
>   omnichannel_transaction_id?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   linked_omnichannel_subscriptions?: {
>     omnichannel_subscription_id?: string | null
>   }[] | null,
>   linked_omnichannel_one_time_orders?: {
>     omnichannel_one_time_order_id?: string | null
>   }[] | null,
>   error_detail?: {
>     error_message?: string | null
>   } | null
> } | null
> ```

***

## Resource Migrations

### getLatest

`resourceMigrations.getLatest`

Retrieve latest migration details. Gets the last migration details.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.resourceMigrations.getLatest({ from_site: 'example', entity_type: 'customer', entity_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `from_site` | `string` | Yes | Domain name to which the item is moved. |
| `entity_type` | `customer` | Yes | Type of the entity this record is stored for. \* customer - Entity that represents a customer |
| `entity_id` | `string` | Yes | Handle of the customer in the current site. |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `resource_migration` | `object \| null` | No | Resource Migration is used for finding the status of customer migration between Chargebee sites. |

> [accordion] resource\_migration full type
>
> ```ts theme={null}
> {
>   from_site?: string | null,
>   entity_type?: string | null,
>   entity_id?: string | null,
>   status?: string | null,
>   errors?: string | null,
>   created_at?: number | null,
>   updated_at?: number | null
> } | null
> ```

***

## Retry Segments

### get

`retrySegments.get`

Retrieve a retry segment. (GET /retry\_segments/\{retry-segment-id})

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.retrySegments.get({ retrySegmentId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice_id` | `string` | No | — |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `retrySegmentId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `retry_segment` | `object \| null` | No | — |

> [accordion] retry\_segment full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   name?: string | null,
>   invoice_id?: string | null,
>   enabled?: boolean | null,
>   priority?: number | null,
>   condition_logic?: string | null,
>   criteria?: any[] | null,
>   retry_settings?: {
>   } | null
> } | null
> ```

***

## Rules

### get

`rules.get`

Retrieve rule data. (GET /rules/\{rule-id})

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.rules.get({ ruleId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `ruleId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `rule` | `object \| null` | No | — |

> [accordion] rule full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   namespace?: string | null,
>   rule_name?: string | null,
>   rule_order?: number | null,
>   status?: string | null,
>   conditions?: string | null,
>   outcome?: string | null,
>   deleted?: boolean | null,
>   created_at?: number | null,
>   modified_at?: number | null
> } | null
> ```

***

## Site Migration Details

### list

`siteMigrationDetails.list`

List site migration details. This endpoint lists the site migration details.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.siteMigrationDetails.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `entity_id_at_other_site` | `object` | No | optional, string filter Entity Id of the record in the other site. **Supported operators :** is, is\_not, starts\_with **Example →** *entity\_id\_at\_other\_site\\\[is\\] = "null"* |
| `other_site_name` | `object` | No | optional, string filter Site name to which the record is moved in/out. **Supported operators :** is, is\_not, starts\_with **Example →** *other\_site\_name\\\[is\\] = "acme-test"* |
| `entity_id` | `object` | No | optional, string filter Id of the entity in this site. **Supported operators :** is, is\_not, starts\_with **Example →** *entity\_id\\\[is\\] = "8axqwer7as"* |
| `entity_type` | `object` | No | optional, enumerated string filter Entity Type of the record. Possible values are : customer, subscription, invoice, credit\_note, transaction, order. **Supported operators :** is, is\_not, in, not\_in **Example →** *entity\_type\\\[is\\] = "customer"* |
| `status` | `object` | No | optional, enumerated string filter Status of the migration. Possible values are : moved\_in, moved\_out, moving\_out. **Supported operators :** is, is\_not, in, not\_in **Example →** *status\\\[is\\] = "MOVED\_OUT"* |

> [accordion] entity\_id\_at\_other\_site full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string
> }
> ```

> [accordion] other\_site\_name full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string
> }
> ```

> [accordion] entity\_id full type
>
> ```ts theme={null}
> {
>   is?: string,
>   is_not?: string,
>   starts_with?: string
> }
> ```

> [accordion] entity\_type full type
>
> ```ts theme={null}
> {
>   is?: customer | subscription | invoice | credit_note | transaction | order,
>   is_not?: customer | subscription | invoice | credit_note | transaction | order,
>   in?: string,
>   not_in?: string
> }
> ```

> [accordion] status full type
>
> ```ts theme={null}
> {
>   is?: moved_in | moved_out | moving_out,
>   is_not?: moved_in | moved_out | moving_out,
>   in?: string,
>   not_in?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   site_migration_detail?: {
>     entity_id?: string | null,
>     other_site_name?: string | null,
>     entity_id_at_other_site?: string | null,
>     migrated_at?: number | null,
>     entity_type?: string | null,
>     status?: string | null
>   } | null
> }[] | null
> ```

***

## Site Pc Meta Records

### list

`sitePcMetaRecords.list`

List site pc meta records. (GET /site\_pc\_meta\_records)

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.sitePcMetaRecords.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set 'offset' to the value of 'next\_offset' obtained in the previous iteration of the API call. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

> [accordion] list full type
>
> ```ts theme={null}
> {
>   site_pc_meta_record?: {
>     id?: string | null,
>     event?: string | null,
>     pc_type?: string | null,
>     occurred_at?: number | null
>   } | null
> }[] | null
> ```

***

## Subscriptions

### addChargeAtTermEnd

`subscriptions.addChargeAtTermEnd`

Add charge at term end. Adds a one time charge to the subscription which will be added to the invoice generated at the end of the current term. If there are any applicable coupons in the subscription, an appropriate discount will be applied. To collect a charge immediately, use this API.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.subscriptions.addChargeAtTermEnd({ subscriptionId: 'sub_8gsnbYfsMLds', description: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `amount` | `number` | No | The amount to be charged. The unit depends on the [type of currency](https://docs.corsair.dev/docs/api/getting-started) . |
| `description` | `string` | Yes | Description for this charge. |
| `amount_in_decimal` | `string` | No | The decimal representation of the amount for the [one-time charge](https://www.chargebee.com/docs/charges.html#one-time-charges). Provide the value in major units of the currency. Can be provided only when [multi-decimal pricing](https://docs.corsair.dev/docs/api/currencies) is enabled. |
| `avalara_sale_type` | `wholesale \| retail \| consumed \| vendor_use` | No | Indicates the type of sale carried out. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. \* retail - Transaction is a sale to an end user \* wholesale - Transaction is a sale to another company that will resell your product or service to another consumer \* vendor\_use - Transaction is for an item that is subject to vendor use tax \* consumed - Transaction is for an item that is consumed directly |
| `avalara_transaction_type` | `number` | No | Indicates the type of product to be taxed. Values for this field can be taken from Avalara. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. |
| `avalara_service_type` | `number` | No | Indicates the type of service for the product to be taxed. Values for this field can be taken from Avalara. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. |
| `date_from` | `number` | No | The time when the service period for the charge starts. |
| `date_to` | `number` | No | The time when the service period for the charge ends. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `estimate` | `object \| null` | No | During the process of signing up customers to subscriptions, use the Estimates API to evaluate the details of the purchase before actually signing them up. The details returned by the API include the invoice amounts, next billing date and unbilled charges. For example, consider that you are creating a new subscription or update an existing one. Use the Estimates API before that to deduce the details such as the amount the customer would be charged, the state the subscription would be in after creation or updation, and so on. If you have configured the [Avalara integration](https://www.chargebee.com/docs/2.0/avalara.html), Chargebee retrieves the tax amount from Avalara for the invoice. This counts against your Avalara API limits. |

> [accordion] estimate full type
>
> ```ts theme={null}
> {
>   created_at?: number | null,
>   subscription_estimate?: {
>     id?: string | null,
>     currency_code?: string | null,
>     status?: string | null,
>     trial_end_action?: string | null,
>     next_billing_at?: number | null,
>     pause_date?: number | null,
>     resume_date?: number | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     contract_term?: {
>       id?: string | null,
>       status?: string | null,
>       contract_start?: number | null,
>       contract_end?: number | null,
>       billing_cycle?: number | null,
>       action_at_term_end?: string | null,
>       total_contract_value?: number | null,
>       total_contract_value_before_tax?: number | null,
>       cancellation_cutoff_period?: number | null,
>       created_at?: number | null,
>       subscription_id?: string | null,
>       remaining_billing_cycles?: number | null
>     } | null
>   } | null,
>   subscription_estimates?: {
>     id?: string | null,
>     currency_code?: string | null,
>     status?: string | null,
>     trial_end_action?: string | null,
>     next_billing_at?: number | null,
>     pause_date?: number | null,
>     resume_date?: number | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     contract_term?: {
>       id?: string | null,
>       status?: string | null,
>       contract_start?: number | null,
>       contract_end?: number | null,
>       billing_cycle?: number | null,
>       action_at_term_end?: string | null,
>       total_contract_value?: number | null,
>       total_contract_value_before_tax?: number | null,
>       cancellation_cutoff_period?: number | null,
>       created_at?: number | null,
>       subscription_id?: string | null,
>       remaining_billing_cycles?: number | null
>     } | null
>   }[] | null,
>   invoice_estimate?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   } | null,
>   invoice_estimates?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   }[] | null,
>   payment_schedule_estimates?: {
>     id?: string | null,
>     scheme_id?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     amount?: number | null,
>     currency_code?: string | null,
>     schedule_entries?: {
>       id?: string | null,
>       date?: number | null,
>       amount?: number | null,
>       scheduled_amount?: number | null,
>       status?: string | null
>     }[] | null
>   }[] | null,
>   next_invoice_estimate?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   } | null,
>   credit_note_estimates?: {
>     reference_invoice_id?: string | null,
>     type?: string | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     amount_allocated?: number | null,
>     amount_available?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   }[] | null,
>   unbilled_charge_estimates?: {
>     id?: string | null,
>     customer_id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     pricing_model?: string | null,
>     quantity?: number | null,
>     amount?: number | null,
>     currency_code?: string | null,
>     discount_amount?: number | null,
>     description?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     is_voided?: boolean | null,
>     voided_at?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     is_advance_charge?: boolean | null,
>     business_entity_id?: string | null,
>     deleted?: boolean | null
>   }[] | null
> } | null
> ```

***

### advanceInvoiceEstimate

`subscriptions.advanceInvoiceEstimate`

Advance invoice estimate. This API is used to generate an invoice estimate for preview. Estimate details include the number of billing cycles to be invoiced in advance, the number of billing cycles in one interval, advance invoicing schedules, and so on.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.subscriptions.advanceInvoiceEstimate({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `terms_to_charge` | `number` | No | \* For `schedule_type = immediate`: the number of future billing cycles to be invoiced in advance. The invoicing is done for the [`remaining_billing_cycles`](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#remaining_billing_cycles) of the subscription if that is less than `terms_to_charge`. \* For `schedule_type = fixed_intervals`: The number of future billing cycles in one [interval](https://docs.corsair.dev/docs/api/advance_invoice_schedules). The schedule is created such that the total number of billing cycles in the schedule does not exceed the [remaining\_billing\_cycles](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#remaining_billing_cycles) of the subscription. . |
| `invoice_immediately` | `boolean` | No | Whether the charge should be invoiced immediately or added to [`unbilled_charges`](https://docs.corsair.dev/docs/api/unbilled_charges). Applicable only when [`schedule_type`](https://docs.corsair.dev/docs/api/subscriptions/charge-future-renewals#schedule_type) is `immediate` . |
| `schedule_type` | `immediate \| specific_dates \| fixed_intervals` | No | The type of advance invoice or advance invoicing schedule. \* immediate - Charge immediately for the number of billing cycles specified by [`terms_to_charge`](https://docs.corsair.dev/docs/api/subscriptions/charge-future-renewals#terms_to_charge) . \* specific\_dates - Charge on [specific dates](https://docs.corsair.dev/docs/api/subscriptions/charge-future-renewals#specific_dates_schedule_date). For each date, specify the [number of billing cycles](https://docs.corsair.dev/docs/api/subscriptions/charge-future-renewals#specific_dates_schedule_terms_to_charge) to charge for. Up to 5 dates can be configured. \* fixed\_intervals - Charge at fixed intervals of time. Specify the [number of billing cycles](https://docs.corsair.dev/docs/api/subscriptions/charge-future-renewals#terms_to_charge) that constitute an interval and the number of [days before each interval](https://docs.corsair.dev/docs/api/subscriptions/charge-future-renewals#fixed_interval_schedule_days_before_renewal) that the invoice should be generated. Also specify [when the schedule should end](https://docs.corsair.dev/docs/api/subscriptions/charge-future-renewals#fixed_interval_schedule_end_schedule_on) . |
| `fixed_interval_schedule` | `object` | No | Parameters for fixed\_interval\_schedule |
| `specific_dates_schedule` | `object` | No | Parameters for specific\_dates\_schedule |

> [accordion] fixed\_interval\_schedule full type
>
> ```ts theme={null}
> {
>   number_of_occurrences?: number,
>   days_before_renewal?: number,
>   end_schedule_on?: after_number_of_intervals | specific_date | subscription_end,
>   end_date?: number
> }
> ```

> [accordion] specific\_dates\_schedule full type
>
> ```ts theme={null}
> {
>   terms_to_charge?: number[],
>   date?: number[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `estimate` | `object \| null` | No | During the process of signing up customers to subscriptions, use the Estimates API to evaluate the details of the purchase before actually signing them up. The details returned by the API include the invoice amounts, next billing date and unbilled charges. For example, consider that you are creating a new subscription or update an existing one. Use the Estimates API before that to deduce the details such as the amount the customer would be charged, the state the subscription would be in after creation or updation, and so on. If you have configured the [Avalara integration](https://www.chargebee.com/docs/2.0/avalara.html), Chargebee retrieves the tax amount from Avalara for the invoice. This counts against your Avalara API limits. |

> [accordion] estimate full type
>
> ```ts theme={null}
> {
>   created_at?: number | null,
>   subscription_estimate?: {
>     id?: string | null,
>     currency_code?: string | null,
>     status?: string | null,
>     trial_end_action?: string | null,
>     next_billing_at?: number | null,
>     pause_date?: number | null,
>     resume_date?: number | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     contract_term?: {
>       id?: string | null,
>       status?: string | null,
>       contract_start?: number | null,
>       contract_end?: number | null,
>       billing_cycle?: number | null,
>       action_at_term_end?: string | null,
>       total_contract_value?: number | null,
>       total_contract_value_before_tax?: number | null,
>       cancellation_cutoff_period?: number | null,
>       created_at?: number | null,
>       subscription_id?: string | null,
>       remaining_billing_cycles?: number | null
>     } | null
>   } | null,
>   subscription_estimates?: {
>     id?: string | null,
>     currency_code?: string | null,
>     status?: string | null,
>     trial_end_action?: string | null,
>     next_billing_at?: number | null,
>     pause_date?: number | null,
>     resume_date?: number | null,
>     shipping_address?: {
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     } | null,
>     contract_term?: {
>       id?: string | null,
>       status?: string | null,
>       contract_start?: number | null,
>       contract_end?: number | null,
>       billing_cycle?: number | null,
>       action_at_term_end?: string | null,
>       total_contract_value?: number | null,
>       total_contract_value_before_tax?: number | null,
>       cancellation_cutoff_period?: number | null,
>       created_at?: number | null,
>       subscription_id?: string | null,
>       remaining_billing_cycles?: number | null
>     } | null
>   }[] | null,
>   invoice_estimate?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   } | null,
>   invoice_estimates?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   }[] | null,
>   payment_schedule_estimates?: {
>     id?: string | null,
>     scheme_id?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     amount?: number | null,
>     currency_code?: string | null,
>     schedule_entries?: {
>       id?: string | null,
>       date?: number | null,
>       amount?: number | null,
>       scheduled_amount?: number | null,
>       status?: string | null
>     }[] | null
>   }[] | null,
>   next_invoice_estimate?: {
>     recurring?: boolean | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     credits_applied?: number | null,
>     amount_paid?: number | null,
>     amount_due?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     line_item_credits?: {
>       cn_id?: string | null,
>       applied_amount?: number | null,
>       line_item_id?: string | null
>     }[] | null,
>     line_item_addresses?: {
>       line_item_id?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       email?: string | null,
>       company?: string | null,
>       phone?: string | null,
>       line1?: string | null,
>       line2?: string | null,
>       line3?: string | null,
>       city?: string | null,
>       state_code?: string | null,
>       state?: string | null,
>       country?: string | null,
>       zip?: string | null,
>       validation_status?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   } | null,
>   credit_note_estimates?: {
>     reference_invoice_id?: string | null,
>     type?: string | null,
>     price_type?: string | null,
>     currency_code?: string | null,
>     sub_total?: number | null,
>     total?: number | null,
>     amount_allocated?: number | null,
>     amount_available?: number | null,
>     line_items?: {
>       id?: string | null,
>       subscription_id?: string | null,
>       date_from?: number | null,
>       date_to?: number | null,
>       unit_amount?: number | null,
>       quantity?: number | null,
>       amount?: number | null,
>       pricing_model?: string | null,
>       is_taxed?: boolean | null,
>       tax_amount?: number | null,
>       tax_rate?: number | null,
>       unit_amount_in_decimal?: string | null,
>       quantity_in_decimal?: string | null,
>       amount_in_decimal?: string | null,
>       discount_amount?: number | null,
>       item_level_discount_amount?: number | null,
>       metered?: boolean | null,
>       is_percentage_pricing?: boolean | null,
>       reference_line_item_id?: string | null,
>       description?: string | null,
>       entity_description?: string | null,
>       entity_type?: string | null,
>       tax_exempt_reason?: string | null,
>       entity_id?: string | null,
>       customer_id?: string | null,
>       proration_mode?: string | null
>     }[] | null,
>     line_item_tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     line_item_discounts?: {
>       line_item_id?: string | null,
>       discount_type?: string | null,
>       coupon_id?: string | null,
>       entity_id?: string | null,
>       discount_amount?: number | null
>     }[] | null,
>     line_item_taxes?: {
>       line_item_id?: string | null,
>       tax_name?: string | null,
>       tax_rate?: number | null,
>       date_to?: number | null,
>       date_from?: number | null,
>       prorated_taxable_amount?: number | null,
>       is_partial_tax_applied?: boolean | null,
>       is_non_compliance_tax?: boolean | null,
>       taxable_amount?: number | null,
>       tax_amount?: number | null,
>       tax_juris_type?: string | null,
>       tax_juris_name?: string | null,
>       tax_juris_code?: string | null,
>       tax_amount_in_local_currency?: number | null,
>       local_currency_code?: string | null
>     }[] | null,
>     discounts?: {
>       amount?: number | null,
>       description?: string | null,
>       line_item_id?: string | null,
>       entity_type?: string | null,
>       discount_type?: string | null,
>       entity_id?: string | null,
>       coupon_set_code?: string | null
>     }[] | null,
>     taxes?: {
>       name?: string | null,
>       amount?: number | null,
>       description?: string | null
>     }[] | null,
>     round_off_amount?: number | null,
>     customer_id?: string | null
>   }[] | null,
>   unbilled_charge_estimates?: {
>     id?: string | null,
>     customer_id?: string | null,
>     subscription_id?: string | null,
>     date_from?: number | null,
>     date_to?: number | null,
>     unit_amount?: number | null,
>     pricing_model?: string | null,
>     quantity?: number | null,
>     amount?: number | null,
>     currency_code?: string | null,
>     discount_amount?: number | null,
>     description?: string | null,
>     entity_type?: string | null,
>     entity_id?: string | null,
>     is_voided?: boolean | null,
>     voided_at?: number | null,
>     unit_amount_in_decimal?: string | null,
>     quantity_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     tiers?: {
>       line_item_id?: string | null,
>       starting_unit?: number | null,
>       ending_unit?: number | null,
>       quantity_used?: number | null,
>       unit_amount?: number | null,
>       starting_unit_in_decimal?: string | null,
>       ending_unit_in_decimal?: string | null,
>       quantity_used_in_decimal?: string | null,
>       unit_amount_in_decimal?: string | null,
>       pricing_type?: string | null,
>       package_size?: number | null
>     }[] | null,
>     is_advance_charge?: boolean | null,
>     business_entity_id?: string | null,
>     deleted?: boolean | null
>   }[] | null
> } | null
> ```

***

### cancel

`subscriptions.cancel`

Cancel a subscription. Cancelling a subscription will move the subscription from its current state to Cancelled, and will stop all recurring actions. You could schedule the cancellation by passing end\_of\_term parameter as true . Product Catalog 1.0 sites only.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.subscriptions.cancel({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `subscriptionId` | `string` | Yes | — |
| `cancel_option` | `immediately \| end_of_term \| specific_date \| end_of_billing_term` | No | ##### If the subscription does not have a contract term: Determines when to cancel the subscription. ##### If the subscription has a contract term: This parameter is not applicable. \* end\_of\_billing\_term - This is used to cancel a subscription either at the end of the advance term, if it's billed for future renewals or at the end of its current billing cycle \* end\_of\_term - This is used to cancel a subscription at the end of the current billing cycle \* immediately - This is used to cancel the subscription with immediate effect \* specific\_date - This is used to cancel a subscription on a specified date. The change occurs as of the date/time defined in `cancel_at` |
| `end_of_term` | `boolean` | No | **(Deprecated)** Use `cancel_option` instead. Applicable only when the subscription does not have [contract terms](https://docs.corsair.dev/docs/api/contract_terms). Set this to `true` if you want to cancel the subscription at the end of the current subscription billing cycle. The subscription `status` changes to `non_renewing`. |
| `cancel_at` | `number` | No | ##### If the subscription does not have a contract term: Specifies the date and time when the subscription should be canceled. Do not use this parameter when `end_of_term` is set to `true`. ##### If the subscription has a contract term: Applicable only when `contract_term_cancel_option` is `specific_date`. Specifies the date and time to cancel the subscription and contract term. ##### Backdating You can set a past date to backdate the cancellation. Backdating is allowed only if the following conditions are met: \* [Backdating](https://www.chargebee.com/docs/1.0/backdating.html) is enabled for subscription cancellation. \* The current date does not exceed the [backdating limit configured in Chargebee Billing](https://www.chargebee.com/docs/1.0/backdating.html#configuring-backdated-subscription-actions-and-invoicing). \* The date is on or after the `current_term_start`. \* The date is on or after the most recent change involving: \* Addition/change/removal of plan or addon item prices. \* Addition of charge item prices. \* The date is not more than one billing period into the past. For example, if the plan's billing period is two months and today is April 14, `cancel_at` cannot be earlier than February 14. |
| `credit_option_for_current_term_charges` | `none \| prorate \| full \| consumption_based` | No | ##### If the subscription does not have a contract term: Specifies how to handle credits for current term charges when canceling immediately (i.e., `cancel_option` is `immediately`). If not specified, the [site-level setting](https://www.chargebee.com/docs/1.0/cancellations.html#configure-subscription-cancellation) is used. ##### If the subscription has a contract term: Specifies how to handle credits for current term charges when `contract_term_cancel_option` is `terminate_immediately`. If not specified, the [site-level setting](https://www.chargebee.com/docs/1.0/contract-terms.html#configuring-contract-terms) is used. \* none - No credits notes are created. \* full - Credits are issues for the full value of the current term charges. \* prorate - Prorated credits are issued. |
| `unbilled_charges_option` | `invoice \| delete` | No | ##### If the subscription does not have a contract term: Specifies how to handle unbilled charges when canceling immediately (i.e., `cancel_option` is `immediately`). If not specified, the [site-level setting](https://www.chargebee.com/docs/1.0/cancellations.html#configure-subscription-cancellation) is used. ##### If the subscription has a contract term: Specifies how to handle unbilled charges when `contract_term_cancel_option` is `terminate_immediately`. If not specified, the [site-level setting](https://www.chargebee.com/docs/1.0/contract-terms.html#configuring-contract-terms) is used. \* invoice - An invoice is generated immediately with the unbilled charges. \* delete - The unbilled charges are deleted. |
| `account_receivables_handling` | `no_action \| schedule_payment_collection \| write_off` | No | ##### If the subscription does not have a contract term: Specifies how to handle past due invoices when canceling immediately (i.e., `cancel_option` is `immediately`). If not specified, the [site-level setting](https://www.chargebee.com/docs/1.0/cancellations.html#configure-subscription-cancellation) is used. ##### If the subscription has a contract term: Specifies how to handle past due invoices when `contract_term_cancel_option` is `terminate_immediately`. If not specified, the [site-level setting](https://www.chargebee.com/docs/1.0/contract-terms.html#configuring-contract-terms) is used. \* no\_action - No action is taken. \* write\_off - Applies excess payments and refundable credits to past due invoices. Any remaining balance is written off. *Note: The credit note for the write-off is not included in the API response.* \* schedule\_payment\_collection - Applies excess payments and refundable credits to past due invoices. If any amount remains and `auto_collection` is `on` , the remaining amount is automatically charged to the available payment method. |
| `refundable_credits_handling` | `no_action \| schedule_refund` | No | ##### If the subscription does not have a contract term: Specifies how to handle refundable credits when canceling immediately (i.e., `cancel_option` is `immediately`). If not specified, the [site-level setting](https://www.chargebee.com/docs/1.0/cancellations.html#configure-subscription-cancellation) is used. ##### If the subscription has a contract term: Specifies how to handle refundable credits when `contract_term_cancel_option` is `terminate_immediately`. If not specified, the [site-level setting](https://www.chargebee.com/docs/1.0/contract-terms.html#configuring-contract-terms) is used. \* schedule\_refund - Refunds remaining credits after applying them to any past due invoices. \* no\_action - No action is taken. |
| `contract_term_cancel_option` | `terminate_immediately \| end_of_contract_term \| specific_date \| end_of_subscription_billing_term` | No | Required when the subscription has a contract term. Determines when to cancel the subscription along with the contract term. \* terminate\_immediately - Cancels the subscription and contract term immediately. Sets the contract term's `status` to `terminated` and collects any termination fee, if applicable. To specify the termination fee, include a single object in the `subscription_items` array. If not specified, the [default termination fee](https://docs.corsair.dev/docs/api/contract_terms) is applied (if configured). \* end\_of\_contract\_term - Prevents the contract term from renewing and schedules the subscription for cancellation at the end of the contract term. \* specific\_date - Cancels the subscription and contract term on the date specified by `cancel_at`. Sets `action_at_term_end` to `cancel`. **Note** : Contact [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 option for your [Chargebee site](https://www.chargebee.com/docs/1.0/sites-intro.html). \* end\_of\_subscription\_billing\_term - Cancels the subscription and contract term at the end of the current billing cycle. Sets `action_at_term_end` to `cancel`. **Note** : Contact [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 option for your [Chargebee site](https://www.chargebee.com/docs/1.0/sites-intro.html). |
| `invoice_date` | `number` | No | 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 `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 `cancel_at`. . |
| `cancel_reason_code` | `string` | No | Reason code for canceling the subscription. Must be one from a list of reason codes set in the Chargebee app in **Settings \\> Configure Chargebee \\> Reason Codes \\> Subscriptions \\> Subscription Cancellation**. Must be passed if set as mandatory in the app. The codes are case-sensitive. |
| `event_based_addons` | `object` | No | Parameters for event\_based\_addons |

> [accordion] event\_based\_addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   unit_price?: number[],
>   service_period_in_days?: number[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `subscription` | `object \| null` | No | Subscription represents the recurring items a customer has subscribed to. The recurring items can be - plan, addons. It may also contain the discount items like coupons. Subscriptions are invoiced at the start of every term based on the recurring items and charged immediately against the customer's credit card if 'auto\_collection' is turned 'on', otherwise the resulting invoice will be created as 'Payment Due'. **Note:** The maximum number of subscriptions for any given [customer](https://docs.corsair.dev/docs/api/customers) ([active](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#status) or not) is 900. Tax provider fields **Avalara** : Merchants using **Avalara Sales Tax** can optionally associate each item price with a locationCode (from their Avalara company locations), so tax can be resolved correctly at the line item level. \| Field ID \| Field Value \| APIs \| \|--------------------------------------------------------------------------------\|----------------------------------------------------------------------\|--------------------------------------------------------------------------------\| \| `locationCode` \| Merchant to configure it on Avalara Platform under company locations \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| **Anrok**: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation \| Field ID \| Field Value \| APIs \| \|---------------------------------------------------------------------------------------------------------------------------------------\|---------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------\| \| `additionalTaxRegistrationNumber` \| Canadian tax registration numbers in comma separated fashion. \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| **Vertex**: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration **Note:** Field Id like `customerCode` , `customerClass` , and`taxExempted` belong to the customer object. Field Id like `productCode` , `productClass` , `productTaxCode` , and `productClass` belong to the product object. \| Field ID \| Field Value \| APIs \| \|-----------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productCode` \| Merchant to configure it on Vertex Platform \| APIs having [Plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object)(PC1), [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object)(PC1) and [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object)(PC2) attributes. \| \| `productClass` \| Merchant to configure it on Vertex Platform \| APIs having [Plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object)(PC1), [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object)(PC1) and [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object)(PC2) attributes. \| \| `customerCode` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `customerClass` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **Taxamo:** Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration \| Field Id \| Field Value \| APIs \| \|------------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productTaxCode` \| Merchant to configure it on Taxamo Platform \| APIs having [Plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object)(PC1), [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object)(PC1) and Item Prices (PC2) attributes. \| \| `productClass` \| Merchant to configure it on Taxamo Platform \| APIs having [Plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object)(PC1), [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object)(PC1) and Item Prices (PC2) attributes. \| \| `taxExempted` \| Merchant to configure it on Taxamo Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **cbtaxes**: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India. \| Field ID \| Field Value \| APIs \| \|---------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `indiaSez` \| `SEZ_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaSez` \| `SEZ_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **All**: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level \| Field ID \| Field Value \| APIs \| \|-------------\|-----------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `priceType` \| `TAX_INCLUSIVE` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| \| `TAX_EXCLUSIVE` \| \| \| \| `SITE_DEFAULT` \| Removes price type override, and allows site level configuration to be used for tax calculation. \| **Note:** Make sure you choose the correct **Field ID** and **Available APIs** combination from the table above. All Product Catalog APIs include [Plans](https://docs.corsair.dev/docs/api/v2/pcv-1/plans) , [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons) , [Coupons](https://docs.corsair.dev/docs/api/v2/pcv-1/coupons) , [Coupon Sets](https://docs.corsair.dev/docs/api/v2/pcv-1/coupon_sets) , [Coupon Codes](https://docs.corsair.dev/docs/api/v2/pcv-1/coupon_codes) . |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/v2/pcv-1/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/v2/pcv-1/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any custom attributes you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/1.0/sites-intro.html)\\*\\* created before March 1, 2014\\*\\*: [updating the card](https://docs.corsair.dev/docs/api/v2/pcv-1/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/v2/pcv-1/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |
| `invoice` | `object \| null` | No | Invoices are statements containing charges, adjustments and any discounts for a subscription specific to a term. For every subscription a draft invoice (upcoming invoice) is used to track all the charges, credits and adjustments for the current term. Generally, an invoice is closed at start of the next term. However, cancellation and other such operations on subscription may trigger premature closing. While closing the invoice, in addition to recurring charges, credits and coupons are applied to calculate the final amount that is due. When invoice is closed, an attempt to charge the credit card is made. If the payment succeeds, it is marked as **paid** . If the payment fails, the invoice is marked as **payment\_due** and retry settings are taken into account. If no retry attempts are configured, the invoice is marked as **not\_paid** . If the amount due is zero or negative, the invoice is immediately marked as **paid** and the balance if any is carried forward to the next term of the invoice. **Note:** If *consolidated invoicing* is enabled, the attribute *invoice.subscription\_id* should **not** be used (as it will not be present if the invoice has lines from multiple subscriptions). Instead to know the related subscriptions, their [line\_items](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) *subscription\_id* attribute should be referred. |
| `unbilled_charges` | `object[] \| null` | No | Resource object representing unbilled\_charge |
| `credit_notes` | `object[] \| null` | No | Resource object representing credit\_note |

> [accordion] subscription full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   currency_code?: string | null,
>   plan_id?: string | null,
>   plan_quantity?: number | null,
>   plan_unit_price?: number | null,
>   setup_fee?: number | null,
>   billing_period?: number | null,
>   billing_period_unit?: string | null,
>   start_date?: number | null,
>   trial_end?: number | null,
>   remaining_billing_cycles?: number | null,
>   po_number?: string | null,
>   auto_collection?: string | null,
>   plan_quantity_in_decimal?: string | null,
>   plan_unit_price_in_decimal?: string | null,
>   customer_id?: string | null,
>   plan_amount?: number | null,
>   plan_free_quantity?: number | null,
>   status?: string | null,
>   trial_start?: number | null,
>   trial_end_action?: string | null,
>   current_term_start?: number | null,
>   current_term_end?: number | null,
>   next_billing_at?: number | null,
>   created_at?: number | null,
>   started_at?: number | null,
>   activated_at?: number | null,
>   gift_id?: string | null,
>   contract_term_billing_cycle_on_renewal?: number | null,
>   override_relationship?: boolean | null,
>   pause_date?: number | null,
>   resume_date?: number | null,
>   cancelled_at?: number | null,
>   cancel_reason?: string | null,
>   affiliate_token?: string | null,
>   created_from_ip?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   has_scheduled_advance_invoices?: boolean | null,
>   has_scheduled_changes?: boolean | null,
>   payment_source_id?: string | null,
>   plan_free_quantity_in_decimal?: string | null,
>   plan_amount_in_decimal?: string | null,
>   cancel_schedule_created_at?: number | null,
>   offline_payment_method?: string | null,
>   channel?: string | null,
>   active_id?: string | null,
>   due_invoices_count?: number | null,
>   due_since?: number | null,
>   total_dues?: number | null,
>   mrr?: number | null,
>   exchange_rate?: number | null,
>   base_currency_code?: string | null,
>   invoice_notes?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   changes_scheduled_at?: number | null,
>   cancel_reason_code?: string | null,
>   free_period?: number | null,
>   free_period_unit?: string | null,
>   create_pending_invoices?: boolean | null,
>   auto_close_invoices?: boolean | null,
>   business_entity_id?: string | null,
>   decommissioned?: boolean | null,
>   brand_id?: string | null,
>   addons?: {
>     id?: string | null,
>     quantity?: number | null,
>     unit_price?: number | null,
>     amount?: number | null,
>     trial_end?: number | null,
>     remaining_billing_cycles?: number | null,
>     quantity_in_decimal?: string | null,
>     unit_price_in_decimal?: string | null,
>     amount_in_decimal?: string | null,
>     proration_type?: string | null
>   }[] | null,
>   event_based_addons?: {
>     id?: string | null,
>     quantity?: number | null,
>     unit_price?: number | null,
>     on_event?: string | null,
>     charge_once?: boolean | null,
>     quantity_in_decimal?: string | null,
>     unit_price_in_decimal?: string | null
>   }[] | null,
>   charged_event_based_addons?: {
>     id?: string | null,
>     last_charged_at?: number | null
>   }[] | null,
>   coupons?: {
>     coupon_id?: string | null,
>     apply_till?: number | null,
>     applied_count?: number | null,
>     coupon_code?: string | null
>   }[] | null,
>   shipping_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_info?: {
>     referral_code?: string | null,
>     coupon_code?: string | null,
>     referrer_id?: string | null,
>     external_reference_id?: string | null,
>     reward_status?: string | null,
>     referral_system?: string | null,
>     account_id?: string | null,
>     campaign_id?: string | null,
>     external_campaign_id?: string | null,
>     friend_offer_type?: string | null,
>     referrer_reward_type?: string | null,
>     notify_referral_system?: string | null,
>     destination_url?: string | null,
>     post_purchase_widget_enabled?: boolean | null
>   } | null,
>   contract_term?: {
>     id?: string | null,
>     status?: string | null,
>     contract_start?: number | null,
>     contract_end?: number | null,
>     billing_cycle?: number | null,
>     action_at_term_end?: string | null,
>     total_contract_value?: number | null,
>     total_contract_value_before_tax?: number | null,
>     cancellation_cutoff_period?: number | null,
>     created_at?: number | null,
>     subscription_id?: string | null,
>     remaining_billing_cycles?: number | null
>   } | null
> } | null
> ```

> [accordion] customer full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   email?: string | null,
>   phone?: string | null,
>   company?: string | null,
>   vat_number?: string | null,
>   auto_collection?: string | null,
>   offline_payment_method?: string | null,
>   net_term_days?: number | null,
>   vat_number_validated_time?: number | null,
>   vat_number_status?: string | null,
>   allow_direct_debit?: boolean | null,
>   is_location_valid?: boolean | null,
>   created_at?: number | null,
>   created_from_ip?: string | null,
>   exemption_details?: any[] | null,
>   taxability?: string | null,
>   entity_code?: string | null,
>   exempt_number?: string | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   locale?: string | null,
>   billing_date?: number | null,
>   billing_month?: number | null,
>   billing_date_mode?: string | null,
>   billing_day_of_week?: string | null,
>   billing_day_of_week_mode?: string | null,
>   pii_cleared?: string | null,
>   auto_close_invoices?: boolean | null,
>   channel?: string | null,
>   active_id?: string | null,
>   fraud_flag?: string | null,
>   primary_payment_source_id?: string | null,
>   backup_payment_source_id?: string | null,
>   invoice_notes?: string | null,
>   business_entity_id?: string | null,
>   preferred_currency_code?: string | null,
>   promotional_credits?: number | null,
>   unbilled_charges?: number | null,
>   refundable_credits?: number | null,
>   excess_payments?: number | null,
>   is_einvoice_enabled?: boolean | null,
>   einvoicing_method?: string | null,
>   meta_data?: {
>   } | null,
>   deleted?: boolean | null,
>   registered_for_gst?: boolean | null,
>   consolidated_invoicing?: boolean | null,
>   customer_type?: string | null,
>   business_customer_without_vat_number?: boolean | null,
>   client_profile_id?: string | null,
>   use_default_hierarchy_settings?: boolean | null,
>   vat_number_prefix?: string | null,
>   entity_identifier_scheme?: string | null,
>   entity_identifier_standard?: string | null,
>   brand_id?: string | null,
>   billing_address?: {
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     company?: string | null,
>     phone?: string | null,
>     line1?: string | null,
>     line2?: string | null,
>     line3?: string | null,
>     city?: string | null,
>     state_code?: string | null,
>     state?: string | null,
>     country?: string | null,
>     zip?: string | null,
>     validation_status?: string | null
>   } | null,
>   referral_urls?: {
>     external_customer_id?: string | null,
>     referral_sharing_url?: string | null,
>     created_at?: number | null,
>     updated_at?: number | null,
>     referral_campaign_id?: string | null,
>     referral_account_id?: string | null,
>     referral_external_campaign_id?: string | null,
>     referral_system?: string | null
>   }[] | null,
>   contacts?: {
>     id?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     email?: string | null,
>     phone?: string | null,
>     label?: string | null,
>     enabled?: boolean | null,
>     send_account_email?: boolean | null,
>     send_billing_email?: boolean | null
>   }[] | null,
>   payment_method?: {
>     type?: string | null,
>     gateway?: string | null,
>     gateway_account_id?: string | null,
>     status?: string | null,
>     reference_id?: string | null
>   } | null,
>   balances?: {
>     promotional_credits?: number | null,
>     excess_payments?: number | null,
>     refundable_credits?: number | null,
>     unbilled_charges?: number | null,
>     currency_code?: string | null,
>     business_entity_id?: string | null
>   }[] | null,
>   entity_identifiers?: {
>     id?: string | null,
>     value?: string | null,
>     scheme?: string | null,
>     standard?: string | null
>   }[] | null,
>   tax_providers_fields?: {
>     provider_name?: string | null,
>     field_id?: string | null,
>     field_value?: string | null
>   }[] | null,
>   relationship?: {
>     parent_id?: string | null,
>     payment_owner_id?: string | null,
>     invoice_owner_id?: string | null
>   } | null,
>   parent_account_access?: {
>     portal_edit_child_subscriptions?: string | null,
>     portal_download_child_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null,
>   child_account_access?: {
>     portal_edit_subscriptions?: string | null,
>     portal_download_invoices?: string | null,
>     send_subscription_emails?: boolean | null,
>     send_invoice_emails?: boolean | null,
>     send_payment_emails?: boolean | null
>   } | null
> } | null
> ```

> [accordion] card full type
>
> ```ts theme={null}
> {
>   payment_source_id?: string | null,
>   status?: string | null,
>   gateway?: string | null,
>   gateway_account_id?: string | null,
>   ref_tx_id?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   iin?: string | null,
>   last4?: string | null,
>   card_type?: string | null,
>   funding_type?: string | null,
>   expiry_month?: number | null,
>   expiry_year?: number | null,
>   issuing_country?: string | null,
>   billing_addr1?: string | null,
>   billing_addr2?: string | null,
>   billing_city?: string | null,
>   billing_state_code?: string | null,
>   billing_state?: string | null,
>   billing_country?: string | null,
>   billing_zip?: string | null,
>   created_at?: number | null,
>   resource_version?: number | null,
>   updated_at?: number | null,
>   ip_address?: string | null,
>   powered_by?: string | null,
>   customer_id?: string | null,
>   masked_number?: string | null
> } | null
> ```

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  payment_owner?: string | null,
  subscription_id?: string | null,
  recurring?: boolean | null,
  status?: string | null,
  date?: number | null,
  due_date?: number | null,
  net_term_days?: number | null,
  po_number?: string | null,
  vat_number?: string | null,
  price_type?: string | null,
  exchange_rate?: number | null,
  local_currency_exchange_rate?: number | null,
  currency_code?: string | null,
  local_currency_code?: string | null,
  tax?: number | null,
  sub_total?: number | null,
  sub_total_in_local_currency?: number | null,
  total?: number | null,
  total_in_local_currency?: number | null,
  amount_due?: number | null,
  amount_adjusted?: number | null,
  amount_paid?: number | null,
  paid_at?: number | null,
  write_off_amount?: number | null,
  credits_applied?: number | null,
  dunning_status?: string | null,
  next_retry_at?: number | null,
  voided_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  line_items_next_offset?: string | null,
  first_invoice?: boolean | null,
  new_sales_amount?: number | null,
  has_advance_charges?: boolean | null,
  offline_payment_method?: string | null,
  term_finalized?: boolean | null,
  is_gifted?: boolean | null,
  generated_at?: number | null,
  expected_payment_date?: number | null,
  amount_to_collect?: number | null,
  round_off_amount?: number | null,
  retry_segment_id?: string | null,
  void_reason_code?: string | null,
  deleted?: boolean | null,
  tax_category?: string | null,
  vat_number_prefix?: string | null,
  channel?: string | null,
  business_entity_id?: string | null,
  brand_id?: string | null,
  exchange_rates?: {
    currency_code?: string | null,
    rate?: number | null
  }[] | null,
  line_items?: {
    id?: string | null,
    subscription_id?: string | null,
    date_from?: number | null,
    date_to?: number | null,
    unit_amount?: number | null,
    quantity?: number | null,
    amount?: number | null,
    pricing_model?: string | null,
    is_taxed?: boolean | null,
    tax_amount?: number | null,
    tax_rate?: number | null,
    unit_amount_in_decimal?: string | null,
    quantity_in_decimal?: string | null,
    amount_in_decimal?: string | null,
    discount_amount?: number | null,
    item_level_discount_amount?: number | null,
    metered?: boolean | null,
    is_percentage_pricing?: boolean | null,
    reference_line_item_id?: string | null,
    description?: string | null,
    entity_description?: string | null,
    entity_type?: string | null,
    tax_exempt_reason?: string | null,
    entity_id?: string | null,
    customer_id?: string | null,
    proration_mode?: string | null
  }[] | null,
  line_item_tiers?: {
    line_item_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    quantity_used?: number | null,
    unit_amount?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    quantity_used_in_decimal?: string | null,
    unit_amount_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null
  }[] | null,
  line_item_discounts?: {
    line_item_id?: string | null,
    discount_type?: string | null,
    coupon_id?: string | null,
    entity_id?: string | null,
    discount_amount?: number | null
  }[] | null,
  line_item_taxes?: {
    line_item_id?: string | null,
    tax_name?: string | null,
    tax_rate?: number | null,
    date_to?: number | null,
    date_from?: number | null,
    prorated_taxable_amount?: number | null,
    is_partial_tax_applied?: boolean | null,
    is_non_compliance_tax?: boolean | null,
    taxable_amount?: number | null,
    tax_amount?: number | null,
    tax_juris_type?: string | null,
    tax_juris_name?: string | null,
    tax_juris_code?: string | null,
    tax_amount_in_local_currency?: number | null,
    local_currency_code?: string | null
  }[] | null,
  line_item_credits?: {
    cn_id?: string | null,
    applied_amount?: number | null,
    line_item_id?: string | null
  }[] | null,
  line_item_addresses?: {
    line_item_id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  }[] | null,
  discounts?: {
    amount?: number | null,
    description?: string | null,
    line_item_id?: string | null,
    entity_type?: string | null,
    discount_type?: string | null,
    entity_id?: string | null,
    coupon_set_code?: string | null
  }[] | null,
  taxes?: {
    name?: string | null,
    amount?: number | null,
    description?: string | null
  }[] | null,
  tax_origin?: {
    country?: string | null,
    registration_number?: string | null
  } | null,
  linked_taxes_withheld?: {
    id?: string | null,
    amount?: number | null,
    description?: string | null,
    date?: number | null,
    reference_number?: string | null
  }[] | null,
  linked_payments?: {
    txn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null
  }[] | null,
  reference_transactions?: {
    applied_amount?: number | null,
    applied_at?: number | null,
    txn_id?: string | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null,
    txn_type?: string | null,
    amount_capturable?: number | null,
    authorization_reason?: string | null
  }[] | null,
  dunning_attempts?: {
    attempt?: number | null,
    transaction_id?: string | null,
    dunning_type?: string | null,
    created_at?: number | null,
    txn_status?: string | null,
    txn_amount?: number | null,
    retry_engine?: string | null
  }[] | null,
  applied_credits?: {
    cn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_status?: string | null,
    tax_application?: string | null
  }[] | null,
  adjustment_credit_notes?: {
    cn_id?: string | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_total?: number | null,
    cn_status?: string | null
  }[] | null,
  issued_credit_notes?: {
    cn_id?: string | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_total?: number | null,
    cn_status?: string | null
  }[] | null,
  linked_orders?: {
    id?: string | null,
    document_number?: string | null,
    status?: string | null,
    order_type?: string | null,
    reference_id?: string | null,
    fulfillment_status?: string | null,
    batch_id?: string | null,
    created_at?: number | null
  }[] | null,
  notes?: {
    note?: string | null,
    entity_id?: string | null,
    entity_type?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  statement_descriptor?: {
    id?: string | null,
    descriptor?: string | null
  } | null,
  einvoice?: {
    id?: string | null,
    reference_id?: string | null,
    reference_number?: string | null,
    status?: string | null,
    message?: string | null,
    provider_references?: any[] | null
  } | null,
  site_details_at_creation?: {
    timezone?: string | null,
    organization_address?: {
    } | null
  } | null
} | null
```

> [accordion] unbilled\_charges full type
>
> ```ts theme={null}
> {
>   id?: string | null,
>   customer_id?: string | null,
>   subscription_id?: string | null,
>   date_from?: number | null,
>   date_to?: number | null,
>   unit_amount?: number | null,
>   pricing_model?: string | null,
>   quantity?: number | null,
>   amount?: number | null,
>   currency_code?: string | null,
>   discount_amount?: number | null,
>   description?: string | null,
>   entity_type?: string | null,
>   entity_id?: string | null,
>   is_voided?: boolean | null,
>   voided_at?: number | null,
>   unit_amount_in_decimal?: string | null,
>   quantity_in_decimal?: string | null,
>   amount_in_decimal?: string | null,
>   created_at?: number | null,
>   updated_at?: number | null,
>   is_advance_charge?: boolean | null,
>   business_entity_id?: string | null,
>   deleted?: boolean | null,
>   tiers?: {
>     starting_unit?: number | null,
>     ending_unit?: number | null,
>     quantity_used?: number | null,
>     unit_amount?: number | null,
>     starting_unit_in_decimal?: string | null,
>     ending_unit_in_decimal?: string | null,
>     quantity_used_in_decimal?: string | null,
>     unit_amount_in_decimal?: string | null,
>     pricing_type?: string | null,
>     package_size?: number | null
>   }[] | null
> }[] | null
> ```

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  subscription_id?: string | null,
  reference_invoice_id?: string | null,
  type?: string | null,
  reason_code?: string | null,
  status?: string | null,
  vat_number?: string | null,
  date?: number | null,
  price_type?: string | null,
  currency_code?: string | null,
  total?: number | null,
  amount_allocated?: number | null,
  amount_refunded?: number | null,
  amount_available?: number | null,
  refunded_at?: number | null,
  voided_at?: number | null,
  generated_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  channel?: string | null,
  line_items_next_offset?: string | null,
  sub_total?: number | null,
  sub_total_in_local_currency?: number | null,
  total_in_local_currency?: number | null,
  local_currency_code?: string | null,
  round_off_amount?: number | null,
  fractional_correction?: number | null,
  notes?: string[] | null,
  deleted?: boolean | null,
  tax_category?: string | null,
  local_currency_exchange_rate?: number | null,
  create_reason_code?: string | null,
  vat_number_prefix?: string | null,
  business_entity_id?: string | null,
  brand_id?: string | null,
  line_items?: {
    id?: string | null,
    subscription_id?: string | null,
    date_from?: number | null,
    date_to?: number | null,
    unit_amount?: number | null,
    quantity?: number | null,
    amount?: number | null,
    pricing_model?: string | null,
    is_taxed?: boolean | null,
    tax_amount?: number | null,
    tax_rate?: number | null,
    unit_amount_in_decimal?: string | null,
    quantity_in_decimal?: string | null,
    amount_in_decimal?: string | null,
    discount_amount?: number | null,
    item_level_discount_amount?: number | null,
    metered?: boolean | null,
    is_percentage_pricing?: boolean | null,
    reference_line_item_id?: string | null,
    description?: string | null,
    entity_description?: string | null,
    entity_type?: string | null,
    tax_exempt_reason?: string | null,
    entity_id?: string | null,
    customer_id?: string | null,
    proration_mode?: string | null
  }[] | null,
  line_item_tiers?: {
    line_item_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    quantity_used?: number | null,
    unit_amount?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    quantity_used_in_decimal?: string | null,
    unit_amount_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null
  }[] | null,
  line_item_discounts?: {
    line_item_id?: string | null,
    discount_type?: string | null,
    coupon_id?: string | null,
    entity_id?: string | null,
    discount_amount?: number | null
  }[] | null,
  line_item_taxes?: {
    line_item_id?: string | null,
    tax_name?: string | null,
    tax_rate?: number | null,
    date_to?: number | null,
    date_from?: number | null,
    prorated_taxable_amount?: number | null,
    is_partial_tax_applied?: boolean | null,
    is_non_compliance_tax?: boolean | null,
    taxable_amount?: number | null,
    tax_amount?: number | null,
    tax_juris_type?: string | null,
    tax_juris_name?: string | null,
    tax_juris_code?: string | null,
    tax_amount_in_local_currency?: number | null,
    local_currency_code?: string | null
  }[] | null,
  line_item_addresses?: {
    line_item_id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  }[] | null,
  discounts?: {
    amount?: number | null,
    description?: string | null,
    line_item_id?: string | null,
    entity_type?: string | null,
    discount_type?: string | null,
    entity_id?: string | null,
    coupon_set_code?: string | null
  }[] | null,
  taxes?: {
    name?: string | null,
    amount?: number | null,
    description?: string | null
  }[] | null,
  tax_origin?: {
    country?: string | null,
    registration_number?: string | null
  } | null,
  linked_refunds?: {
    txn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null,
    refund_reason_code?: string | null
  }[] | null,
  linked_tax_withheld_refunds?: {
    id?: string | null,
    amount?: number | null,
    description?: string | null,
    date?: number | null,
    reference_number?: string | null
  }[] | null,
  allocations?: {
    invoice_id?: string | null,
    allocated_amount?: number | null,
    allocated_at?: number | null,
    invoice_date?: number | null,
    invoice_status?: string | null,
    tax_application?: string | null
  }[] | null,
  exchange_rates?: {
    currency_code?: string | null,
    rate?: number | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  einvoice?: {
    id?: string | null,
    reference_id?: string | null,
    reference_number?: string | null,
    status?: string | null,
    message?: string | null,
    provider_references?: any[] | null
  } | null,
  site_details_at_creation?: {
    timezone?: string | null,
    organization_address?: {
    } | null
  } | null
}[] | null
```

***

### cancelForItems

`subscriptions.cancelForItems`

Cancel a subscription. Cancels the specified subscription. ### Prerequisites & Constraints \* The subscription status must not be cancelled or transferred. \* If the subscription has a contract term, specify contract\_term\_cancel\_option instead of cancel\_option.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.subscriptions.cancelForItems({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `cancel_option` | `immediately \| end_of_term \| specific_date \| end_of_billing_term` | No | ##### If the subscription does not have a contract term: Determines when to cancel the subscription. ##### If the subscription has a contract term: This parameter is not applicable. \* end\_of\_billing\_term - This is used to cancel a subscription either at the end of the advance term, if it's billed for future renewals or at the end of its current billing cycle \* end\_of\_term - This is used to cancel a subscription at the end of the current billing cycle \* immediately - This is used to cancel the subscription with immediate effect \* specific\_date - This is used to cancel a subscription on a specified date. The change occurs as of the date/time defined in `cancel_at` |
| `end_of_term` | `boolean` | No | **(Deprecated)** Use `cancel_option` instead. Applicable only when the subscription does not have [contract terms](https://docs.corsair.dev/docs/api/contract_terms). Set this to `true` if you want to cancel the subscription at the end of the current subscription billing cycle. The subscription `status` changes to `non_renewing`. |
| `cancel_at` | `number` | No | ##### If the subscription does not have a contract term: Specifies the date and time when the subscription should be canceled. Do not use this parameter when `end_of_term` is set to `true`. ##### If the subscription has a contract term: Applicable only when `contract_term_cancel_option` is `specific_date`. Specifies the date and time to cancel the subscription and contract term. ##### Backdating You can set a past date to backdate the cancellation. Backdating is allowed only if the following conditions are met: \* [Backdating](https://www.chargebee.com/docs/2.0/backdating.html) is enabled for subscription cancellation. \* The current date does not exceed the [backdating limit configured in Chargebee Billing](https://www.chargebee.com/docs/2.0/backdating.html#configuring-backdated-subscription-actions-and-invoicing). \* The date is on or after the `current_term_start`. \* The date is on or after the most recent change involving: \* Addition/change/removal of plan or addon item prices. \* Addition of charge item prices. \* The date is not more than one billing period into the past. For example, if the plan's billing period is two months and today is April 14, `cancel_at` cannot be earlier than February 14. |
| `credit_option_for_current_term_charges` | `none \| prorate \| full \| consumption_based` | No | ##### If the subscription does not have a contract term: Specifies how to handle credits for current term charges when canceling immediately (i.e., `cancel_option` is `immediately`). If not specified, the [site-level setting](https://www.chargebee.com/docs/2.0/cancellations.html#configure-subscription-cancellation) is used. ##### If the subscription has a contract term: Specifies how to handle credits for current term charges when `contract_term_cancel_option` is `terminate_immediately`. If not specified, the [site-level setting](https://www.chargebee.com/docs/2.0/contract-terms.html#configuring-contract-terms) is used. \* none - No credits notes are created. \* full - Credits are issues for the full value of the current term charges. \* prorate - Prorated credits are issued. |
| `unbilled_charges_option` | `invoice \| delete` | No | ##### If the subscription does not have a contract term: Specifies how to handle unbilled charges when canceling immediately (i.e., `cancel_option` is `immediately`). If not specified, the [site-level setting](https://www.chargebee.com/docs/2.0/cancellations.html#configure-subscription-cancellation) is used. ##### If the subscription has a contract term: Specifies how to handle unbilled charges when `contract_term_cancel_option` is `terminate_immediately`. If not specified, the [site-level setting](https://www.chargebee.com/docs/2.0/contract-terms.html#configuring-contract-terms) is used. \* invoice - An invoice is generated immediately with the unbilled charges. \* delete - The unbilled charges are deleted. |
| `account_receivables_handling` | `no_action \| schedule_payment_collection \| write_off` | No | ##### If the subscription does not have a contract term: Specifies how to handle past due invoices when canceling immediately (i.e., `cancel_option` is `immediately`). If not specified, the [site-level setting](https://www.chargebee.com/docs/2.0/cancellations.html#configure-subscription-cancellation) is used. ##### If the subscription has a contract term: Specifies how to handle past due invoices when `contract_term_cancel_option` is `terminate_immediately`. If not specified, the [site-level setting](https://www.chargebee.com/docs/2.0/contract-terms.html#configuring-contract-terms) is used. \* no\_action - No action is taken. \* write\_off - Applies excess payments and refundable credits to past due invoices. Any remaining balance is written off. *Note: The credit note for the write-off is not included in the API response.* \* schedule\_payment\_collection - Applies excess payments and refundable credits to past due invoices. If any amount remains and `auto_collection` is `on` , the remaining amount is automatically charged to the available payment method. |
| `refundable_credits_handling` | `no_action \| schedule_refund` | No | ##### If the subscription does not have a contract term: Specifies how to handle refundable credits when canceling immediately (i.e., `cancel_option` is `immediately`). If not specified, the [site-level setting](https://www.chargebee.com/docs/2.0/cancellations.html#configure-subscription-cancellation) is used. ##### If the subscription has a contract term: Specifies how to handle refundable credits when `contract_term_cancel_option` is `terminate_immediately`. If not specified, the [site-level setting](https://www.chargebee.com/docs/2.0/contract-terms.html#configuring-contract-terms) is used. \* schedule\_refund - Refunds remaining credits after applying them to any past due invoices. \* no\_action - No action is taken. |
| `contract_term_cancel_option` | `terminate_immediately \| end_of_contract_term \| specific_date \| end_of_subscription_billing_term` | No | Required when the subscription has a contract term. Determines when to cancel the subscription along with the contract term. \* terminate\_immediately - Cancels the subscription and contract term immediately. Sets the contract term's `status` to `terminated` and collects any termination fee, if applicable. To specify the termination fee, include a single object in the `subscription_items` array. If not specified, the [default termination fee](https://docs.corsair.dev/docs/api/contract_terms) is applied (if configured). \* end\_of\_contract\_term - Prevents the contract term from renewing and schedules the subscription for cancellation at the end of the contract term. \* specific\_date - Cancels the subscription and contract term on the date specified by `cancel_at`. Sets `action_at_term_end` to `cancel`. **Note** : Contact [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 option for your [Chargebee site](https://www.chargebee.com/docs/2.0/sites-intro.html). \* end\_of\_subscription\_billing\_term - Cancels the subscription and contract term at the end of the current billing cycle. Sets `action_at_term_end` to `cancel`. **Note** : Contact [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 option for your [Chargebee site](https://www.chargebee.com/docs/2.0/sites-intro.html). |
| `invoice_date` | `number` | No | 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 `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 `cancel_at`. . |
| `include_cancellation_day_in_billing` | `boolean` | No | Determines whether the cancellation day is included in the billing period when prorated credits are issued for the current term charges. Set to `true` to bill the customer for the cancellation day (the term ends on the cancellation date), or `false` to exclude it (the term ends the day before). If not specified, the [site-level setting](https://www.chargebee.com/docs/2.0/cancellations.html#configure-subscription-cancellation) is used. This parameter is applicable only for sites using Day-Based Billing, when: \* the subscription is `active` or `non_renewing`, \* the subscription is canceled immediately, on a backdated date, or on a specific date within the current term, and \* `credit_option_for_current_term_charges` is set to `prorate`. **Note**: Passing this parameter in any other scenario results in a validation error. |
| `cancel_reason_code` | `string` | No | Reason code for canceling the subscription. Must be one from a list of reason codes set in the Chargebee app in **Settings \\> Configure Chargebee \\> Reason Codes \\> Subscriptions \\> Subscription Cancellation**. Must be passed if set as mandatory in the app. The codes are case-sensitive. |
| `decommissioned` | `boolean` | No | Indicates whether the subscription should be decommissioned when it is canceled. If set to `true` all subscription operations will be disabled except deletion. **Note** : Decommission operation is irreversible. Once set to `true` it cannot be updated to `false` and thus subscription will remain decommissioned permanently. |
| `subscription_items` | `object` | No | Parameters for subscription\_items |

> [accordion] subscription\_items full type
>
> ```ts theme={null}
> {
>   item_price_id?: string[],
>   quantity?: number[],
>   quantity_in_decimal?: string[],
>   unit_price?: number[],
>   unit_price_in_decimal?: string[],
>   service_period_days?: number[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `subscription` | `object \| null` | No | A Chargebee subscription connects a customer record to products/services. It describes what the customer has signed up for and how often they're charged for it. The essential components of a subscription are: \* A [plan-item price](https://docs.corsair.dev/docs/api/item_prices). \* Any addon- and charge-item prices applied to the subscription. \* Any [coupons](https://docs.corsair.dev/docs/api/coupons) applied. \* Any [discounts](https://docs.corsair.dev/docs/api/discounts) applied. The charges in a subscription are billed via invoices. **Note:** The maximum number of subscriptions for any given [customer](https://docs.corsair.dev/docs/api/customers) ([active](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#status) or not) is 900. #### Subscription billing frequencies Chargebee offers two billing frequency options for subscriptions: \* **Plan-based billing** (`default`): Subscriptions are billed based on the billing period defined for the item price of the `item_type` `plan`. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/subscriptions#plan-based-billing). \* **Multi-frequency billing** : Subscriptions are billed according to the billing period of each recurring item price within the subscription. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing). **Important** [Limitations](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing#limitations) of Multi-frequency billing. The selection of the billing frequency preference is configured at the site level. #### Item price compatibility in a subscription When creating or updating a subscription, one of the item prices specified under subscription\_items must be a plan-item price. The remaining must be compatible addon- or charge-item prices. An item price is compatible with a plan-item price if their currencies are the same. Additionally, an addon-item price is compatible with a plan-item price only if their billing frequencies meet the following conditions: \| `period_unit` for plan-item price \| Compatible `period_unit` for addon-item price \| Compatible period for addon-item price \| \|-----------------------------------\|-----------------------------------------------\|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `day` \| `day` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `10`, then the period of the addon-item price can be `10`, `5`, `2`, or `1`. \| \| `week` \| `week` or `day` \| The `period` (in days) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the period of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `week`, `period` can be `2` or `1`. \* for `period_unit` as `day`, `period` can be `14`, `7`, `2`, or `1`. \| \| `month` \| `month` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `6`, then the `period` of the addon-item price can be `6`, `3`, `2`, or `1`. \| \| `year` \| `year` or `month` \| The `period` (in months) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the `period` of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `year`, `period` can be `2` or `1`. \* for `period_unit` as `month`, `period` can be `24`, `12`, `8`, `6`, `4`, `3`, `2`, or `1`. \| #### Tax provider fields **Avalara** : Merchants using **Avalara Sales Tax** can optionally associate each item price with a locationCode (from their Avalara company locations), so tax can be resolved correctly at the line item level. \| Field ID \| Field Value \| APIs \| \|--------------------------------------------------------------------------------\|----------------------------------------------------------------------\|--------------------------------------------------------------------------------\| \| `locationCode` \| Merchant to configure it on Avalara Platform under company locations \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| **Anrok**: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation \| Field ID \| Field Value \| APIs \| \|---------------------------------------------------------------------------------------------------------------------------------------\|---------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------\| \| `additionalTaxRegistrationNumber` \| Canadian tax registration numbers in comma separated fashion. \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| **Vertex**: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration **Note:** Field Id like `customerCode` , `customerClass` , and`taxExempted` belong to the customer object. Field Id like `productCode` , `productClass` , `productTaxCode` , and `productClass` belong to the product object. \| Field ID \| Field Value \| APIs \| \|-----------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productCode` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `customerCode` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `customerClass` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **Taxamo:** Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration \| Field Id \| Field Value \| APIs \| \|------------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productTaxCode` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `taxExempted` \| Merchant to configure it on Taxamo Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **cbtaxes**: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India. \| Field ID \| Field Value \| APIs \| \|---------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `indiaSez` \| `SEZ_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaSez` \| `SEZ_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **All**: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level \| Field ID \| Field Value \| APIs \| \|-------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `priceType` \| `TAX_INCLUSIVE` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| \| `TAX_EXCLUSIVE` \| \| \| \| `SITE_DEFAULT` or blank \| Removes price type override, and allows site level configuration to be used for tax calculation. \| #### Ramps API compatibility mode If you want to schedule changes on a subscription, use the [Ramps API](https://docs.corsair.dev/docs/api/ramps). If you are currently scheduling changes through the [Update subscription API](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items), migrate to the Ramps API. To get started, [request access for Subscription Ramps](https://app.chargebee.com/login?forward=https://app.chargebee.com/request_access/subscription-ramps\&ref=feature). Chargebee will enable Ramps compatibility mode for your site. Once enabled, you can test the Ramps API without impacting your existing integrations. The following parts of the Billing API have subtle differences in behavior when the Ramps feature is disabled versus when it is enabled with compatibility mode. (Follow the links to learn more.) \* The value of the [`subscription.has_scheduled_changes`](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#has_scheduled_changes) attribute. \* [Update subscription](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#impact-scheduled-changes) \* [Create Checkout for updating a subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription#impact-scheduled-changes) \* [Remove scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/remove-scheduled-changes) \* [Retrieve with scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/retrieve-with-scheduled-changes) \* [Create a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/create-a-quote-for-update-subscription-items) \* [Edit a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/edit-update-subscription-quote-for-items) \* [Portal sessions](https://docs.corsair.dev/docs/api/portal_sessions#scheduled-subscription-changes) |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |
| `unbilled_charges` | `object[] \| null` | No | Resource object representing unbilled\_charge |
| `credit_notes` | `object[] \| null` | No | Resource object representing credit\_note |

```ts theme={null}
{
  id?: string | null,
  currency_code?: string | null,
  billing_period?: number | null,
  billing_period_unit?: string | null,
  start_date?: number | null,
  trial_end?: number | null,
  remaining_billing_cycles?: number | null,
  po_number?: string | null,
  auto_collection?: string | null,
  plan_quantity_in_decimal?: string | null,
  plan_unit_price_in_decimal?: string | null,
  customer_id?: string | null,
  status?: string | null,
  trial_start?: number | null,
  trial_end_action?: string | null,
  current_term_start?: number | null,
  current_term_end?: number | null,
  next_billing_at?: number | null,
  created_at?: number | null,
  started_at?: number | null,
  activated_at?: number | null,
  contract_term_billing_cycle_on_renewal?: number | null,
  override_relationship?: boolean | null,
  pause_date?: number | null,
  resume_date?: number | null,
  cancelled_at?: number | null,
  cancel_reason?: string | null,
  created_from_ip?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  has_scheduled_advance_invoices?: boolean | null,
  has_scheduled_changes?: boolean | null,
  payment_source_id?: string | null,
  plan_free_quantity_in_decimal?: string | null,
  plan_amount_in_decimal?: string | null,
  cancel_schedule_created_at?: number | null,
  offline_payment_method?: string | null,
  channel?: string | null,
  net_term_days?: number | null,
  active_id?: string | null,
  due_invoices_count?: number | null,
  due_since?: number | null,
  total_dues?: number | null,
  mrr?: number | null,
  exchange_rate?: number | null,
  base_currency_code?: string | null,
  invoice_notes?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  changes_scheduled_at?: number | null,
  cancel_reason_code?: string | null,
  free_period?: number | null,
  free_period_unit?: string | null,
  create_pending_invoices?: boolean | null,
  auto_close_invoices?: boolean | null,
  business_entity_id?: string | null,
  decommissioned?: boolean | null,
  brand_id?: string | null,
  subscription_items?: {
    item_price_id?: string | null,
    item_type?: string | null,
    quantity?: number | null,
    quantity_in_decimal?: string | null,
    unit_price?: number | null,
    unit_price_in_decimal?: string | null,
    amount?: number | null,
    current_term_start?: number | null,
    current_term_end?: number | null,
    next_billing_at?: number | null,
    amount_in_decimal?: string | null,
    billing_period?: number | null,
    billing_period_unit?: string | null,
    free_quantity?: number | null,
    free_quantity_in_decimal?: string | null,
    trial_end?: number | null,
    billing_cycles?: number | null,
    service_period_days?: number | null,
    charge_on_event?: string | null,
    charge_once?: boolean | null,
    charge_on_option?: string | null,
    proration_type?: string | null,
    usage_accumulation_reset_frequency?: string | null,
    description?: string | null
  }[] | null,
  item_tiers?: {
    item_price_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    price?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    price_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null,
    index?: number | null
  }[] | null,
  charged_items?: {
    item_price_id?: string | null,
    last_charged_at?: number | null
  }[] | null,
  coupons?: {
    coupon_id?: string | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_code?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_info?: {
    referral_code?: string | null,
    coupon_code?: string | null,
    referrer_id?: string | null,
    external_reference_id?: string | null,
    reward_status?: string | null,
    referral_system?: string | null,
    account_id?: string | null,
    campaign_id?: string | null,
    external_campaign_id?: string | null,
    friend_offer_type?: string | null,
    referrer_reward_type?: string | null,
    notify_referral_system?: string | null,
    destination_url?: string | null,
    post_purchase_widget_enabled?: boolean | null
  } | null,
  billing_override?: {
    max_excess_payment_usage?: number | null,
    max_refundable_credits_usage?: number | null
  } | null,
  contract_term?: {
    id?: string | null,
    status?: string | null,
    contract_start?: number | null,
    contract_end?: number | null,
    billing_cycle?: number | null,
    action_at_term_end?: string | null,
    total_contract_value?: number | null,
    total_contract_value_before_tax?: number | null,
    cancellation_cutoff_period?: number | null,
    created_at?: number | null,
    subscription_id?: string | null,
    remaining_billing_cycles?: number | null
  } | null,
  discounts?: {
    id?: string | null,
    invoice_name?: string | null,
    description?: string | null,
    type?: string | null,
    percentage?: number | null,
    amount?: number | null,
    quantity?: number | null,
    currency_code?: string | null,
    duration_type?: string | null,
    period?: number | null,
    period_unit?: string | null,
    included_in_mrr?: boolean | null,
    apply_on?: string | null,
    item_price_id?: string | null,
    created_at?: number | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_id?: string | null,
    index?: number | null
  }[] | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  email?: string | null,
  phone?: string | null,
  company?: string | null,
  vat_number?: string | null,
  auto_collection?: string | null,
  offline_payment_method?: string | null,
  net_term_days?: number | null,
  vat_number_validated_time?: number | null,
  vat_number_status?: string | null,
  allow_direct_debit?: boolean | null,
  is_location_valid?: boolean | null,
  created_at?: number | null,
  created_from_ip?: string | null,
  exemption_details?: any[] | null,
  taxability?: string | null,
  entity_code?: string | null,
  exempt_number?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  locale?: string | null,
  billing_date?: number | null,
  billing_month?: number | null,
  billing_date_mode?: string | null,
  billing_day_of_week?: string | null,
  billing_day_of_week_mode?: string | null,
  pii_cleared?: string | null,
  auto_close_invoices?: boolean | null,
  channel?: string | null,
  active_id?: string | null,
  fraud_flag?: string | null,
  primary_payment_source_id?: string | null,
  backup_payment_source_id?: string | null,
  invoice_notes?: string | null,
  business_entity_id?: string | null,
  preferred_currency_code?: string | null,
  promotional_credits?: number | null,
  unbilled_charges?: number | null,
  refundable_credits?: number | null,
  excess_payments?: number | null,
  is_einvoice_enabled?: boolean | null,
  einvoicing_method?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  registered_for_gst?: boolean | null,
  consolidated_invoicing?: boolean | null,
  customer_type?: string | null,
  business_customer_without_vat_number?: boolean | null,
  client_profile_id?: string | null,
  use_default_hierarchy_settings?: boolean | null,
  vat_number_prefix?: string | null,
  entity_identifier_scheme?: string | null,
  entity_identifier_standard?: string | null,
  brand_id?: string | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_urls?: {
    external_customer_id?: string | null,
    referral_sharing_url?: string | null,
    created_at?: number | null,
    updated_at?: number | null,
    referral_campaign_id?: string | null,
    referral_account_id?: string | null,
    referral_external_campaign_id?: string | null,
    referral_system?: string | null
  }[] | null,
  contacts?: {
    id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    phone?: string | null,
    label?: string | null,
    enabled?: boolean | null,
    send_account_email?: boolean | null,
    send_billing_email?: boolean | null
  }[] | null,
  payment_method?: {
    type?: string | null,
    gateway?: string | null,
    gateway_account_id?: string | null,
    status?: string | null,
    reference_id?: string | null
  } | null,
  balances?: {
    promotional_credits?: number | null,
    excess_payments?: number | null,
    refundable_credits?: number | null,
    unbilled_charges?: number | null,
    currency_code?: string | null,
    business_entity_id?: string | null
  }[] | null,
  entity_identifiers?: {
    id?: string | null,
    value?: string | null,
    scheme?: string | null,
    standard?: string | null
  }[] | null,
  tax_providers_fields?: {
    provider_name?: string | null,
    field_id?: string | null,
    field_value?: string | null
  }[] | null,
  relationship?: {
    parent_id?: string | null,
    payment_owner_id?: string | null,
    invoice_owner_id?: string | null
  } | null,
  parent_account_access?: {
    portal_edit_child_subscriptions?: string | null,
    portal_download_child_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null,
  child_account_access?: {
    portal_edit_subscriptions?: string | null,
    portal_download_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null
} | null
```

```ts theme={null}
{
  payment_source_id?: string | null,
  status?: string | null,
  gateway?: string | null,
  gateway_account_id?: string | null,
  ref_tx_id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  iin?: string | null,
  last4?: string | null,
  card_type?: string | null,
  funding_type?: string | null,
  expiry_month?: number | null,
  expiry_year?: number | null,
  issuing_country?: string | null,
  billing_addr1?: string | null,
  billing_addr2?: string | null,
  billing_city?: string | null,
  billing_state_code?: string | null,
  billing_state?: string | null,
  billing_country?: string | null,
  billing_zip?: string | null,
  created_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  ip_address?: string | null,
  powered_by?: string | null,
  customer_id?: string | null,
  masked_number?: string | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  payment_owner?: string | null,
  subscription_id?: string | null,
  recurring?: boolean | null,
  status?: string | null,
  date?: number | null,
  due_date?: number | null,
  net_term_days?: number | null,
  po_number?: string | null,
  vat_number?: string | null,
  price_type?: string | null,
  exchange_rate?: number | null,
  local_currency_exchange_rate?: number | null,
  currency_code?: string | null,
  local_currency_code?: string | null,
  tax?: number | null,
  sub_total?: number | null,
  sub_total_in_local_currency?: number | null,
  total?: number | null,
  total_in_local_currency?: number | null,
  amount_due?: number | null,
  amount_adjusted?: number | null,
  amount_paid?: number | null,
  paid_at?: number | null,
  write_off_amount?: number | null,
  credits_applied?: number | null,
  dunning_status?: string | null,
  next_retry_at?: number | null,
  voided_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  line_items_next_offset?: string | null,
  first_invoice?: boolean | null,
  new_sales_amount?: number | null,
  has_advance_charges?: boolean | null,
  offline_payment_method?: string | null,
  term_finalized?: boolean | null,
  is_gifted?: boolean | null,
  generated_at?: number | null,
  expected_payment_date?: number | null,
  amount_to_collect?: number | null,
  round_off_amount?: number | null,
  retry_segment_id?: string | null,
  void_reason_code?: string | null,
  deleted?: boolean | null,
  tax_category?: string | null,
  vat_number_prefix?: string | null,
  channel?: string | null,
  business_entity_id?: string | null,
  brand_id?: string | null,
  exchange_rates?: {
    currency_code?: string | null,
    rate?: number | null
  }[] | null,
  line_items?: {
    id?: string | null,
    subscription_id?: string | null,
    date_from?: number | null,
    date_to?: number | null,
    unit_amount?: number | null,
    quantity?: number | null,
    amount?: number | null,
    pricing_model?: string | null,
    is_taxed?: boolean | null,
    tax_amount?: number | null,
    tax_rate?: number | null,
    unit_amount_in_decimal?: string | null,
    quantity_in_decimal?: string | null,
    amount_in_decimal?: string | null,
    discount_amount?: number | null,
    item_level_discount_amount?: number | null,
    metered?: boolean | null,
    is_percentage_pricing?: boolean | null,
    reference_line_item_id?: string | null,
    description?: string | null,
    entity_description?: string | null,
    entity_type?: string | null,
    tax_exempt_reason?: string | null,
    entity_id?: string | null,
    customer_id?: string | null,
    proration_mode?: string | null
  }[] | null,
  line_item_tiers?: {
    line_item_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    quantity_used?: number | null,
    unit_amount?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    quantity_used_in_decimal?: string | null,
    unit_amount_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null
  }[] | null,
  line_item_discounts?: {
    line_item_id?: string | null,
    discount_type?: string | null,
    coupon_id?: string | null,
    entity_id?: string | null,
    discount_amount?: number | null
  }[] | null,
  line_item_taxes?: {
    line_item_id?: string | null,
    tax_name?: string | null,
    tax_rate?: number | null,
    date_to?: number | null,
    date_from?: number | null,
    prorated_taxable_amount?: number | null,
    is_partial_tax_applied?: boolean | null,
    is_non_compliance_tax?: boolean | null,
    taxable_amount?: number | null,
    tax_amount?: number | null,
    tax_juris_type?: string | null,
    tax_juris_name?: string | null,
    tax_juris_code?: string | null,
    tax_amount_in_local_currency?: number | null,
    local_currency_code?: string | null
  }[] | null,
  line_item_credits?: {
    cn_id?: string | null,
    applied_amount?: number | null,
    line_item_id?: string | null
  }[] | null,
  line_item_addresses?: {
    line_item_id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  }[] | null,
  discounts?: {
    amount?: number | null,
    description?: string | null,
    line_item_id?: string | null,
    entity_type?: string | null,
    discount_type?: string | null,
    entity_id?: string | null,
    coupon_set_code?: string | null
  }[] | null,
  taxes?: {
    name?: string | null,
    amount?: number | null,
    description?: string | null
  }[] | null,
  tax_origin?: {
    country?: string | null,
    registration_number?: string | null
  } | null,
  linked_taxes_withheld?: {
    id?: string | null,
    amount?: number | null,
    description?: string | null,
    date?: number | null,
    reference_number?: string | null
  }[] | null,
  linked_payments?: {
    txn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null
  }[] | null,
  reference_transactions?: {
    applied_amount?: number | null,
    applied_at?: number | null,
    txn_id?: string | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null,
    txn_type?: string | null,
    amount_capturable?: number | null,
    authorization_reason?: string | null
  }[] | null,
  dunning_attempts?: {
    attempt?: number | null,
    transaction_id?: string | null,
    dunning_type?: string | null,
    created_at?: number | null,
    txn_status?: string | null,
    txn_amount?: number | null,
    retry_engine?: string | null
  }[] | null,
  applied_credits?: {
    cn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_status?: string | null,
    tax_application?: string | null
  }[] | null,
  adjustment_credit_notes?: {
    cn_id?: string | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_total?: number | null,
    cn_status?: string | null
  }[] | null,
  issued_credit_notes?: {
    cn_id?: string | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_total?: number | null,
    cn_status?: string | null
  }[] | null,
  linked_orders?: {
    id?: string | null,
    document_number?: string | null,
    status?: string | null,
    order_type?: string | null,
    reference_id?: string | null,
    fulfillment_status?: string | null,
    batch_id?: string | null,
    created_at?: number | null
  }[] | null,
  notes?: {
    note?: string | null,
    entity_id?: string | null,
    entity_type?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  statement_descriptor?: {
    id?: string | null,
    descriptor?: string | null
  } | null,
  einvoice?: {
    id?: string | null,
    reference_id?: string | null,
    reference_number?: string | null,
    status?: string | null,
    message?: string | null,
    provider_references?: any[] | null
  } | null,
  site_details_at_creation?: {
    timezone?: string | null,
    organization_address?: {
    } | null
  } | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  subscription_id?: string | null,
  date_from?: number | null,
  date_to?: number | null,
  unit_amount?: number | null,
  pricing_model?: string | null,
  quantity?: number | null,
  amount?: number | null,
  currency_code?: string | null,
  discount_amount?: number | null,
  description?: string | null,
  entity_type?: string | null,
  entity_id?: string | null,
  is_voided?: boolean | null,
  voided_at?: number | null,
  unit_amount_in_decimal?: string | null,
  quantity_in_decimal?: string | null,
  amount_in_decimal?: string | null,
  created_at?: number | null,
  updated_at?: number | null,
  is_advance_charge?: boolean | null,
  business_entity_id?: string | null,
  deleted?: boolean | null,
  tiers?: {
    starting_unit?: number | null,
    ending_unit?: number | null,
    quantity_used?: number | null,
    unit_amount?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    quantity_used_in_decimal?: string | null,
    unit_amount_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null
  }[] | null
}[] | null
```

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  subscription_id?: string | null,
  reference_invoice_id?: string | null,
  type?: string | null,
  reason_code?: string | null,
  status?: string | null,
  vat_number?: string | null,
  date?: number | null,
  price_type?: string | null,
  currency_code?: string | null,
  total?: number | null,
  amount_allocated?: number | null,
  amount_refunded?: number | null,
  amount_available?: number | null,
  refunded_at?: number | null,
  voided_at?: number | null,
  generated_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  channel?: string | null,
  line_items_next_offset?: string | null,
  sub_total?: number | null,
  sub_total_in_local_currency?: number | null,
  total_in_local_currency?: number | null,
  local_currency_code?: string | null,
  round_off_amount?: number | null,
  fractional_correction?: number | null,
  notes?: string[] | null,
  deleted?: boolean | null,
  tax_category?: string | null,
  local_currency_exchange_rate?: number | null,
  create_reason_code?: string | null,
  vat_number_prefix?: string | null,
  business_entity_id?: string | null,
  brand_id?: string | null,
  line_items?: {
    id?: string | null,
    subscription_id?: string | null,
    date_from?: number | null,
    date_to?: number | null,
    unit_amount?: number | null,
    quantity?: number | null,
    amount?: number | null,
    pricing_model?: string | null,
    is_taxed?: boolean | null,
    tax_amount?: number | null,
    tax_rate?: number | null,
    unit_amount_in_decimal?: string | null,
    quantity_in_decimal?: string | null,
    amount_in_decimal?: string | null,
    discount_amount?: number | null,
    item_level_discount_amount?: number | null,
    metered?: boolean | null,
    is_percentage_pricing?: boolean | null,
    reference_line_item_id?: string | null,
    description?: string | null,
    entity_description?: string | null,
    entity_type?: string | null,
    tax_exempt_reason?: string | null,
    entity_id?: string | null,
    customer_id?: string | null,
    proration_mode?: string | null
  }[] | null,
  line_item_tiers?: {
    line_item_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    quantity_used?: number | null,
    unit_amount?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    quantity_used_in_decimal?: string | null,
    unit_amount_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null
  }[] | null,
  line_item_discounts?: {
    line_item_id?: string | null,
    discount_type?: string | null,
    coupon_id?: string | null,
    entity_id?: string | null,
    discount_amount?: number | null
  }[] | null,
  line_item_taxes?: {
    line_item_id?: string | null,
    tax_name?: string | null,
    tax_rate?: number | null,
    date_to?: number | null,
    date_from?: number | null,
    prorated_taxable_amount?: number | null,
    is_partial_tax_applied?: boolean | null,
    is_non_compliance_tax?: boolean | null,
    taxable_amount?: number | null,
    tax_amount?: number | null,
    tax_juris_type?: string | null,
    tax_juris_name?: string | null,
    tax_juris_code?: string | null,
    tax_amount_in_local_currency?: number | null,
    local_currency_code?: string | null
  }[] | null,
  line_item_addresses?: {
    line_item_id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  }[] | null,
  discounts?: {
    amount?: number | null,
    description?: string | null,
    line_item_id?: string | null,
    entity_type?: string | null,
    discount_type?: string | null,
    entity_id?: string | null,
    coupon_set_code?: string | null
  }[] | null,
  taxes?: {
    name?: string | null,
    amount?: number | null,
    description?: string | null
  }[] | null,
  tax_origin?: {
    country?: string | null,
    registration_number?: string | null
  } | null,
  linked_refunds?: {
    txn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null,
    refund_reason_code?: string | null
  }[] | null,
  linked_tax_withheld_refunds?: {
    id?: string | null,
    amount?: number | null,
    description?: string | null,
    date?: number | null,
    reference_number?: string | null
  }[] | null,
  allocations?: {
    invoice_id?: string | null,
    allocated_amount?: number | null,
    allocated_at?: number | null,
    invoice_date?: number | null,
    invoice_status?: string | null,
    tax_application?: string | null
  }[] | null,
  exchange_rates?: {
    currency_code?: string | null,
    rate?: number | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  einvoice?: {
    id?: string | null,
    reference_id?: string | null,
    reference_number?: string | null,
    status?: string | null,
    message?: string | null,
    provider_references?: any[] | null
  } | null,
  site_details_at_creation?: {
    timezone?: string | null,
    organization_address?: {
    } | null
  } | null
}[] | null
```

***

### cancelSubscriptionEstimate

`subscriptions.cancelSubscriptionEstimate`

Cancel subscription estimate. Generates an estimate for the 'cancel subscription' operation. This is similar to the Cancel a subscription API, but the subscription will not be cancelled. Only an estimate for this operation is created. In the response, \* estimate.subscription\_estimate has the subscription details. Product Catalog 1.0 sites only.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.subscriptions.cancelSubscriptionEstimate({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `subscriptionId` | `string` | Yes | — |
| `cancel_option` | `immediately \| end_of_term \| specific_date \| end_of_billing_term` | No | ##### If the subscription does not have a contract term: Determines when to cancel the subscription. ##### If the subscription has a contract term: This parameter is not applicable. \* end\_of\_billing\_term - This is used to cancel a subscription either at the end of the advance term, if it's billed for future renewals or at the end of its current billing cycle \* end\_of\_term - This is used to cancel a subscription at the end of the current billing cycle \* immediately - This is used to cancel the subscription with immediate effect \* specific\_date - This is used to cancel a subscription on a specified date. The change occurs as of the date/time defined in `cancel_at` |
| `end_of_term` | `boolean` | No | **(Deprecated)** Use `cancel_option` instead. Applicable only when the subscription does not have [contract terms](https://docs.corsair.dev/docs/api/contract_terms). Set this to `true` if you want to cancel the subscription at the end of the current subscription billing cycle. The subscription `status` changes to `non_renewing`. |
| `cancel_at` | `number` | No | ##### If the subscription does not have a contract term: Specifies the date and time when the subscription should be canceled. Do not use this parameter when `end_of_term` is set to `true`. ##### If the subscription has a contract term: Applicable only when `contract_term_cancel_option` is `specific_date`. Specifies the date and time to cancel the subscription and contract term. ##### Backdating You can set a past date to backdate the cancellation. Backdating is allowed only if the following conditions are met: \* [Backdating](https://www.chargebee.com/docs/1.0/backdating.html) is enabled for subscription cancellation. \* The current date does not exceed the [backdating limit configured in Chargebee Billing](https://www.chargebee.com/docs/1.0/backdating.html#configuring-backdated-subscription-actions-and-invoicing). \* The date is on or after the `current_term_start`. \* The date is on or after the most recent change involving: \* Addition/change/removal of plan or addon item prices. \* Addition of charge item prices. \* The date is not more than one billing period into the past. For example, if the plan's billing period is two months and today is April 14, `cancel_at` cannot be earlier than February 14. |
| `credit_option_for_current_term_charges` | `none \| prorate \| full \| consumption_based` | No | ##### If the subscription does not have a contract term: Specifies how to handle credits for current term charges when canceling immediately (i.e., `cancel_option` is `immediately`). If not specified, the [site-level setting](https://www.chargebee.com/docs/1.0/cancellations.html#configure-subscription-cancellation) is used. ##### If the subscription has a contract term: Specifies how to handle credits for current term charges when `contract_term_cancel_option` is `terminate_immediately`. If not specified, the [site-level setting](https://www.chargebee.com/docs/1.0/contract-terms.html#configuring-contract-terms) is used. \* none - No credits notes are created. \* full - Credits are issues for the full value of the current term charges. \* prorate - Prorated credits are issued. |
| `unbilled_charges_option` | `invoice \| delete` | No | ##### If the subscription does not have a contract term: Specifies how to handle unbilled charges when canceling immediately (i.e., `cancel_option` is `immediately`). If not specified, the [site-level setting](https://www.chargebee.com/docs/1.0/cancellations.html#configure-subscription-cancellation) is used. ##### If the subscription has a contract term: Specifies how to handle unbilled charges when `contract_term_cancel_option` is `terminate_immediately`. If not specified, the [site-level setting](https://www.chargebee.com/docs/1.0/contract-terms.html#configuring-contract-terms) is used. \* invoice - An invoice is generated immediately with the unbilled charges. \* delete - The unbilled charges are deleted. |
| `account_receivables_handling` | `no_action \| schedule_payment_collection \| write_off` | No | ##### If the subscription does not have a contract term: Specifies how to handle past due invoices when canceling immediately (i.e., `cancel_option` is `immediately`). If not specified, the [site-level setting](https://www.chargebee.com/docs/1.0/cancellations.html#configure-subscription-cancellation) is used. ##### If the subscription has a contract term: Specifies how to handle past due invoices when `contract_term_cancel_option` is `terminate_immediately`. If not specified, the [site-level setting](https://www.chargebee.com/docs/1.0/contract-terms.html#configuring-contract-terms) is used. \* no\_action - No action is taken. \* write\_off - Applies excess payments and refundable credits to past due invoices. Any remaining balance is written off. *Note: The credit note for the write-off is not included in the API response.* \* schedule\_payment\_collection - Applies excess payments and refundable credits to past due invoices. If any amount remains and `auto_collection` is `on` , the remaining amount is automatically charged to the available payment method. |
| `refundable_credits_handling` | `no_action \| schedule_refund` | No | ##### If the subscription does not have a contract term: Specifies how to handle refundable credits when canceling immediately (i.e., `cancel_option` is `immediately`). If not specified, the [site-level setting](https://www.chargebee.com/docs/1.0/cancellations.html#configure-subscription-cancellation) is used. ##### If the subscription has a contract term: Specifies how to handle refundable credits when `contract_term_cancel_option` is `terminate_immediately`. If not specified, the [site-level setting](https://www.chargebee.com/docs/1.0/contract-terms.html#configuring-contract-terms) is used. \* schedule\_refund - Refunds remaining credits after applying them to any past due invoices. \* no\_action - No action is taken. |
| `contract_term_cancel_option` | `terminate_immediately \| end_of_contract_term \| specific_date \| end_of_subscription_billing_term` | No | Required when the subscription has a contract term. Determines when to cancel the subscription along with the contract term. \* terminate\_immediately - Cancels the subscription and contract term immediately. Sets the contract term's `status` to `terminated` and collects any termination fee, if applicable. To specify the termination fee, include a single object in the `subscription_items` array. If not specified, the [default termination fee](https://docs.corsair.dev/docs/api/contract_terms) is applied (if configured). \* end\_of\_contract\_term - Prevents the contract term from renewing and schedules the subscription for cancellation at the end of the contract term. \* specific\_date - Cancels the subscription and contract term on the date specified by `cancel_at`. Sets `action_at_term_end` to `cancel`. **Note** : Contact [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 option for your [Chargebee site](https://www.chargebee.com/docs/1.0/sites-intro.html). \* end\_of\_subscription\_billing\_term - Cancels the subscription and contract term at the end of the current billing cycle. Sets `action_at_term_end` to `cancel`. **Note** : Contact [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 option for your [Chargebee site](https://www.chargebee.com/docs/1.0/sites-intro.html). |
| `invoice_date` | `number` | No | 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 `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 `cancel_at`. . |
| `cancel_reason_code` | `string` | No | Reason code for canceling the subscription. Must be one from a list of reason codes set in the Chargebee app in **Settings \\> Configure Chargebee \\> Reason Codes \\> Subscriptions \\> Subscription Cancellation**. Must be passed if set as mandatory in the app. The codes are case-sensitive. |
| `event_based_addons` | `object` | No | Parameters for event\_based\_addons |

> [accordion] event\_based\_addons full type
>
> ```ts theme={null}
> {
>   id?: string[],
>   quantity?: number[],
>   unit_price?: number[],
>   service_period_in_days?: number[]
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `estimate` | `object \| null` | No | During the process of signing up customers to subscriptions, use the Estimates API to evaluate the details of the purchase before actually signing them up. The details returned by the API include the invoice amounts, next billing date and unbilled charges. For example, consider that you are creating a new subscription or update an existing one. Use the Estimates API before that to deduce the details such as the amount the customer would be charged, the state the subscription would be in after creation or updation, and so on. If you have configured the [Avalara integration](https://www.chargebee.com/docs/1.0/avalara.html), Chargebee retrieves the tax amount from Avalara for the invoice. This counts against your Avalara API limits. |

```ts theme={null}
{
  created_at?: number | null,
  subscription_estimate?: {
    id?: string | null,
    currency_code?: string | null,
    status?: string | null,
    trial_end_action?: string | null,
    next_billing_at?: number | null,
    pause_date?: number | null,
    resume_date?: number | null,
    shipping_address?: {
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    } | null,
    contract_term?: {
      id?: string | null,
      status?: string | null,
      contract_start?: number | null,
      contract_end?: number | null,
      billing_cycle?: number | null,
      action_at_term_end?: string | null,
      total_contract_value?: number | null,
      total_contract_value_before_tax?: number | null,
      cancellation_cutoff_period?: number | null,
      created_at?: number | null,
      subscription_id?: string | null,
      remaining_billing_cycles?: number | null
    } | null
  } | null,
  subscription_estimates?: {
    id?: string | null,
    currency_code?: string | null,
    status?: string | null,
    trial_end_action?: string | null,
    next_billing_at?: number | null,
    pause_date?: number | null,
    resume_date?: number | null,
    shipping_address?: {
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    } | null,
    contract_term?: {
      id?: string | null,
      status?: string | null,
      contract_start?: number | null,
      contract_end?: number | null,
      billing_cycle?: number | null,
      action_at_term_end?: string | null,
      total_contract_value?: number | null,
      total_contract_value_before_tax?: number | null,
      cancellation_cutoff_period?: number | null,
      created_at?: number | null,
      subscription_id?: string | null,
      remaining_billing_cycles?: number | null
    } | null
  }[] | null,
  invoice_estimate?: {
    recurring?: boolean | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    credits_applied?: number | null,
    amount_paid?: number | null,
    amount_due?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    line_item_credits?: {
      cn_id?: string | null,
      applied_amount?: number | null,
      line_item_id?: string | null
    }[] | null,
    line_item_addresses?: {
      line_item_id?: string | null,
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  } | null,
  invoice_estimates?: {
    recurring?: boolean | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    credits_applied?: number | null,
    amount_paid?: number | null,
    amount_due?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    line_item_credits?: {
      cn_id?: string | null,
      applied_amount?: number | null,
      line_item_id?: string | null
    }[] | null,
    line_item_addresses?: {
      line_item_id?: string | null,
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  }[] | null,
  payment_schedule_estimates?: {
    id?: string | null,
    scheme_id?: string | null,
    entity_type?: string | null,
    entity_id?: string | null,
    amount?: number | null,
    currency_code?: string | null,
    schedule_entries?: {
      id?: string | null,
      date?: number | null,
      amount?: number | null,
      scheduled_amount?: number | null,
      status?: string | null
    }[] | null
  }[] | null,
  next_invoice_estimate?: {
    recurring?: boolean | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    credits_applied?: number | null,
    amount_paid?: number | null,
    amount_due?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    line_item_credits?: {
      cn_id?: string | null,
      applied_amount?: number | null,
      line_item_id?: string | null
    }[] | null,
    line_item_addresses?: {
      line_item_id?: string | null,
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  } | null,
  credit_note_estimates?: {
    reference_invoice_id?: string | null,
    type?: string | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    amount_allocated?: number | null,
    amount_available?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  }[] | null,
  unbilled_charge_estimates?: {
    id?: string | null,
    customer_id?: string | null,
    subscription_id?: string | null,
    date_from?: number | null,
    date_to?: number | null,
    unit_amount?: number | null,
    pricing_model?: string | null,
    quantity?: number | null,
    amount?: number | null,
    currency_code?: string | null,
    discount_amount?: number | null,
    description?: string | null,
    entity_type?: string | null,
    entity_id?: string | null,
    is_voided?: boolean | null,
    voided_at?: number | null,
    unit_amount_in_decimal?: string | null,
    quantity_in_decimal?: string | null,
    amount_in_decimal?: string | null,
    created_at?: number | null,
    updated_at?: number | null,
    tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    is_advance_charge?: boolean | null,
    business_entity_id?: string | null,
    deleted?: boolean | null
  }[] | null
} | null
```

***

### cancelSubscriptionForItemsEstimate

`subscriptions.cancelSubscriptionForItemsEstimate`

Cancel subscription for items estimate. Creates an estimate for canceling the specified subscription.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.subscriptions.cancelSubscriptionForItemsEstimate({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `cancel_option` | `immediately \| end_of_term \| specific_date \| end_of_billing_term` | No | ##### If the subscription does not have a contract term: Determines when to cancel the subscription. ##### If the subscription has a contract term: This parameter is not applicable. \* end\_of\_billing\_term - This is used to cancel a subscription either at the end of the advance term, if it's billed for future renewals or at the end of its current billing cycle \* end\_of\_term - This is used to cancel a subscription at the end of the current billing cycle \* immediately - This is used to cancel the subscription with immediate effect \* specific\_date - This is used to cancel a subscription on a specified date. The change occurs as of the date/time defined in `cancel_at` |
| `end_of_term` | `boolean` | No | **(Deprecated)** Use `cancel_option` instead. Applicable only when the subscription does not have [contract terms](https://docs.corsair.dev/docs/api/contract_terms). Set this to `true` if you want to cancel the subscription at the end of the current subscription billing cycle. The subscription `status` changes to `non_renewing`. |
| `cancel_at` | `number` | No | ##### If the subscription does not have a contract term: Specifies the date and time when the subscription should be canceled. Do not use this parameter when `end_of_term` is set to `true`. ##### If the subscription has a contract term: Applicable only when `contract_term_cancel_option` is `specific_date`. Specifies the date and time to cancel the subscription and contract term. ##### Backdating You can set a past date to backdate the cancellation. Backdating is allowed only if the following conditions are met: \* [Backdating](https://www.chargebee.com/docs/2.0/backdating.html) is enabled for subscription cancellation. \* The current date does not exceed the [backdating limit configured in Chargebee Billing](https://www.chargebee.com/docs/2.0/backdating.html#configuring-backdated-subscription-actions-and-invoicing). \* The date is on or after the `current_term_start`. \* The date is on or after the most recent change involving: \* Addition/change/removal of plan or addon item prices. \* Addition of charge item prices. \* The date is not more than one billing period into the past. For example, if the plan's billing period is two months and today is April 14, `cancel_at` cannot be earlier than February 14. |
| `credit_option_for_current_term_charges` | `none \| prorate \| full \| consumption_based` | No | ##### If the subscription does not have a contract term: Specifies how to handle credits for current term charges when canceling immediately (i.e., `cancel_option` is `immediately`). If not specified, the [site-level setting](https://www.chargebee.com/docs/2.0/cancellations.html#configure-subscription-cancellation) is used. ##### If the subscription has a contract term: Specifies how to handle credits for current term charges when `contract_term_cancel_option` is `terminate_immediately`. If not specified, the [site-level setting](https://www.chargebee.com/docs/2.0/contract-terms.html#configuring-contract-terms) is used. \* none - No credits notes are created. \* full - Credits are issues for the full value of the current term charges. \* prorate - Prorated credits are issued. |
| `unbilled_charges_option` | `invoice \| delete` | No | ##### If the subscription does not have a contract term: Specifies how to handle unbilled charges when canceling immediately (i.e., `cancel_option` is `immediately`). If not specified, the [site-level setting](https://www.chargebee.com/docs/2.0/cancellations.html#configure-subscription-cancellation) is used. ##### If the subscription has a contract term: Specifies how to handle unbilled charges when `contract_term_cancel_option` is `terminate_immediately`. If not specified, the [site-level setting](https://www.chargebee.com/docs/2.0/contract-terms.html#configuring-contract-terms) is used. \* invoice - An invoice is generated immediately with the unbilled charges. \* delete - The unbilled charges are deleted. |
| `account_receivables_handling` | `no_action \| schedule_payment_collection \| write_off` | No | ##### If the subscription does not have a contract term: Specifies how to handle past due invoices when canceling immediately (i.e., `cancel_option` is `immediately`). If not specified, the [site-level setting](https://www.chargebee.com/docs/2.0/cancellations.html#configure-subscription-cancellation) is used. ##### If the subscription has a contract term: Specifies how to handle past due invoices when `contract_term_cancel_option` is `terminate_immediately`. If not specified, the [site-level setting](https://www.chargebee.com/docs/2.0/contract-terms.html#configuring-contract-terms) is used. \* no\_action - No action is taken. \* write\_off - Applies excess payments and refundable credits to past due invoices. Any remaining balance is written off. *Note: The credit note for the write-off is not included in the API response.* \* schedule\_payment\_collection - Applies excess payments and refundable credits to past due invoices. If any amount remains and `auto_collection` is `on` , the remaining amount is automatically charged to the available payment method. |
| `refundable_credits_handling` | `no_action \| schedule_refund` | No | ##### If the subscription does not have a contract term: Specifies how to handle refundable credits when canceling immediately (i.e., `cancel_option` is `immediately`). If not specified, the [site-level setting](https://www.chargebee.com/docs/2.0/cancellations.html#configure-subscription-cancellation) is used. ##### If the subscription has a contract term: Specifies how to handle refundable credits when `contract_term_cancel_option` is `terminate_immediately`. If not specified, the [site-level setting](https://www.chargebee.com/docs/2.0/contract-terms.html#configuring-contract-terms) is used. \* schedule\_refund - Refunds remaining credits after applying them to any past due invoices. \* no\_action - No action is taken. |
| `contract_term_cancel_option` | `terminate_immediately \| end_of_contract_term \| specific_date \| end_of_subscription_billing_term` | No | Required when the subscription has a contract term. Determines when to cancel the subscription along with the contract term. \* terminate\_immediately - Cancels the subscription and contract term immediately. Sets the contract term's `status` to `terminated` and collects any termination fee, if applicable. To specify the termination fee, include a single object in the `subscription_items` array. If not specified, the [default termination fee](https://docs.corsair.dev/docs/api/contract_terms) is applied (if configured). \* end\_of\_contract\_term - Prevents the contract term from renewing and schedules the subscription for cancellation at the end of the contract term. \* specific\_date - Cancels the subscription and contract term on the date specified by `cancel_at`. Sets `action_at_term_end` to `cancel`. **Note** : Contact [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 option for your [Chargebee site](https://www.chargebee.com/docs/2.0/sites-intro.html). \* end\_of\_subscription\_billing\_term - Cancels the subscription and contract term at the end of the current billing cycle. Sets `action_at_term_end` to `cancel`. **Note** : Contact [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 option for your [Chargebee site](https://www.chargebee.com/docs/2.0/sites-intro.html). |
| `invoice_date` | `number` | No | 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 `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 `cancel_at`. . |
| `include_cancellation_day_in_billing` | `boolean` | No | Determines whether the cancellation day is included in the billing period when prorated credits are issued for the current term charges. Set to `true` to bill the customer for the cancellation day (the term ends on the cancellation date), or `false` to exclude it (the term ends the day before). If not specified, the [site-level setting](https://www.chargebee.com/docs/2.0/cancellations.html#configure-subscription-cancellation) is used. This parameter is applicable only for sites using Day-Based Billing, when: \* the subscription is `active` or `non_renewing`, \* the subscription is canceled immediately, on a backdated date, or on a specific date within the current term, and \* `credit_option_for_current_term_charges` is set to `prorate`. **Note**: Passing this parameter in any other scenario results in a validation error. |
| `cancel_reason_code` | `string` | No | Reason code for canceling the subscription. Must be one from a list of reason codes set in the Chargebee app in **Settings \\> Configure Chargebee \\> Reason Codes \\> Subscriptions \\> Subscription Cancellation**. Must be passed if set as mandatory in the app. The codes are case-sensitive. |
| `subscription_items` | `object` | No | Parameters for subscription\_items |

```ts theme={null}
{
  item_price_id?: string[],
  quantity?: number[],
  quantity_in_decimal?: string[],
  unit_price?: number[],
  unit_price_in_decimal?: string[],
  service_period_days?: number[]
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `estimate` | `object \| null` | No | During the process of signing up customers to subscriptions, use the Estimates API to evaluate the details of the purchase before actually signing them up. The details returned by the API include the invoice amounts, next billing date and unbilled charges. For example, consider that you are creating a new subscription or update an existing one. Use the Estimates API before that to deduce the details such as the amount the customer would be charged, the state the subscription would be in after creation or updation, and so on. If you have configured the [Avalara integration](https://www.chargebee.com/docs/2.0/avalara.html), Chargebee retrieves the tax amount from Avalara for the invoice. This counts against your Avalara API limits. |

```ts theme={null}
{
  created_at?: number | null,
  subscription_estimate?: {
    id?: string | null,
    currency_code?: string | null,
    status?: string | null,
    trial_end_action?: string | null,
    next_billing_at?: number | null,
    pause_date?: number | null,
    resume_date?: number | null,
    shipping_address?: {
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    } | null,
    contract_term?: {
      id?: string | null,
      status?: string | null,
      contract_start?: number | null,
      contract_end?: number | null,
      billing_cycle?: number | null,
      action_at_term_end?: string | null,
      total_contract_value?: number | null,
      total_contract_value_before_tax?: number | null,
      cancellation_cutoff_period?: number | null,
      created_at?: number | null,
      subscription_id?: string | null,
      remaining_billing_cycles?: number | null
    } | null
  } | null,
  subscription_estimates?: {
    id?: string | null,
    currency_code?: string | null,
    status?: string | null,
    trial_end_action?: string | null,
    next_billing_at?: number | null,
    pause_date?: number | null,
    resume_date?: number | null,
    shipping_address?: {
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    } | null,
    contract_term?: {
      id?: string | null,
      status?: string | null,
      contract_start?: number | null,
      contract_end?: number | null,
      billing_cycle?: number | null,
      action_at_term_end?: string | null,
      total_contract_value?: number | null,
      total_contract_value_before_tax?: number | null,
      cancellation_cutoff_period?: number | null,
      created_at?: number | null,
      subscription_id?: string | null,
      remaining_billing_cycles?: number | null
    } | null
  }[] | null,
  invoice_estimate?: {
    recurring?: boolean | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    credits_applied?: number | null,
    amount_paid?: number | null,
    amount_due?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    line_item_credits?: {
      cn_id?: string | null,
      applied_amount?: number | null,
      line_item_id?: string | null
    }[] | null,
    line_item_addresses?: {
      line_item_id?: string | null,
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  } | null,
  invoice_estimates?: {
    recurring?: boolean | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    credits_applied?: number | null,
    amount_paid?: number | null,
    amount_due?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    line_item_credits?: {
      cn_id?: string | null,
      applied_amount?: number | null,
      line_item_id?: string | null
    }[] | null,
    line_item_addresses?: {
      line_item_id?: string | null,
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  }[] | null,
  payment_schedule_estimates?: {
    id?: string | null,
    scheme_id?: string | null,
    entity_type?: string | null,
    entity_id?: string | null,
    amount?: number | null,
    currency_code?: string | null,
    schedule_entries?: {
      id?: string | null,
      date?: number | null,
      amount?: number | null,
      scheduled_amount?: number | null,
      status?: string | null
    }[] | null
  }[] | null,
  next_invoice_estimate?: {
    recurring?: boolean | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    credits_applied?: number | null,
    amount_paid?: number | null,
    amount_due?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    line_item_credits?: {
      cn_id?: string | null,
      applied_amount?: number | null,
      line_item_id?: string | null
    }[] | null,
    line_item_addresses?: {
      line_item_id?: string | null,
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  } | null,
  credit_note_estimates?: {
    reference_invoice_id?: string | null,
    type?: string | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    amount_allocated?: number | null,
    amount_available?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  }[] | null,
  unbilled_charge_estimates?: {
    id?: string | null,
    customer_id?: string | null,
    subscription_id?: string | null,
    date_from?: number | null,
    date_to?: number | null,
    unit_amount?: number | null,
    pricing_model?: string | null,
    quantity?: number | null,
    amount?: number | null,
    currency_code?: string | null,
    discount_amount?: number | null,
    description?: string | null,
    entity_type?: string | null,
    entity_id?: string | null,
    is_voided?: boolean | null,
    voided_at?: number | null,
    unit_amount_in_decimal?: string | null,
    quantity_in_decimal?: string | null,
    amount_in_decimal?: string | null,
    created_at?: number | null,
    updated_at?: number | null,
    tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    is_advance_charge?: boolean | null,
    business_entity_id?: string | null,
    deleted?: boolean | null
  }[] | null
} | null
```

***

### changeTermEnd

`subscriptions.changeTermEnd`

Change term end. Use this endpoint to adjust when a subscription's current term or trial ends without altering the plan or billing frequency. It is helpful when you need to align renewals to a specific calendar date or extend a trial.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.subscriptions.changeTermEnd({ subscriptionId: 'sub_8gsnbYfsMLds', term_ends_at: 1 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `term_ends_at` | `number` | Yes | The time at which the current term should end for this subscription. The value must be a date in the future, i.e. later than current time. The value must not be the same as [next\_billing\_at](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#next_billing_at) . |
| `prorate` | `boolean` | No | Applicable for *active* / *non\_renewing* subscriptions. If specified as *true* prorated charges / credits will be added during this operation. |
| `invoice_immediately` | `boolean` | No | 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. . |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `subscription` | `object \| null` | No | A Chargebee subscription connects a customer record to products/services. It describes what the customer has signed up for and how often they're charged for it. The essential components of a subscription are: \* A [plan-item price](https://docs.corsair.dev/docs/api/item_prices). \* Any addon- and charge-item prices applied to the subscription. \* Any [coupons](https://docs.corsair.dev/docs/api/coupons) applied. \* Any [discounts](https://docs.corsair.dev/docs/api/discounts) applied. The charges in a subscription are billed via invoices. **Note:** The maximum number of subscriptions for any given [customer](https://docs.corsair.dev/docs/api/customers) ([active](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#status) or not) is 900. #### Subscription billing frequencies Chargebee offers two billing frequency options for subscriptions: \* **Plan-based billing** (`default`): Subscriptions are billed based on the billing period defined for the item price of the `item_type` `plan`. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/subscriptions#plan-based-billing). \* **Multi-frequency billing** : Subscriptions are billed according to the billing period of each recurring item price within the subscription. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing). **Important** [Limitations](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing#limitations) of Multi-frequency billing. The selection of the billing frequency preference is configured at the site level. #### Item price compatibility in a subscription When creating or updating a subscription, one of the item prices specified under subscription\_items must be a plan-item price. The remaining must be compatible addon- or charge-item prices. An item price is compatible with a plan-item price if their currencies are the same. Additionally, an addon-item price is compatible with a plan-item price only if their billing frequencies meet the following conditions: \| `period_unit` for plan-item price \| Compatible `period_unit` for addon-item price \| Compatible period for addon-item price \| \|-----------------------------------\|-----------------------------------------------\|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `day` \| `day` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `10`, then the period of the addon-item price can be `10`, `5`, `2`, or `1`. \| \| `week` \| `week` or `day` \| The `period` (in days) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the period of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `week`, `period` can be `2` or `1`. \* for `period_unit` as `day`, `period` can be `14`, `7`, `2`, or `1`. \| \| `month` \| `month` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `6`, then the `period` of the addon-item price can be `6`, `3`, `2`, or `1`. \| \| `year` \| `year` or `month` \| The `period` (in months) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the `period` of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `year`, `period` can be `2` or `1`. \* for `period_unit` as `month`, `period` can be `24`, `12`, `8`, `6`, `4`, `3`, `2`, or `1`. \| #### Tax provider fields **Avalara** : Merchants using **Avalara Sales Tax** can optionally associate each item price with a locationCode (from their Avalara company locations), so tax can be resolved correctly at the line item level. \| Field ID \| Field Value \| APIs \| \|--------------------------------------------------------------------------------\|----------------------------------------------------------------------\|--------------------------------------------------------------------------------\| \| `locationCode` \| Merchant to configure it on Avalara Platform under company locations \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| **Anrok**: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation \| Field ID \| Field Value \| APIs \| \|---------------------------------------------------------------------------------------------------------------------------------------\|---------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------\| \| `additionalTaxRegistrationNumber` \| Canadian tax registration numbers in comma separated fashion. \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| **Vertex**: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration **Note:** Field Id like `customerCode` , `customerClass` , and`taxExempted` belong to the customer object. Field Id like `productCode` , `productClass` , `productTaxCode` , and `productClass` belong to the product object. \| Field ID \| Field Value \| APIs \| \|-----------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productCode` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `customerCode` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `customerClass` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **Taxamo:** Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration \| Field Id \| Field Value \| APIs \| \|------------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productTaxCode` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `taxExempted` \| Merchant to configure it on Taxamo Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **cbtaxes**: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India. \| Field ID \| Field Value \| APIs \| \|---------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `indiaSez` \| `SEZ_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaSez` \| `SEZ_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **All**: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level \| Field ID \| Field Value \| APIs \| \|-------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `priceType` \| `TAX_INCLUSIVE` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| \| `TAX_EXCLUSIVE` \| \| \| \| `SITE_DEFAULT` or blank \| Removes price type override, and allows site level configuration to be used for tax calculation. \| #### Ramps API compatibility mode If you want to schedule changes on a subscription, use the [Ramps API](https://docs.corsair.dev/docs/api/ramps). If you are currently scheduling changes through the [Update subscription API](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items), migrate to the Ramps API. To get started, [request access for Subscription Ramps](https://app.chargebee.com/login?forward=https://app.chargebee.com/request_access/subscription-ramps\&ref=feature). Chargebee will enable Ramps compatibility mode for your site. Once enabled, you can test the Ramps API without impacting your existing integrations. The following parts of the Billing API have subtle differences in behavior when the Ramps feature is disabled versus when it is enabled with compatibility mode. (Follow the links to learn more.) \* The value of the [`subscription.has_scheduled_changes`](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#has_scheduled_changes) attribute. \* [Update subscription](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#impact-scheduled-changes) \* [Create Checkout for updating a subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription#impact-scheduled-changes) \* [Remove scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/remove-scheduled-changes) \* [Retrieve with scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/retrieve-with-scheduled-changes) \* [Create a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/create-a-quote-for-update-subscription-items) \* [Edit a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/edit-update-subscription-quote-for-items) \* [Portal sessions](https://docs.corsair.dev/docs/api/portal_sessions#scheduled-subscription-changes) |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |
| `unbilled_charges` | `object[] \| null` | No | Resource object representing unbilled\_charge |
| `credit_notes` | `object[] \| null` | No | Resource object representing credit\_note |

```ts theme={null}
{
  id?: string | null,
  currency_code?: string | null,
  billing_period?: number | null,
  billing_period_unit?: string | null,
  start_date?: number | null,
  trial_end?: number | null,
  remaining_billing_cycles?: number | null,
  po_number?: string | null,
  auto_collection?: string | null,
  plan_quantity_in_decimal?: string | null,
  plan_unit_price_in_decimal?: string | null,
  customer_id?: string | null,
  status?: string | null,
  trial_start?: number | null,
  trial_end_action?: string | null,
  current_term_start?: number | null,
  current_term_end?: number | null,
  next_billing_at?: number | null,
  created_at?: number | null,
  started_at?: number | null,
  activated_at?: number | null,
  contract_term_billing_cycle_on_renewal?: number | null,
  override_relationship?: boolean | null,
  pause_date?: number | null,
  resume_date?: number | null,
  cancelled_at?: number | null,
  cancel_reason?: string | null,
  created_from_ip?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  has_scheduled_advance_invoices?: boolean | null,
  has_scheduled_changes?: boolean | null,
  payment_source_id?: string | null,
  plan_free_quantity_in_decimal?: string | null,
  plan_amount_in_decimal?: string | null,
  cancel_schedule_created_at?: number | null,
  offline_payment_method?: string | null,
  channel?: string | null,
  net_term_days?: number | null,
  active_id?: string | null,
  due_invoices_count?: number | null,
  due_since?: number | null,
  total_dues?: number | null,
  mrr?: number | null,
  exchange_rate?: number | null,
  base_currency_code?: string | null,
  invoice_notes?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  changes_scheduled_at?: number | null,
  cancel_reason_code?: string | null,
  free_period?: number | null,
  free_period_unit?: string | null,
  create_pending_invoices?: boolean | null,
  auto_close_invoices?: boolean | null,
  business_entity_id?: string | null,
  decommissioned?: boolean | null,
  brand_id?: string | null,
  subscription_items?: {
    item_price_id?: string | null,
    item_type?: string | null,
    quantity?: number | null,
    quantity_in_decimal?: string | null,
    unit_price?: number | null,
    unit_price_in_decimal?: string | null,
    amount?: number | null,
    current_term_start?: number | null,
    current_term_end?: number | null,
    next_billing_at?: number | null,
    amount_in_decimal?: string | null,
    billing_period?: number | null,
    billing_period_unit?: string | null,
    free_quantity?: number | null,
    free_quantity_in_decimal?: string | null,
    trial_end?: number | null,
    billing_cycles?: number | null,
    service_period_days?: number | null,
    charge_on_event?: string | null,
    charge_once?: boolean | null,
    charge_on_option?: string | null,
    proration_type?: string | null,
    usage_accumulation_reset_frequency?: string | null,
    description?: string | null
  }[] | null,
  item_tiers?: {
    item_price_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    price?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    price_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null,
    index?: number | null
  }[] | null,
  charged_items?: {
    item_price_id?: string | null,
    last_charged_at?: number | null
  }[] | null,
  coupons?: {
    coupon_id?: string | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_code?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_info?: {
    referral_code?: string | null,
    coupon_code?: string | null,
    referrer_id?: string | null,
    external_reference_id?: string | null,
    reward_status?: string | null,
    referral_system?: string | null,
    account_id?: string | null,
    campaign_id?: string | null,
    external_campaign_id?: string | null,
    friend_offer_type?: string | null,
    referrer_reward_type?: string | null,
    notify_referral_system?: string | null,
    destination_url?: string | null,
    post_purchase_widget_enabled?: boolean | null
  } | null,
  billing_override?: {
    max_excess_payment_usage?: number | null,
    max_refundable_credits_usage?: number | null
  } | null,
  contract_term?: {
    id?: string | null,
    status?: string | null,
    contract_start?: number | null,
    contract_end?: number | null,
    billing_cycle?: number | null,
    action_at_term_end?: string | null,
    total_contract_value?: number | null,
    total_contract_value_before_tax?: number | null,
    cancellation_cutoff_period?: number | null,
    created_at?: number | null,
    subscription_id?: string | null,
    remaining_billing_cycles?: number | null
  } | null,
  discounts?: {
    id?: string | null,
    invoice_name?: string | null,
    description?: string | null,
    type?: string | null,
    percentage?: number | null,
    amount?: number | null,
    quantity?: number | null,
    currency_code?: string | null,
    duration_type?: string | null,
    period?: number | null,
    period_unit?: string | null,
    included_in_mrr?: boolean | null,
    apply_on?: string | null,
    item_price_id?: string | null,
    created_at?: number | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_id?: string | null,
    index?: number | null
  }[] | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  email?: string | null,
  phone?: string | null,
  company?: string | null,
  vat_number?: string | null,
  auto_collection?: string | null,
  offline_payment_method?: string | null,
  net_term_days?: number | null,
  vat_number_validated_time?: number | null,
  vat_number_status?: string | null,
  allow_direct_debit?: boolean | null,
  is_location_valid?: boolean | null,
  created_at?: number | null,
  created_from_ip?: string | null,
  exemption_details?: any[] | null,
  taxability?: string | null,
  entity_code?: string | null,
  exempt_number?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  locale?: string | null,
  billing_date?: number | null,
  billing_month?: number | null,
  billing_date_mode?: string | null,
  billing_day_of_week?: string | null,
  billing_day_of_week_mode?: string | null,
  pii_cleared?: string | null,
  auto_close_invoices?: boolean | null,
  channel?: string | null,
  active_id?: string | null,
  fraud_flag?: string | null,
  primary_payment_source_id?: string | null,
  backup_payment_source_id?: string | null,
  invoice_notes?: string | null,
  business_entity_id?: string | null,
  preferred_currency_code?: string | null,
  promotional_credits?: number | null,
  unbilled_charges?: number | null,
  refundable_credits?: number | null,
  excess_payments?: number | null,
  is_einvoice_enabled?: boolean | null,
  einvoicing_method?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  registered_for_gst?: boolean | null,
  consolidated_invoicing?: boolean | null,
  customer_type?: string | null,
  business_customer_without_vat_number?: boolean | null,
  client_profile_id?: string | null,
  use_default_hierarchy_settings?: boolean | null,
  vat_number_prefix?: string | null,
  entity_identifier_scheme?: string | null,
  entity_identifier_standard?: string | null,
  brand_id?: string | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_urls?: {
    external_customer_id?: string | null,
    referral_sharing_url?: string | null,
    created_at?: number | null,
    updated_at?: number | null,
    referral_campaign_id?: string | null,
    referral_account_id?: string | null,
    referral_external_campaign_id?: string | null,
    referral_system?: string | null
  }[] | null,
  contacts?: {
    id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    phone?: string | null,
    label?: string | null,
    enabled?: boolean | null,
    send_account_email?: boolean | null,
    send_billing_email?: boolean | null
  }[] | null,
  payment_method?: {
    type?: string | null,
    gateway?: string | null,
    gateway_account_id?: string | null,
    status?: string | null,
    reference_id?: string | null
  } | null,
  balances?: {
    promotional_credits?: number | null,
    excess_payments?: number | null,
    refundable_credits?: number | null,
    unbilled_charges?: number | null,
    currency_code?: string | null,
    business_entity_id?: string | null
  }[] | null,
  entity_identifiers?: {
    id?: string | null,
    value?: string | null,
    scheme?: string | null,
    standard?: string | null
  }[] | null,
  tax_providers_fields?: {
    provider_name?: string | null,
    field_id?: string | null,
    field_value?: string | null
  }[] | null,
  relationship?: {
    parent_id?: string | null,
    payment_owner_id?: string | null,
    invoice_owner_id?: string | null
  } | null,
  parent_account_access?: {
    portal_edit_child_subscriptions?: string | null,
    portal_download_child_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null,
  child_account_access?: {
    portal_edit_subscriptions?: string | null,
    portal_download_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null
} | null
```

```ts theme={null}
{
  payment_source_id?: string | null,
  status?: string | null,
  gateway?: string | null,
  gateway_account_id?: string | null,
  ref_tx_id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  iin?: string | null,
  last4?: string | null,
  card_type?: string | null,
  funding_type?: string | null,
  expiry_month?: number | null,
  expiry_year?: number | null,
  issuing_country?: string | null,
  billing_addr1?: string | null,
  billing_addr2?: string | null,
  billing_city?: string | null,
  billing_state_code?: string | null,
  billing_state?: string | null,
  billing_country?: string | null,
  billing_zip?: string | null,
  created_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  ip_address?: string | null,
  powered_by?: string | null,
  customer_id?: string | null,
  masked_number?: string | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  payment_owner?: string | null,
  subscription_id?: string | null,
  recurring?: boolean | null,
  status?: string | null,
  date?: number | null,
  due_date?: number | null,
  net_term_days?: number | null,
  po_number?: string | null,
  vat_number?: string | null,
  price_type?: string | null,
  exchange_rate?: number | null,
  local_currency_exchange_rate?: number | null,
  currency_code?: string | null,
  local_currency_code?: string | null,
  tax?: number | null,
  sub_total?: number | null,
  sub_total_in_local_currency?: number | null,
  total?: number | null,
  total_in_local_currency?: number | null,
  amount_due?: number | null,
  amount_adjusted?: number | null,
  amount_paid?: number | null,
  paid_at?: number | null,
  write_off_amount?: number | null,
  credits_applied?: number | null,
  dunning_status?: string | null,
  next_retry_at?: number | null,
  voided_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  line_items_next_offset?: string | null,
  first_invoice?: boolean | null,
  new_sales_amount?: number | null,
  has_advance_charges?: boolean | null,
  offline_payment_method?: string | null,
  term_finalized?: boolean | null,
  is_gifted?: boolean | null,
  generated_at?: number | null,
  expected_payment_date?: number | null,
  amount_to_collect?: number | null,
  round_off_amount?: number | null,
  retry_segment_id?: string | null,
  void_reason_code?: string | null,
  deleted?: boolean | null,
  tax_category?: string | null,
  vat_number_prefix?: string | null,
  channel?: string | null,
  business_entity_id?: string | null,
  brand_id?: string | null,
  exchange_rates?: {
    currency_code?: string | null,
    rate?: number | null
  }[] | null,
  line_items?: {
    id?: string | null,
    subscription_id?: string | null,
    date_from?: number | null,
    date_to?: number | null,
    unit_amount?: number | null,
    quantity?: number | null,
    amount?: number | null,
    pricing_model?: string | null,
    is_taxed?: boolean | null,
    tax_amount?: number | null,
    tax_rate?: number | null,
    unit_amount_in_decimal?: string | null,
    quantity_in_decimal?: string | null,
    amount_in_decimal?: string | null,
    discount_amount?: number | null,
    item_level_discount_amount?: number | null,
    metered?: boolean | null,
    is_percentage_pricing?: boolean | null,
    reference_line_item_id?: string | null,
    description?: string | null,
    entity_description?: string | null,
    entity_type?: string | null,
    tax_exempt_reason?: string | null,
    entity_id?: string | null,
    customer_id?: string | null,
    proration_mode?: string | null
  }[] | null,
  line_item_tiers?: {
    line_item_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    quantity_used?: number | null,
    unit_amount?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    quantity_used_in_decimal?: string | null,
    unit_amount_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null
  }[] | null,
  line_item_discounts?: {
    line_item_id?: string | null,
    discount_type?: string | null,
    coupon_id?: string | null,
    entity_id?: string | null,
    discount_amount?: number | null
  }[] | null,
  line_item_taxes?: {
    line_item_id?: string | null,
    tax_name?: string | null,
    tax_rate?: number | null,
    date_to?: number | null,
    date_from?: number | null,
    prorated_taxable_amount?: number | null,
    is_partial_tax_applied?: boolean | null,
    is_non_compliance_tax?: boolean | null,
    taxable_amount?: number | null,
    tax_amount?: number | null,
    tax_juris_type?: string | null,
    tax_juris_name?: string | null,
    tax_juris_code?: string | null,
    tax_amount_in_local_currency?: number | null,
    local_currency_code?: string | null
  }[] | null,
  line_item_credits?: {
    cn_id?: string | null,
    applied_amount?: number | null,
    line_item_id?: string | null
  }[] | null,
  line_item_addresses?: {
    line_item_id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  }[] | null,
  discounts?: {
    amount?: number | null,
    description?: string | null,
    line_item_id?: string | null,
    entity_type?: string | null,
    discount_type?: string | null,
    entity_id?: string | null,
    coupon_set_code?: string | null
  }[] | null,
  taxes?: {
    name?: string | null,
    amount?: number | null,
    description?: string | null
  }[] | null,
  tax_origin?: {
    country?: string | null,
    registration_number?: string | null
  } | null,
  linked_taxes_withheld?: {
    id?: string | null,
    amount?: number | null,
    description?: string | null,
    date?: number | null,
    reference_number?: string | null
  }[] | null,
  linked_payments?: {
    txn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null
  }[] | null,
  reference_transactions?: {
    applied_amount?: number | null,
    applied_at?: number | null,
    txn_id?: string | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null,
    txn_type?: string | null,
    amount_capturable?: number | null,
    authorization_reason?: string | null
  }[] | null,
  dunning_attempts?: {
    attempt?: number | null,
    transaction_id?: string | null,
    dunning_type?: string | null,
    created_at?: number | null,
    txn_status?: string | null,
    txn_amount?: number | null,
    retry_engine?: string | null
  }[] | null,
  applied_credits?: {
    cn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_status?: string | null,
    tax_application?: string | null
  }[] | null,
  adjustment_credit_notes?: {
    cn_id?: string | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_total?: number | null,
    cn_status?: string | null
  }[] | null,
  issued_credit_notes?: {
    cn_id?: string | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_total?: number | null,
    cn_status?: string | null
  }[] | null,
  linked_orders?: {
    id?: string | null,
    document_number?: string | null,
    status?: string | null,
    order_type?: string | null,
    reference_id?: string | null,
    fulfillment_status?: string | null,
    batch_id?: string | null,
    created_at?: number | null
  }[] | null,
  notes?: {
    note?: string | null,
    entity_id?: string | null,
    entity_type?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  statement_descriptor?: {
    id?: string | null,
    descriptor?: string | null
  } | null,
  einvoice?: {
    id?: string | null,
    reference_id?: string | null,
    reference_number?: string | null,
    status?: string | null,
    message?: string | null,
    provider_references?: any[] | null
  } | null,
  site_details_at_creation?: {
    timezone?: string | null,
    organization_address?: {
    } | null
  } | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  subscription_id?: string | null,
  date_from?: number | null,
  date_to?: number | null,
  unit_amount?: number | null,
  pricing_model?: string | null,
  quantity?: number | null,
  amount?: number | null,
  currency_code?: string | null,
  discount_amount?: number | null,
  description?: string | null,
  entity_type?: string | null,
  entity_id?: string | null,
  is_voided?: boolean | null,
  voided_at?: number | null,
  unit_amount_in_decimal?: string | null,
  quantity_in_decimal?: string | null,
  amount_in_decimal?: string | null,
  created_at?: number | null,
  updated_at?: number | null,
  is_advance_charge?: boolean | null,
  business_entity_id?: string | null,
  deleted?: boolean | null,
  tiers?: {
    starting_unit?: number | null,
    ending_unit?: number | null,
    quantity_used?: number | null,
    unit_amount?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    quantity_used_in_decimal?: string | null,
    unit_amount_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null
  }[] | null
}[] | null
```

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  subscription_id?: string | null,
  reference_invoice_id?: string | null,
  type?: string | null,
  reason_code?: string | null,
  status?: string | null,
  vat_number?: string | null,
  date?: number | null,
  price_type?: string | null,
  currency_code?: string | null,
  total?: number | null,
  amount_allocated?: number | null,
  amount_refunded?: number | null,
  amount_available?: number | null,
  refunded_at?: number | null,
  voided_at?: number | null,
  generated_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  channel?: string | null,
  line_items_next_offset?: string | null,
  sub_total?: number | null,
  sub_total_in_local_currency?: number | null,
  total_in_local_currency?: number | null,
  local_currency_code?: string | null,
  round_off_amount?: number | null,
  fractional_correction?: number | null,
  notes?: string[] | null,
  deleted?: boolean | null,
  tax_category?: string | null,
  local_currency_exchange_rate?: number | null,
  create_reason_code?: string | null,
  vat_number_prefix?: string | null,
  business_entity_id?: string | null,
  brand_id?: string | null,
  line_items?: {
    id?: string | null,
    subscription_id?: string | null,
    date_from?: number | null,
    date_to?: number | null,
    unit_amount?: number | null,
    quantity?: number | null,
    amount?: number | null,
    pricing_model?: string | null,
    is_taxed?: boolean | null,
    tax_amount?: number | null,
    tax_rate?: number | null,
    unit_amount_in_decimal?: string | null,
    quantity_in_decimal?: string | null,
    amount_in_decimal?: string | null,
    discount_amount?: number | null,
    item_level_discount_amount?: number | null,
    metered?: boolean | null,
    is_percentage_pricing?: boolean | null,
    reference_line_item_id?: string | null,
    description?: string | null,
    entity_description?: string | null,
    entity_type?: string | null,
    tax_exempt_reason?: string | null,
    entity_id?: string | null,
    customer_id?: string | null,
    proration_mode?: string | null
  }[] | null,
  line_item_tiers?: {
    line_item_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    quantity_used?: number | null,
    unit_amount?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    quantity_used_in_decimal?: string | null,
    unit_amount_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null
  }[] | null,
  line_item_discounts?: {
    line_item_id?: string | null,
    discount_type?: string | null,
    coupon_id?: string | null,
    entity_id?: string | null,
    discount_amount?: number | null
  }[] | null,
  line_item_taxes?: {
    line_item_id?: string | null,
    tax_name?: string | null,
    tax_rate?: number | null,
    date_to?: number | null,
    date_from?: number | null,
    prorated_taxable_amount?: number | null,
    is_partial_tax_applied?: boolean | null,
    is_non_compliance_tax?: boolean | null,
    taxable_amount?: number | null,
    tax_amount?: number | null,
    tax_juris_type?: string | null,
    tax_juris_name?: string | null,
    tax_juris_code?: string | null,
    tax_amount_in_local_currency?: number | null,
    local_currency_code?: string | null
  }[] | null,
  line_item_addresses?: {
    line_item_id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  }[] | null,
  discounts?: {
    amount?: number | null,
    description?: string | null,
    line_item_id?: string | null,
    entity_type?: string | null,
    discount_type?: string | null,
    entity_id?: string | null,
    coupon_set_code?: string | null
  }[] | null,
  taxes?: {
    name?: string | null,
    amount?: number | null,
    description?: string | null
  }[] | null,
  tax_origin?: {
    country?: string | null,
    registration_number?: string | null
  } | null,
  linked_refunds?: {
    txn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null,
    refund_reason_code?: string | null
  }[] | null,
  linked_tax_withheld_refunds?: {
    id?: string | null,
    amount?: number | null,
    description?: string | null,
    date?: number | null,
    reference_number?: string | null
  }[] | null,
  allocations?: {
    invoice_id?: string | null,
    allocated_amount?: number | null,
    allocated_at?: number | null,
    invoice_date?: number | null,
    invoice_status?: string | null,
    tax_application?: string | null
  }[] | null,
  exchange_rates?: {
    currency_code?: string | null,
    rate?: number | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  einvoice?: {
    id?: string | null,
    reference_id?: string | null,
    reference_number?: string | null,
    status?: string | null,
    message?: string | null,
    provider_references?: any[] | null
  } | null,
  site_details_at_creation?: {
    timezone?: string | null,
    organization_address?: {
    } | null
  } | null
}[] | null
```

***

### changeTermEndEstimate

`subscriptions.changeTermEndEstimate`

Subscription change term end estimate. Generates an estimate for the 'change term end' operation. This is similar to the Change term end API but the subscription's term end will not be changed, only an estimate for this operation is created. This is applicable only for subscriptions in 'in-trial', 'active' and 'non-renewing' states.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.subscriptions.changeTermEndEstimate({ subscriptionId: 'sub_8gsnbYfsMLds', term_ends_at: 1 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `term_ends_at` | `number` | Yes | The time at which the current term should end for this subscription. |
| `prorate` | `boolean` | No | Applicable for *active* / *non\_renewing* subscriptions. If specified as *true* prorated charges / credits will be added during this operation. |
| `invoice_immediately` | `boolean` | No | 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. . |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `estimate` | `object \| null` | No | During the process of signing up customers to subscriptions, use the Estimates API to evaluate the details of the purchase before actually signing them up. The details returned by the API include the invoice amounts, next billing date and unbilled charges. For example, consider that you are creating a new subscription or update an existing one. Use the Estimates API before that to deduce the details such as the amount the customer would be charged, the state the subscription would be in after creation or updation, and so on. If you have configured the [Avalara integration](https://www.chargebee.com/docs/2.0/avalara.html), Chargebee retrieves the tax amount from Avalara for the invoice. This counts against your Avalara API limits. |

```ts theme={null}
{
  created_at?: number | null,
  subscription_estimate?: {
    id?: string | null,
    currency_code?: string | null,
    status?: string | null,
    trial_end_action?: string | null,
    next_billing_at?: number | null,
    pause_date?: number | null,
    resume_date?: number | null,
    shipping_address?: {
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    } | null,
    contract_term?: {
      id?: string | null,
      status?: string | null,
      contract_start?: number | null,
      contract_end?: number | null,
      billing_cycle?: number | null,
      action_at_term_end?: string | null,
      total_contract_value?: number | null,
      total_contract_value_before_tax?: number | null,
      cancellation_cutoff_period?: number | null,
      created_at?: number | null,
      subscription_id?: string | null,
      remaining_billing_cycles?: number | null
    } | null
  } | null,
  subscription_estimates?: {
    id?: string | null,
    currency_code?: string | null,
    status?: string | null,
    trial_end_action?: string | null,
    next_billing_at?: number | null,
    pause_date?: number | null,
    resume_date?: number | null,
    shipping_address?: {
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    } | null,
    contract_term?: {
      id?: string | null,
      status?: string | null,
      contract_start?: number | null,
      contract_end?: number | null,
      billing_cycle?: number | null,
      action_at_term_end?: string | null,
      total_contract_value?: number | null,
      total_contract_value_before_tax?: number | null,
      cancellation_cutoff_period?: number | null,
      created_at?: number | null,
      subscription_id?: string | null,
      remaining_billing_cycles?: number | null
    } | null
  }[] | null,
  invoice_estimate?: {
    recurring?: boolean | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    credits_applied?: number | null,
    amount_paid?: number | null,
    amount_due?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    line_item_credits?: {
      cn_id?: string | null,
      applied_amount?: number | null,
      line_item_id?: string | null
    }[] | null,
    line_item_addresses?: {
      line_item_id?: string | null,
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  } | null,
  invoice_estimates?: {
    recurring?: boolean | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    credits_applied?: number | null,
    amount_paid?: number | null,
    amount_due?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    line_item_credits?: {
      cn_id?: string | null,
      applied_amount?: number | null,
      line_item_id?: string | null
    }[] | null,
    line_item_addresses?: {
      line_item_id?: string | null,
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  }[] | null,
  payment_schedule_estimates?: {
    id?: string | null,
    scheme_id?: string | null,
    entity_type?: string | null,
    entity_id?: string | null,
    amount?: number | null,
    currency_code?: string | null,
    schedule_entries?: {
      id?: string | null,
      date?: number | null,
      amount?: number | null,
      scheduled_amount?: number | null,
      status?: string | null
    }[] | null
  }[] | null,
  next_invoice_estimate?: {
    recurring?: boolean | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    credits_applied?: number | null,
    amount_paid?: number | null,
    amount_due?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    line_item_credits?: {
      cn_id?: string | null,
      applied_amount?: number | null,
      line_item_id?: string | null
    }[] | null,
    line_item_addresses?: {
      line_item_id?: string | null,
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  } | null,
  credit_note_estimates?: {
    reference_invoice_id?: string | null,
    type?: string | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    amount_allocated?: number | null,
    amount_available?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  }[] | null,
  unbilled_charge_estimates?: {
    id?: string | null,
    customer_id?: string | null,
    subscription_id?: string | null,
    date_from?: number | null,
    date_to?: number | null,
    unit_amount?: number | null,
    pricing_model?: string | null,
    quantity?: number | null,
    amount?: number | null,
    currency_code?: string | null,
    discount_amount?: number | null,
    description?: string | null,
    entity_type?: string | null,
    entity_id?: string | null,
    is_voided?: boolean | null,
    voided_at?: number | null,
    unit_amount_in_decimal?: string | null,
    quantity_in_decimal?: string | null,
    amount_in_decimal?: string | null,
    created_at?: number | null,
    updated_at?: number | null,
    tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    is_advance_charge?: boolean | null,
    business_entity_id?: string | null,
    deleted?: boolean | null
  }[] | null
} | null
```

***

### chargeAddonAtTermEnd

`subscriptions.chargeAddonAtTermEnd`

Charge addon at term end. Adds a "non-recurring addon" charge to a subscription which will be added to the invoice generated at the end of the current term. If there are any applicable coupons in the subscription, an appropriate discount will be applied. Product Catalog 1.0 sites only.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.subscriptions.chargeAddonAtTermEnd({ subscriptionId: 'sub_8gsnbYfsMLds', addon_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `subscriptionId` | `string` | Yes | — |
| `addon_id` | `string` | Yes | The ID of the non-recurring addon to be charged. |
| `addon_quantity` | `number` | No | The number of addon units to be charged. Mandatory for quantity based addons. |
| `addon_unit_price` | `number` | No | Amount that will override the Addon's default price. The unit depends on the [type of currency](https://docs.corsair.dev/docs/api/getting-started) . |
| `addon_quantity_in_decimal` | `string` | No | The decimal representation of the quantity of the [non-recurring addon](https://www.chargebee.com/docs/charges.html#non-recurring-addon). Provide the value in major units of the currency. Must be provided when the addon is quantity-based. This parameter can only be passed when [multi-decimal pricing](https://docs.corsair.dev/docs/api/v2/pcv-1/currencies) is enabled. |
| `addon_unit_price_in_decimal` | `string` | No | When [price overriding](http://chargebee.com/docs/price-override.html) is enabled for the site, the price or per-unit price of [the non-recurring addon](https://www.chargebee.com/docs/charges.html#non-recurring-addon) can be set here. The value [set for the addon](https://docs.corsair.dev/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. This parameter can only be passed when [multi-decimal pricing](https://docs.corsair.dev/docs/api/v2/pcv-1/currencies) is enabled. |
| `date_from` | `number` | No | The time when the service period for the addon starts. |
| `date_to` | `number` | No | The time when the service period for the addon ends. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `estimate` | `object \| null` | No | During the process of signing up customers to subscriptions, use the Estimates API to evaluate the details of the purchase before actually signing them up. The details returned by the API include the invoice amounts, next billing date and unbilled charges. For example, consider that you are creating a new subscription or update an existing one. Use the Estimates API before that to deduce the details such as the amount the customer would be charged, the state the subscription would be in after creation or updation, and so on. If you have configured the [Avalara integration](https://www.chargebee.com/docs/1.0/avalara.html), Chargebee retrieves the tax amount from Avalara for the invoice. This counts against your Avalara API limits. |

```ts theme={null}
{
  created_at?: number | null,
  subscription_estimate?: {
    id?: string | null,
    currency_code?: string | null,
    status?: string | null,
    trial_end_action?: string | null,
    next_billing_at?: number | null,
    pause_date?: number | null,
    resume_date?: number | null,
    shipping_address?: {
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    } | null,
    contract_term?: {
      id?: string | null,
      status?: string | null,
      contract_start?: number | null,
      contract_end?: number | null,
      billing_cycle?: number | null,
      action_at_term_end?: string | null,
      total_contract_value?: number | null,
      total_contract_value_before_tax?: number | null,
      cancellation_cutoff_period?: number | null,
      created_at?: number | null,
      subscription_id?: string | null,
      remaining_billing_cycles?: number | null
    } | null
  } | null,
  subscription_estimates?: {
    id?: string | null,
    currency_code?: string | null,
    status?: string | null,
    trial_end_action?: string | null,
    next_billing_at?: number | null,
    pause_date?: number | null,
    resume_date?: number | null,
    shipping_address?: {
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    } | null,
    contract_term?: {
      id?: string | null,
      status?: string | null,
      contract_start?: number | null,
      contract_end?: number | null,
      billing_cycle?: number | null,
      action_at_term_end?: string | null,
      total_contract_value?: number | null,
      total_contract_value_before_tax?: number | null,
      cancellation_cutoff_period?: number | null,
      created_at?: number | null,
      subscription_id?: string | null,
      remaining_billing_cycles?: number | null
    } | null
  }[] | null,
  invoice_estimate?: {
    recurring?: boolean | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    credits_applied?: number | null,
    amount_paid?: number | null,
    amount_due?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    line_item_credits?: {
      cn_id?: string | null,
      applied_amount?: number | null,
      line_item_id?: string | null
    }[] | null,
    line_item_addresses?: {
      line_item_id?: string | null,
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  } | null,
  invoice_estimates?: {
    recurring?: boolean | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    credits_applied?: number | null,
    amount_paid?: number | null,
    amount_due?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    line_item_credits?: {
      cn_id?: string | null,
      applied_amount?: number | null,
      line_item_id?: string | null
    }[] | null,
    line_item_addresses?: {
      line_item_id?: string | null,
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  }[] | null,
  payment_schedule_estimates?: {
    id?: string | null,
    scheme_id?: string | null,
    entity_type?: string | null,
    entity_id?: string | null,
    amount?: number | null,
    currency_code?: string | null,
    schedule_entries?: {
      id?: string | null,
      date?: number | null,
      amount?: number | null,
      scheduled_amount?: number | null,
      status?: string | null
    }[] | null
  }[] | null,
  next_invoice_estimate?: {
    recurring?: boolean | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    credits_applied?: number | null,
    amount_paid?: number | null,
    amount_due?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    line_item_credits?: {
      cn_id?: string | null,
      applied_amount?: number | null,
      line_item_id?: string | null
    }[] | null,
    line_item_addresses?: {
      line_item_id?: string | null,
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  } | null,
  credit_note_estimates?: {
    reference_invoice_id?: string | null,
    type?: string | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    amount_allocated?: number | null,
    amount_available?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  }[] | null,
  unbilled_charge_estimates?: {
    id?: string | null,
    customer_id?: string | null,
    subscription_id?: string | null,
    date_from?: number | null,
    date_to?: number | null,
    unit_amount?: number | null,
    pricing_model?: string | null,
    quantity?: number | null,
    amount?: number | null,
    currency_code?: string | null,
    discount_amount?: number | null,
    description?: string | null,
    entity_type?: string | null,
    entity_id?: string | null,
    is_voided?: boolean | null,
    voided_at?: number | null,
    unit_amount_in_decimal?: string | null,
    quantity_in_decimal?: string | null,
    amount_in_decimal?: string | null,
    created_at?: number | null,
    updated_at?: number | null,
    tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    is_advance_charge?: boolean | null,
    business_entity_id?: string | null,
    deleted?: boolean | null
  }[] | null
} | null
```

***

### chargeFutureRenewals

`subscriptions.chargeFutureRenewals`

Charge future renewals. Creates a single advance invoice or an advance invoicing schedule for a subscription. Use this operation to bill future renewals in advance, enabling customers to prepay for upcoming billing cycles. ### Prerequisites & Constraints \* The Advance Invoicing feature must be enabled on the site.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.subscriptions.chargeFutureRenewals({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `terms_to_charge` | `number` | No | The number of billing cycles to charge, depending on the `schedule_type`: \* For `schedule_type = immediate`: The number of future billing cycles to be invoiced in advance. The invoicing is done for the [`remaining_billing_cycles`](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#subscription_remaining_billing_cycles) of the subscription if that is less than `terms_to_charge`. \* For `schedule_type = fixed_intervals`: The number of future billing cycles in one interval. The schedule is created such that the total number of billing cycles in the schedule does not exceed the `remaining_billing_cycles` of the subscription. **Constraints** \* Must be greater than 0. \* Must not exceed the maximum terms allowed for advance invoicing (configured in [site settings](https://www.chargebee.com/docs/billing/2.0/invoices-credit-notes-and-quotes/advance-invoices)). \* The value must not exceed the `remaining_billing_cycles` of the subscription. **Default value** \* `1` |
| `invoice_immediately` | `boolean` | No | Whether the charge should be invoiced immediately or added to [`unbilled_charges`](https://docs.corsair.dev/docs/api/unbilled_charges). **Prerequisite** \* If `invoice_immediately` is `true` and `auto_collection` is `on` for the subscription, there must be a valid and active online [`payment_source`](https://docs.corsair.dev/docs/api/payment_sources) associated with the [subscription](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#subscription_payment_source_id) or the customer. **Constraints** \* The `schedule_type` must be `immediate`. **Default value** \* `true` |
| `schedule_type` | `immediate \| specific_dates \| fixed_intervals` | No | The type of advance invoice or advance invoicing schedule. **Default value** \* `immediate` \* immediate - Bill immediately for the number of billing cycles specified by `terms_to_charge`. **Prerequisite** \* There must not be an existing advance invoice or an advance invoice schedule for the subscription. \* specific\_dates - Invoice on specific dates. **Prerequisite** \* There should not be an existing advance invoice schedule of `schedule_type` = `fixed_intervals` for the subscription. \* The total number of advance invoice schedules (existing and new ones scheduled through this API) of `schedule_type` = `specific_dates` must not exceed 5. **Constraints** \* When this option is selected, you must provide `specific_dates_schedule[date]`. \* fixed\_intervals - Invoice at fixed intervals of time. **Prerequisite** \* There should not be any existing advance invoice schedule for the subscription. **Constraints** \* When this option is selected, you must provide the following parameters: \* `terms_to_charge` \* `fixed_interval_schedule[days_before_renewal]` \* `fixed_interval_schedule[end_schedule_on]` |
| `fixed_interval_schedule` | `object` | No | Parameters for fixed\_interval\_schedule. **Required if** \* `schedule_type` is `fixed_intervals`. **Constraint** \* There must be exactly one element in the `fixed_interval_schedule` array. |
| `specific_dates_schedule` | `object` | No | Parameters for specific\_dates\_schedule. **Required if** \* `schedule_type` is `specific_dates`. **Constraints** \* The total number of schedules on the subscription (existing and new ones scheduled through this API) must not exceed 5. |

```ts theme={null}
{
  number_of_occurrences?: number,
  days_before_renewal?: number,
  end_schedule_on?: after_number_of_intervals | specific_date | subscription_end,
  end_date?: number
}
```

```ts theme={null}
{
  terms_to_charge?: number[],
  date?: number[]
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `subscription` | `object \| null` | No | A Chargebee subscription connects a customer record to products/services. It describes what the customer has signed up for and how often they're charged for it. The essential components of a subscription are: \* A [plan-item price](https://docs.corsair.dev/docs/api/item_prices). \* Any addon- and charge-item prices applied to the subscription. \* Any [coupons](https://docs.corsair.dev/docs/api/coupons) applied. \* Any [discounts](https://docs.corsair.dev/docs/api/discounts) applied. The charges in a subscription are billed via invoices. **Note:** The maximum number of subscriptions for any given [customer](https://docs.corsair.dev/docs/api/customers) ([active](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#status) or not) is 900. #### Subscription billing frequencies Chargebee offers two billing frequency options for subscriptions: \* **Plan-based billing** (`default`): Subscriptions are billed based on the billing period defined for the item price of the `item_type` `plan`. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/subscriptions#plan-based-billing). \* **Multi-frequency billing** : Subscriptions are billed according to the billing period of each recurring item price within the subscription. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing). **Important** [Limitations](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing#limitations) of Multi-frequency billing. The selection of the billing frequency preference is configured at the site level. #### Item price compatibility in a subscription When creating or updating a subscription, one of the item prices specified under subscription\_items must be a plan-item price. The remaining must be compatible addon- or charge-item prices. An item price is compatible with a plan-item price if their currencies are the same. Additionally, an addon-item price is compatible with a plan-item price only if their billing frequencies meet the following conditions: \| `period_unit` for plan-item price \| Compatible `period_unit` for addon-item price \| Compatible period for addon-item price \| \|-----------------------------------\|-----------------------------------------------\|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `day` \| `day` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `10`, then the period of the addon-item price can be `10`, `5`, `2`, or `1`. \| \| `week` \| `week` or `day` \| The `period` (in days) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the period of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `week`, `period` can be `2` or `1`. \* for `period_unit` as `day`, `period` can be `14`, `7`, `2`, or `1`. \| \| `month` \| `month` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `6`, then the `period` of the addon-item price can be `6`, `3`, `2`, or `1`. \| \| `year` \| `year` or `month` \| The `period` (in months) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the `period` of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `year`, `period` can be `2` or `1`. \* for `period_unit` as `month`, `period` can be `24`, `12`, `8`, `6`, `4`, `3`, `2`, or `1`. \| #### Tax provider fields **Avalara** : Merchants using **Avalara Sales Tax** can optionally associate each item price with a locationCode (from their Avalara company locations), so tax can be resolved correctly at the line item level. \| Field ID \| Field Value \| APIs \| \|--------------------------------------------------------------------------------\|----------------------------------------------------------------------\|--------------------------------------------------------------------------------\| \| `locationCode` \| Merchant to configure it on Avalara Platform under company locations \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| **Anrok**: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation \| Field ID \| Field Value \| APIs \| \|---------------------------------------------------------------------------------------------------------------------------------------\|---------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------\| \| `additionalTaxRegistrationNumber` \| Canadian tax registration numbers in comma separated fashion. \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| **Vertex**: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration **Note:** Field Id like `customerCode` , `customerClass` , and`taxExempted` belong to the customer object. Field Id like `productCode` , `productClass` , `productTaxCode` , and `productClass` belong to the product object. \| Field ID \| Field Value \| APIs \| \|-----------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productCode` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `customerCode` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `customerClass` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **Taxamo:** Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration \| Field Id \| Field Value \| APIs \| \|------------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productTaxCode` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `taxExempted` \| Merchant to configure it on Taxamo Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **cbtaxes**: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India. \| Field ID \| Field Value \| APIs \| \|---------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `indiaSez` \| `SEZ_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaSez` \| `SEZ_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **All**: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level \| Field ID \| Field Value \| APIs \| \|-------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `priceType` \| `TAX_INCLUSIVE` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| \| `TAX_EXCLUSIVE` \| \| \| \| `SITE_DEFAULT` or blank \| Removes price type override, and allows site level configuration to be used for tax calculation. \| #### Ramps API compatibility mode If you want to schedule changes on a subscription, use the [Ramps API](https://docs.corsair.dev/docs/api/ramps). If you are currently scheduling changes through the [Update subscription API](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items), migrate to the Ramps API. To get started, [request access for Subscription Ramps](https://app.chargebee.com/login?forward=https://app.chargebee.com/request_access/subscription-ramps\&ref=feature). Chargebee will enable Ramps compatibility mode for your site. Once enabled, you can test the Ramps API without impacting your existing integrations. The following parts of the Billing API have subtle differences in behavior when the Ramps feature is disabled versus when it is enabled with compatibility mode. (Follow the links to learn more.) \* The value of the [`subscription.has_scheduled_changes`](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#has_scheduled_changes) attribute. \* [Update subscription](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#impact-scheduled-changes) \* [Create Checkout for updating a subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription#impact-scheduled-changes) \* [Remove scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/remove-scheduled-changes) \* [Retrieve with scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/retrieve-with-scheduled-changes) \* [Create a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/create-a-quote-for-update-subscription-items) \* [Edit a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/edit-update-subscription-quote-for-items) \* [Portal sessions](https://docs.corsair.dev/docs/api/portal_sessions#scheduled-subscription-changes) |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |
| `advance_invoice_schedules` | `object[] \| null` | No | Resource object representing advance\_invoice\_schedule |

```ts theme={null}
{
  id?: string | null,
  currency_code?: string | null,
  billing_period?: number | null,
  billing_period_unit?: string | null,
  start_date?: number | null,
  trial_end?: number | null,
  remaining_billing_cycles?: number | null,
  po_number?: string | null,
  auto_collection?: string | null,
  plan_quantity_in_decimal?: string | null,
  plan_unit_price_in_decimal?: string | null,
  customer_id?: string | null,
  status?: string | null,
  trial_start?: number | null,
  trial_end_action?: string | null,
  current_term_start?: number | null,
  current_term_end?: number | null,
  next_billing_at?: number | null,
  created_at?: number | null,
  started_at?: number | null,
  activated_at?: number | null,
  contract_term_billing_cycle_on_renewal?: number | null,
  override_relationship?: boolean | null,
  pause_date?: number | null,
  resume_date?: number | null,
  cancelled_at?: number | null,
  cancel_reason?: string | null,
  created_from_ip?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  has_scheduled_advance_invoices?: boolean | null,
  has_scheduled_changes?: boolean | null,
  payment_source_id?: string | null,
  plan_free_quantity_in_decimal?: string | null,
  plan_amount_in_decimal?: string | null,
  cancel_schedule_created_at?: number | null,
  offline_payment_method?: string | null,
  channel?: string | null,
  net_term_days?: number | null,
  active_id?: string | null,
  due_invoices_count?: number | null,
  due_since?: number | null,
  total_dues?: number | null,
  mrr?: number | null,
  exchange_rate?: number | null,
  base_currency_code?: string | null,
  invoice_notes?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  changes_scheduled_at?: number | null,
  cancel_reason_code?: string | null,
  free_period?: number | null,
  free_period_unit?: string | null,
  create_pending_invoices?: boolean | null,
  auto_close_invoices?: boolean | null,
  business_entity_id?: string | null,
  decommissioned?: boolean | null,
  brand_id?: string | null,
  subscription_items?: {
    item_price_id?: string | null,
    item_type?: string | null,
    quantity?: number | null,
    quantity_in_decimal?: string | null,
    unit_price?: number | null,
    unit_price_in_decimal?: string | null,
    amount?: number | null,
    current_term_start?: number | null,
    current_term_end?: number | null,
    next_billing_at?: number | null,
    amount_in_decimal?: string | null,
    billing_period?: number | null,
    billing_period_unit?: string | null,
    free_quantity?: number | null,
    free_quantity_in_decimal?: string | null,
    trial_end?: number | null,
    billing_cycles?: number | null,
    service_period_days?: number | null,
    charge_on_event?: string | null,
    charge_once?: boolean | null,
    charge_on_option?: string | null,
    proration_type?: string | null,
    usage_accumulation_reset_frequency?: string | null,
    description?: string | null
  }[] | null,
  item_tiers?: {
    item_price_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    price?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    price_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null,
    index?: number | null
  }[] | null,
  charged_items?: {
    item_price_id?: string | null,
    last_charged_at?: number | null
  }[] | null,
  coupons?: {
    coupon_id?: string | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_code?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_info?: {
    referral_code?: string | null,
    coupon_code?: string | null,
    referrer_id?: string | null,
    external_reference_id?: string | null,
    reward_status?: string | null,
    referral_system?: string | null,
    account_id?: string | null,
    campaign_id?: string | null,
    external_campaign_id?: string | null,
    friend_offer_type?: string | null,
    referrer_reward_type?: string | null,
    notify_referral_system?: string | null,
    destination_url?: string | null,
    post_purchase_widget_enabled?: boolean | null
  } | null,
  billing_override?: {
    max_excess_payment_usage?: number | null,
    max_refundable_credits_usage?: number | null
  } | null,
  contract_term?: {
    id?: string | null,
    status?: string | null,
    contract_start?: number | null,
    contract_end?: number | null,
    billing_cycle?: number | null,
    action_at_term_end?: string | null,
    total_contract_value?: number | null,
    total_contract_value_before_tax?: number | null,
    cancellation_cutoff_period?: number | null,
    created_at?: number | null,
    subscription_id?: string | null,
    remaining_billing_cycles?: number | null
  } | null,
  discounts?: {
    id?: string | null,
    invoice_name?: string | null,
    description?: string | null,
    type?: string | null,
    percentage?: number | null,
    amount?: number | null,
    quantity?: number | null,
    currency_code?: string | null,
    duration_type?: string | null,
    period?: number | null,
    period_unit?: string | null,
    included_in_mrr?: boolean | null,
    apply_on?: string | null,
    item_price_id?: string | null,
    created_at?: number | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_id?: string | null,
    index?: number | null
  }[] | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  email?: string | null,
  phone?: string | null,
  company?: string | null,
  vat_number?: string | null,
  auto_collection?: string | null,
  offline_payment_method?: string | null,
  net_term_days?: number | null,
  vat_number_validated_time?: number | null,
  vat_number_status?: string | null,
  allow_direct_debit?: boolean | null,
  is_location_valid?: boolean | null,
  created_at?: number | null,
  created_from_ip?: string | null,
  exemption_details?: any[] | null,
  taxability?: string | null,
  entity_code?: string | null,
  exempt_number?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  locale?: string | null,
  billing_date?: number | null,
  billing_month?: number | null,
  billing_date_mode?: string | null,
  billing_day_of_week?: string | null,
  billing_day_of_week_mode?: string | null,
  pii_cleared?: string | null,
  auto_close_invoices?: boolean | null,
  channel?: string | null,
  active_id?: string | null,
  fraud_flag?: string | null,
  primary_payment_source_id?: string | null,
  backup_payment_source_id?: string | null,
  invoice_notes?: string | null,
  business_entity_id?: string | null,
  preferred_currency_code?: string | null,
  promotional_credits?: number | null,
  unbilled_charges?: number | null,
  refundable_credits?: number | null,
  excess_payments?: number | null,
  is_einvoice_enabled?: boolean | null,
  einvoicing_method?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  registered_for_gst?: boolean | null,
  consolidated_invoicing?: boolean | null,
  customer_type?: string | null,
  business_customer_without_vat_number?: boolean | null,
  client_profile_id?: string | null,
  use_default_hierarchy_settings?: boolean | null,
  vat_number_prefix?: string | null,
  entity_identifier_scheme?: string | null,
  entity_identifier_standard?: string | null,
  brand_id?: string | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_urls?: {
    external_customer_id?: string | null,
    referral_sharing_url?: string | null,
    created_at?: number | null,
    updated_at?: number | null,
    referral_campaign_id?: string | null,
    referral_account_id?: string | null,
    referral_external_campaign_id?: string | null,
    referral_system?: string | null
  }[] | null,
  contacts?: {
    id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    phone?: string | null,
    label?: string | null,
    enabled?: boolean | null,
    send_account_email?: boolean | null,
    send_billing_email?: boolean | null
  }[] | null,
  payment_method?: {
    type?: string | null,
    gateway?: string | null,
    gateway_account_id?: string | null,
    status?: string | null,
    reference_id?: string | null
  } | null,
  balances?: {
    promotional_credits?: number | null,
    excess_payments?: number | null,
    refundable_credits?: number | null,
    unbilled_charges?: number | null,
    currency_code?: string | null,
    business_entity_id?: string | null
  }[] | null,
  entity_identifiers?: {
    id?: string | null,
    value?: string | null,
    scheme?: string | null,
    standard?: string | null
  }[] | null,
  tax_providers_fields?: {
    provider_name?: string | null,
    field_id?: string | null,
    field_value?: string | null
  }[] | null,
  relationship?: {
    parent_id?: string | null,
    payment_owner_id?: string | null,
    invoice_owner_id?: string | null
  } | null,
  parent_account_access?: {
    portal_edit_child_subscriptions?: string | null,
    portal_download_child_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null,
  child_account_access?: {
    portal_edit_subscriptions?: string | null,
    portal_download_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null
} | null
```

```ts theme={null}
{
  payment_source_id?: string | null,
  status?: string | null,
  gateway?: string | null,
  gateway_account_id?: string | null,
  ref_tx_id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  iin?: string | null,
  last4?: string | null,
  card_type?: string | null,
  funding_type?: string | null,
  expiry_month?: number | null,
  expiry_year?: number | null,
  issuing_country?: string | null,
  billing_addr1?: string | null,
  billing_addr2?: string | null,
  billing_city?: string | null,
  billing_state_code?: string | null,
  billing_state?: string | null,
  billing_country?: string | null,
  billing_zip?: string | null,
  created_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  ip_address?: string | null,
  powered_by?: string | null,
  customer_id?: string | null,
  masked_number?: string | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  payment_owner?: string | null,
  subscription_id?: string | null,
  recurring?: boolean | null,
  status?: string | null,
  date?: number | null,
  due_date?: number | null,
  net_term_days?: number | null,
  po_number?: string | null,
  vat_number?: string | null,
  price_type?: string | null,
  exchange_rate?: number | null,
  local_currency_exchange_rate?: number | null,
  currency_code?: string | null,
  local_currency_code?: string | null,
  tax?: number | null,
  sub_total?: number | null,
  sub_total_in_local_currency?: number | null,
  total?: number | null,
  total_in_local_currency?: number | null,
  amount_due?: number | null,
  amount_adjusted?: number | null,
  amount_paid?: number | null,
  paid_at?: number | null,
  write_off_amount?: number | null,
  credits_applied?: number | null,
  dunning_status?: string | null,
  next_retry_at?: number | null,
  voided_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  line_items_next_offset?: string | null,
  first_invoice?: boolean | null,
  new_sales_amount?: number | null,
  has_advance_charges?: boolean | null,
  offline_payment_method?: string | null,
  term_finalized?: boolean | null,
  is_gifted?: boolean | null,
  generated_at?: number | null,
  expected_payment_date?: number | null,
  amount_to_collect?: number | null,
  round_off_amount?: number | null,
  retry_segment_id?: string | null,
  void_reason_code?: string | null,
  deleted?: boolean | null,
  tax_category?: string | null,
  vat_number_prefix?: string | null,
  channel?: string | null,
  business_entity_id?: string | null,
  brand_id?: string | null,
  exchange_rates?: {
    currency_code?: string | null,
    rate?: number | null
  }[] | null,
  line_items?: {
    id?: string | null,
    subscription_id?: string | null,
    date_from?: number | null,
    date_to?: number | null,
    unit_amount?: number | null,
    quantity?: number | null,
    amount?: number | null,
    pricing_model?: string | null,
    is_taxed?: boolean | null,
    tax_amount?: number | null,
    tax_rate?: number | null,
    unit_amount_in_decimal?: string | null,
    quantity_in_decimal?: string | null,
    amount_in_decimal?: string | null,
    discount_amount?: number | null,
    item_level_discount_amount?: number | null,
    metered?: boolean | null,
    is_percentage_pricing?: boolean | null,
    reference_line_item_id?: string | null,
    description?: string | null,
    entity_description?: string | null,
    entity_type?: string | null,
    tax_exempt_reason?: string | null,
    entity_id?: string | null,
    customer_id?: string | null,
    proration_mode?: string | null
  }[] | null,
  line_item_tiers?: {
    line_item_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    quantity_used?: number | null,
    unit_amount?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    quantity_used_in_decimal?: string | null,
    unit_amount_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null
  }[] | null,
  line_item_discounts?: {
    line_item_id?: string | null,
    discount_type?: string | null,
    coupon_id?: string | null,
    entity_id?: string | null,
    discount_amount?: number | null
  }[] | null,
  line_item_taxes?: {
    line_item_id?: string | null,
    tax_name?: string | null,
    tax_rate?: number | null,
    date_to?: number | null,
    date_from?: number | null,
    prorated_taxable_amount?: number | null,
    is_partial_tax_applied?: boolean | null,
    is_non_compliance_tax?: boolean | null,
    taxable_amount?: number | null,
    tax_amount?: number | null,
    tax_juris_type?: string | null,
    tax_juris_name?: string | null,
    tax_juris_code?: string | null,
    tax_amount_in_local_currency?: number | null,
    local_currency_code?: string | null
  }[] | null,
  line_item_credits?: {
    cn_id?: string | null,
    applied_amount?: number | null,
    line_item_id?: string | null
  }[] | null,
  line_item_addresses?: {
    line_item_id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  }[] | null,
  discounts?: {
    amount?: number | null,
    description?: string | null,
    line_item_id?: string | null,
    entity_type?: string | null,
    discount_type?: string | null,
    entity_id?: string | null,
    coupon_set_code?: string | null
  }[] | null,
  taxes?: {
    name?: string | null,
    amount?: number | null,
    description?: string | null
  }[] | null,
  tax_origin?: {
    country?: string | null,
    registration_number?: string | null
  } | null,
  linked_taxes_withheld?: {
    id?: string | null,
    amount?: number | null,
    description?: string | null,
    date?: number | null,
    reference_number?: string | null
  }[] | null,
  linked_payments?: {
    txn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null
  }[] | null,
  reference_transactions?: {
    applied_amount?: number | null,
    applied_at?: number | null,
    txn_id?: string | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null,
    txn_type?: string | null,
    amount_capturable?: number | null,
    authorization_reason?: string | null
  }[] | null,
  dunning_attempts?: {
    attempt?: number | null,
    transaction_id?: string | null,
    dunning_type?: string | null,
    created_at?: number | null,
    txn_status?: string | null,
    txn_amount?: number | null,
    retry_engine?: string | null
  }[] | null,
  applied_credits?: {
    cn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_status?: string | null,
    tax_application?: string | null
  }[] | null,
  adjustment_credit_notes?: {
    cn_id?: string | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_total?: number | null,
    cn_status?: string | null
  }[] | null,
  issued_credit_notes?: {
    cn_id?: string | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_total?: number | null,
    cn_status?: string | null
  }[] | null,
  linked_orders?: {
    id?: string | null,
    document_number?: string | null,
    status?: string | null,
    order_type?: string | null,
    reference_id?: string | null,
    fulfillment_status?: string | null,
    batch_id?: string | null,
    created_at?: number | null
  }[] | null,
  notes?: {
    note?: string | null,
    entity_id?: string | null,
    entity_type?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  statement_descriptor?: {
    id?: string | null,
    descriptor?: string | null
  } | null,
  einvoice?: {
    id?: string | null,
    reference_id?: string | null,
    reference_number?: string | null,
    status?: string | null,
    message?: string | null,
    provider_references?: any[] | null
  } | null,
  site_details_at_creation?: {
    timezone?: string | null,
    organization_address?: {
    } | null
  } | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  schedule_type?: string | null,
  fixed_interval_schedule?: {
    end_schedule_on?: string | null,
    number_of_occurrences?: number | null,
    days_before_renewal?: number | null,
    end_date?: number | null,
    created_at?: number | null,
    terms_to_charge?: number | null
  } | null,
  specific_dates_schedule?: {
    terms_to_charge?: number | null,
    date?: number | null,
    created_at?: number | null
  } | null
}[] | null
```

***

### create

`subscriptions.create`

Create a subscription. Note: This operation optionally supports 3DS verification flow. To achieve the same, create the Payment Intent and pass it as input parameter to this API. Creates a new subscription along with the customer. Product Catalog 1.0 sites only.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.subscriptions.create({ plan_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `id` | `string` | No | A unique and immutable identifier for the subscription. If not provided, it is autogenerated. |
| `brand_id` | `string` | No | — |
| `plan_id` | `string` | Yes | Identifier of the plan for this subscription. |
| `plan_quantity` | `number` | No | Plan quantity for this subscription. |
| `plan_quantity_in_decimal` | `string` | No | The decimal representation of the quantity of the plan purchased. Can be provided for quantity-based plans and only when [multi-decimal pricing](https://docs.corsair.dev/docs/api/v2/pcv-1/currencies) is enabled. |
| `plan_unit_price` | `number` | No | Plan Unit Amount for create subscription. |
| `plan_unit_price_in_decimal` | `string` | No | Plan Unit Amount in Decimal for create subscription. |
| `setup_fee` | `number` | No | Amount that will override the default setup fee. The unit depends on the [type of currency](https://docs.corsair.dev/docs/api/getting-started) . |
| `trial_end` | `number` | No | The time at which the trial ends for this subscription. Can be specified to override the default trial period.If **'0'** is passed, the subscription will be activated immediately. |
| `billing_cycles` | `number` | No | Specifies the number of billing cycles for the subscription. The behavior of the subscription after the billing cycles have completed depends on whether the subscription is on a [contract term](https://docs.corsair.dev/docs/api/v2/pcv-1/contract_terms) or not. \* When the subscription is not on a contract term: if `billing_cycles` is not provided, then the billing cycles [set for the plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object#billing_cycles) is used. Moreover, once the `billing_cycles` have completed, the subscription cancels. \* When the subscription is on a contract term: Providing `billing_cycles` is mandatory. Moreover, once the `billing_cycles` have completed, the behavior of the subscription is determined by the `contract_term[action_at_term_end]` parameter. |
| `mandatory_addons_to_remove` | `string[]` | No | List of addons IDs that are mandatory to the plan and has to be removed from the subscription. |
| `start_date` | `number` | No | 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. . |
| `auto_collection` | `on \| off` | No | Defines whether payments need to be collected automatically for this subscription. Overrides customer's auto-collection property. \* 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. |
| `terms_to_charge` | `number` | No | 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` | `immediate \| delayed` | No | 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. \* 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. |
| `offline_payment_method` | `no_preference \| cash \| check \| bank_transfer \| ach_credit \| sepa_credit \| boleto \| us_automated_bank_transfer \| eu_automated_bank_transfer \| uk_automated_bank_transfer \| jp_automated_bank_transfer \| mx_automated_bank_transfer \| custom` | No | The preferred offline payment method for the subscription. \* cash - Cash \* bank\_transfer - Bank Transfer \* check - Check \* custom - Custom \* us\_automated\_bank\_transfer - US Automated Bank Transfer \* ach\_credit - ACH Credit \* sepa\_credit - SEPA Credit \* no\_preference - No Preference \* eu\_automated\_bank\_transfer - EU Automated Bank Transfer \* jp\_automated\_bank\_transfer - JP Automated Bank Transfer \* uk\_automated\_bank\_transfer - UK Automated Bank Transfer \* boleto - Boleto \* mx\_automated\_bank\_transfer - MX Automated Bank Transfer |
| `po_number` | `string` | No | Purchase order number for this subscription. |
| `coupon_ids` | `string[]` | No | List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes. |
| `token_id` | `string` | No | The Chargebee payment token generated by [Chargebee.js](https://www.chargebee.com/docs/payments/2.0/card-components-and-helpers/3ds-helper#using-the-gateways-hosted-fields). **Note** : The payment token created via Chargebee.js uses the gateway selected through [Smart Routing](https://www.chargebee.com/docs/payments/1.0/payment-gateways-and-configuration/gateway_settings#smart-routing). Explicitly passing a `gateway_id` in this API call will not override the gateway associated with the token. |
| `affiliate_token` | `string` | No | A unique tracking token. |
| `invoice_notes` | `string` | No | A customer-facing note added to all invoices associated with this subscription. This note is one among [all the notes](https://docs.corsair.dev/docs/api/invoices/invoice-object#notes) displayed on the invoice PDF. |
| `invoice_date` | `number` | No | 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 the 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. \* It is not earlier than `start_date`. \* It is not more than one calendar month into the past. Eg. If today is 13th January, then you cannot pass a value that is earlier than 13th December. \* `invoice_immediately` is true. . |
| `meta_data` | `object` | No | A collection of key-value pairs that provides extra information about the subscription. **Note:** There's a character limit of 65,535. [Learn more](https://docs.corsair.dev/docs/api/v2/pcv-1/advanced-features) . |
| `invoice_immediately` | `boolean` | No | 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. . |
| `free_period` | `number` | No | 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` | `day \| week \| month \| year` | No | 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](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/create-a-plan#period_unit) attribute of the [plan](https://docs.corsair.dev/docs/api/v2/pcv-1/subscriptions/create-a-subscription#plan_id) chosen. \* week - Charge based on week(s) \* month - Charge based on month(s) \* day - Charge based on day(s) \* year - Charge based on year(s) |
| `contract_term_billing_cycle_on_renewal` | `number` | No | 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` | `site_default \| plan_default \| activate_subscription \| cancel_subscription` | No | 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. \* cancel\_subscription - The subscription cancels. \* 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. \* 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. |
| `client_profile_id` | `string` | No | 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. |
| `payment_initiator` | `customer \| merchant` | No | The type of initiator to be used for the payment request triggered by this operation. \* customer - Pass this value to indicate that the request is initiated by the customer \* merchant - Pass this value to indicate that the request is initiated by the merchant |
| `customer` | `object` | No | Parameters for customer |
| `card` | `object` | No | Parameters for card |
| `bank_account` | `object` | No | Parameters for bank\_account |
| `payment_method` | `object` | No | Parameters for payment\_method |
| `payment_intent` | `object` | No | Parameters for payment\_intent |
| `billing_address` | `object` | No | Parameters for billing\_address |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `statement_descriptor` | `object` | No | Parameters for statement\_descriptor |
| `contract_term` | `object` | No | Parameters for contract\_term |
| `entity_identifiers` | `object` | No | Parameters for entity\_identifiers |
| `tax_providers_fields` | `object` | No | Parameters for tax\_providers\_fields |
| `addons` | `object` | No | Parameters for addons |
| `event_based_addons` | `object` | No | Parameters for event\_based\_addons |

```ts theme={null}
{
}
```

```ts theme={null}
{
  id?: string,
  email?: string,
  first_name?: string,
  last_name?: string,
  company?: string,
  phone?: string,
  locale?: string,
  taxability?: taxable | exempt | zero_rated,
  entity_code?: a | b | c | d | e | f | g | h | i | j | k | l | m | n | p | q | r | med1 | med2,
  exempt_number?: string,
  net_term_days?: number,
  taxjar_exemption_category?: wholesale | government | other,
  auto_collection?: on | off,
  offline_payment_method?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
  allow_direct_debit?: boolean,
  consolidated_invoicing?: boolean,
  vat_number?: string,
  vat_number_prefix?: string,
  entity_identifier_scheme?: string,
  entity_identifier_standard?: string,
  is_einvoice_enabled?: boolean,
  einvoicing_method?: automatic | manual | site_default,
  registered_for_gst?: boolean,
  business_customer_without_vat_number?: boolean,
  exemption_details?: any[],
  customer_type?: residential | business | senior_citizen | industrial
}
```

```ts theme={null}
{
  gateway_account_id?: string,
  first_name?: string,
  last_name?: string,
  number?: string,
  expiry_month?: number,
  expiry_year?: number,
  cvv?: string,
  preferred_scheme?: cartes_bancaires | mastercard | visa | dankort,
  billing_addr1?: string,
  billing_addr2?: string,
  billing_city?: string,
  billing_state_code?: string,
  billing_state?: string,
  billing_zip?: string,
  billing_country?: string,
  additional_information?: {
  }
}
```

```ts theme={null}
{
  gateway_account_id?: string,
  iban?: string,
  first_name?: string,
  last_name?: string,
  company?: string,
  email?: string,
  phone?: string,
  bank_name?: string,
  account_number?: string,
  routing_number?: string,
  bank_code?: string,
  account_type?: checking | savings | business_checking | current,
  account_holder_type?: individual | company,
  echeck_type?: web | ppd | ccd,
  issuing_country?: string,
  swedish_identity_number?: string,
  billing_address?: {
  }
}
```

```ts theme={null}
{
  type?: card | paypal_express_checkout | amazon_payments | direct_debit | generic | alipay | unionpay | apple_pay | wechat_pay | ideal | google_pay | sofort | bancontact | giropay | dotpay | upi | netbanking_emandates | venmo | pay_to | faster_payments | sepa_instant_transfer | automated_bank_transfer | klarna_pay_now | online_banking_poland | payconiq_by_bancontact | electronic_payment_standard | kbc_payment_button | pay_by_bank | trustly | stablecoin | kakao_pay | naver_pay | revolut_pay | cash_app_pay | twint | go_pay | grab_pay | pay_co | after_pay | swish | payme | pix | klarna | alipay_hk | paypay | gcash | south_korean_cards | paynow | bizum | promptpay | dana | touch_n_go | tamara | qpay | ovo | momo | mercado_pago | nequi | nupay | picpay | thai_qr | blik | fpx | wero | p24 | affirm_pay | rakuten_pay,
  gateway_account_id?: string,
  reference_id?: string,
  tmp_token?: string,
  issuing_country?: string,
  additional_information?: {
  }
}
```

```ts theme={null}
{
  id?: string,
  gateway_account_id?: string,
  gw_token?: string,
  payment_method_type?: card | ideal | sofort | bancontact | google_pay | dotpay | giropay | apple_pay | upi | netbanking_emandates | paypal_express_checkout | direct_debit | boleto | venmo | amazon_payments | pay_to | faster_payments | sepa_instant_transfer | klarna_pay_now | online_banking_poland | payconiq_by_bancontact | electronic_payment_standard | kbc_payment_button | pay_by_bank | trustly | stablecoin | kakao_pay | naver_pay | revolut_pay | cash_app_pay | wechat_pay | alipay | twint | go_pay | grab_pay | pay_co | after_pay | swish | payme | pix | klarna | alipay_hk | paypay | gcash | south_korean_cards | paynow | bizum | promptpay | dana | touch_n_go | tamara | qpay | ovo | momo | mercado_pago | nequi | nupay | picpay | thai_qr | blik | fpx | wero | p24 | affirm_pay | rakuten_pay,
  reference_id?: string,
  additional_information?: {
  }
}
```

```ts theme={null}
{
  first_name?: string,
  last_name?: string,
  email?: string,
  company?: string,
  phone?: string,
  line1?: string,
  line2?: string,
  line3?: string,
  city?: string,
  state_code?: string,
  state?: string,
  zip?: string,
  country?: string,
  validation_status?: not_validated | valid | partially_valid | invalid
}
```

```ts theme={null}
{
  first_name?: string,
  last_name?: string,
  email?: string,
  company?: string,
  phone?: string,
  line1?: string,
  line2?: string,
  line3?: string,
  city?: string,
  state_code?: string,
  state?: string,
  zip?: string,
  country?: string,
  validation_status?: not_validated | valid | partially_valid | invalid
}
```

```ts theme={null}
{
  descriptor?: string
}
```

```ts theme={null}
{
  action_at_term_end?: renew | evergreen | cancel,
  cancellation_cutoff_period?: number
}
```

```ts theme={null}
{
  id?: string[],
  scheme?: string[],
  value?: string[],
  standard?: string[]
}
```

```ts theme={null}
{
  provider_name?: string[],
  field_id?: string[],
  field_value?: string[]
}
```

```ts theme={null}
{
  id?: string[],
  quantity?: number[],
  quantity_in_decimal?: string[],
  unit_price?: number[],
  unit_price_in_decimal?: string[],
  billing_cycles?: number[],
  trial_end?: number[]
}
```

```ts theme={null}
{
  id?: string[],
  quantity?: number[],
  unit_price?: number[],
  quantity_in_decimal?: string[],
  unit_price_in_decimal?: string[],
  service_period_in_days?: number[],
  on_event?: (subscription_creation | subscription_trial_start | plan_activation | subscription_activation | contract_termination)[],
  charge_once?: boolean[],
  charge_on?: (immediately | on_event)[]
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `subscription` | `object \| null` | No | Subscription represents the recurring items a customer has subscribed to. The recurring items can be - plan, addons. It may also contain the discount items like coupons. Subscriptions are invoiced at the start of every term based on the recurring items and charged immediately against the customer's credit card if 'auto\_collection' is turned 'on', otherwise the resulting invoice will be created as 'Payment Due'. **Note:** The maximum number of subscriptions for any given [customer](https://docs.corsair.dev/docs/api/customers) ([active](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#status) or not) is 900. Tax provider fields **Avalara** : Merchants using **Avalara Sales Tax** can optionally associate each item price with a locationCode (from their Avalara company locations), so tax can be resolved correctly at the line item level. \| Field ID \| Field Value \| APIs \| \|--------------------------------------------------------------------------------\|----------------------------------------------------------------------\|--------------------------------------------------------------------------------\| \| `locationCode` \| Merchant to configure it on Avalara Platform under company locations \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| **Anrok**: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation \| Field ID \| Field Value \| APIs \| \|---------------------------------------------------------------------------------------------------------------------------------------\|---------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------\| \| `additionalTaxRegistrationNumber` \| Canadian tax registration numbers in comma separated fashion. \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| **Vertex**: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration **Note:** Field Id like `customerCode` , `customerClass` , and`taxExempted` belong to the customer object. Field Id like `productCode` , `productClass` , `productTaxCode` , and `productClass` belong to the product object. \| Field ID \| Field Value \| APIs \| \|-----------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productCode` \| Merchant to configure it on Vertex Platform \| APIs having [Plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object)(PC1), [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object)(PC1) and [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object)(PC2) attributes. \| \| `productClass` \| Merchant to configure it on Vertex Platform \| APIs having [Plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object)(PC1), [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object)(PC1) and [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object)(PC2) attributes. \| \| `customerCode` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `customerClass` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **Taxamo:** Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration \| Field Id \| Field Value \| APIs \| \|------------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productTaxCode` \| Merchant to configure it on Taxamo Platform \| APIs having [Plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object)(PC1), [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object)(PC1) and Item Prices (PC2) attributes. \| \| `productClass` \| Merchant to configure it on Taxamo Platform \| APIs having [Plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object)(PC1), [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object)(PC1) and Item Prices (PC2) attributes. \| \| `taxExempted` \| Merchant to configure it on Taxamo Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **cbtaxes**: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India. \| Field ID \| Field Value \| APIs \| \|---------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `indiaSez` \| `SEZ_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaSez` \| `SEZ_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **All**: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level \| Field ID \| Field Value \| APIs \| \|-------------\|-----------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `priceType` \| `TAX_INCLUSIVE` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| \| `TAX_EXCLUSIVE` \| \| \| \| `SITE_DEFAULT` \| Removes price type override, and allows site level configuration to be used for tax calculation. \| **Note:** Make sure you choose the correct **Field ID** and **Available APIs** combination from the table above. All Product Catalog APIs include [Plans](https://docs.corsair.dev/docs/api/v2/pcv-1/plans) , [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons) , [Coupons](https://docs.corsair.dev/docs/api/v2/pcv-1/coupons) , [Coupon Sets](https://docs.corsair.dev/docs/api/v2/pcv-1/coupon_sets) , [Coupon Codes](https://docs.corsair.dev/docs/api/v2/pcv-1/coupon_codes) . |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/v2/pcv-1/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/v2/pcv-1/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any custom attributes you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/1.0/sites-intro.html)\\*\\* created before March 1, 2014\\*\\*: [updating the card](https://docs.corsair.dev/docs/api/v2/pcv-1/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/v2/pcv-1/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |
| `invoice` | `object \| null` | No | Invoices are statements containing charges, adjustments and any discounts for a subscription specific to a term. For every subscription a draft invoice (upcoming invoice) is used to track all the charges, credits and adjustments for the current term. Generally, an invoice is closed at start of the next term. However, cancellation and other such operations on subscription may trigger premature closing. While closing the invoice, in addition to recurring charges, credits and coupons are applied to calculate the final amount that is due. When invoice is closed, an attempt to charge the credit card is made. If the payment succeeds, it is marked as **paid** . If the payment fails, the invoice is marked as **payment\_due** and retry settings are taken into account. If no retry attempts are configured, the invoice is marked as **not\_paid** . If the amount due is zero or negative, the invoice is immediately marked as **paid** and the balance if any is carried forward to the next term of the invoice. **Note:** If *consolidated invoicing* is enabled, the attribute *invoice.subscription\_id* should **not** be used (as it will not be present if the invoice has lines from multiple subscriptions). Instead to know the related subscriptions, their [line\_items](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) *subscription\_id* attribute should be referred. |
| `unbilled_charges` | `object[] \| null` | No | Resource object representing unbilled\_charge |

```ts theme={null}
{
  id?: string | null,
  currency_code?: string | null,
  plan_id?: string | null,
  plan_quantity?: number | null,
  plan_unit_price?: number | null,
  setup_fee?: number | null,
  billing_period?: number | null,
  billing_period_unit?: string | null,
  start_date?: number | null,
  trial_end?: number | null,
  remaining_billing_cycles?: number | null,
  po_number?: string | null,
  auto_collection?: string | null,
  plan_quantity_in_decimal?: string | null,
  plan_unit_price_in_decimal?: string | null,
  customer_id?: string | null,
  plan_amount?: number | null,
  plan_free_quantity?: number | null,
  status?: string | null,
  trial_start?: number | null,
  trial_end_action?: string | null,
  current_term_start?: number | null,
  current_term_end?: number | null,
  next_billing_at?: number | null,
  created_at?: number | null,
  started_at?: number | null,
  activated_at?: number | null,
  gift_id?: string | null,
  contract_term_billing_cycle_on_renewal?: number | null,
  override_relationship?: boolean | null,
  pause_date?: number | null,
  resume_date?: number | null,
  cancelled_at?: number | null,
  cancel_reason?: string | null,
  affiliate_token?: string | null,
  created_from_ip?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  has_scheduled_advance_invoices?: boolean | null,
  has_scheduled_changes?: boolean | null,
  payment_source_id?: string | null,
  plan_free_quantity_in_decimal?: string | null,
  plan_amount_in_decimal?: string | null,
  cancel_schedule_created_at?: number | null,
  offline_payment_method?: string | null,
  channel?: string | null,
  active_id?: string | null,
  due_invoices_count?: number | null,
  due_since?: number | null,
  total_dues?: number | null,
  mrr?: number | null,
  exchange_rate?: number | null,
  base_currency_code?: string | null,
  invoice_notes?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  changes_scheduled_at?: number | null,
  cancel_reason_code?: string | null,
  free_period?: number | null,
  free_period_unit?: string | null,
  create_pending_invoices?: boolean | null,
  auto_close_invoices?: boolean | null,
  business_entity_id?: string | null,
  decommissioned?: boolean | null,
  brand_id?: string | null,
  addons?: {
    id?: string | null,
    quantity?: number | null,
    unit_price?: number | null,
    amount?: number | null,
    trial_end?: number | null,
    remaining_billing_cycles?: number | null,
    quantity_in_decimal?: string | null,
    unit_price_in_decimal?: string | null,
    amount_in_decimal?: string | null,
    proration_type?: string | null
  }[] | null,
  event_based_addons?: {
    id?: string | null,
    quantity?: number | null,
    unit_price?: number | null,
    on_event?: string | null,
    charge_once?: boolean | null,
    quantity_in_decimal?: string | null,
    unit_price_in_decimal?: string | null
  }[] | null,
  charged_event_based_addons?: {
    id?: string | null,
    last_charged_at?: number | null
  }[] | null,
  coupons?: {
    coupon_id?: string | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_code?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_info?: {
    referral_code?: string | null,
    coupon_code?: string | null,
    referrer_id?: string | null,
    external_reference_id?: string | null,
    reward_status?: string | null,
    referral_system?: string | null,
    account_id?: string | null,
    campaign_id?: string | null,
    external_campaign_id?: string | null,
    friend_offer_type?: string | null,
    referrer_reward_type?: string | null,
    notify_referral_system?: string | null,
    destination_url?: string | null,
    post_purchase_widget_enabled?: boolean | null
  } | null,
  contract_term?: {
    id?: string | null,
    status?: string | null,
    contract_start?: number | null,
    contract_end?: number | null,
    billing_cycle?: number | null,
    action_at_term_end?: string | null,
    total_contract_value?: number | null,
    total_contract_value_before_tax?: number | null,
    cancellation_cutoff_period?: number | null,
    created_at?: number | null,
    subscription_id?: string | null,
    remaining_billing_cycles?: number | null
  } | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  email?: string | null,
  phone?: string | null,
  company?: string | null,
  vat_number?: string | null,
  auto_collection?: string | null,
  offline_payment_method?: string | null,
  net_term_days?: number | null,
  vat_number_validated_time?: number | null,
  vat_number_status?: string | null,
  allow_direct_debit?: boolean | null,
  is_location_valid?: boolean | null,
  created_at?: number | null,
  created_from_ip?: string | null,
  exemption_details?: any[] | null,
  taxability?: string | null,
  entity_code?: string | null,
  exempt_number?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  locale?: string | null,
  billing_date?: number | null,
  billing_month?: number | null,
  billing_date_mode?: string | null,
  billing_day_of_week?: string | null,
  billing_day_of_week_mode?: string | null,
  pii_cleared?: string | null,
  auto_close_invoices?: boolean | null,
  channel?: string | null,
  active_id?: string | null,
  fraud_flag?: string | null,
  primary_payment_source_id?: string | null,
  backup_payment_source_id?: string | null,
  invoice_notes?: string | null,
  business_entity_id?: string | null,
  preferred_currency_code?: string | null,
  promotional_credits?: number | null,
  unbilled_charges?: number | null,
  refundable_credits?: number | null,
  excess_payments?: number | null,
  is_einvoice_enabled?: boolean | null,
  einvoicing_method?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  registered_for_gst?: boolean | null,
  consolidated_invoicing?: boolean | null,
  customer_type?: string | null,
  business_customer_without_vat_number?: boolean | null,
  client_profile_id?: string | null,
  use_default_hierarchy_settings?: boolean | null,
  vat_number_prefix?: string | null,
  entity_identifier_scheme?: string | null,
  entity_identifier_standard?: string | null,
  brand_id?: string | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_urls?: {
    external_customer_id?: string | null,
    referral_sharing_url?: string | null,
    created_at?: number | null,
    updated_at?: number | null,
    referral_campaign_id?: string | null,
    referral_account_id?: string | null,
    referral_external_campaign_id?: string | null,
    referral_system?: string | null
  }[] | null,
  contacts?: {
    id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    phone?: string | null,
    label?: string | null,
    enabled?: boolean | null,
    send_account_email?: boolean | null,
    send_billing_email?: boolean | null
  }[] | null,
  payment_method?: {
    type?: string | null,
    gateway?: string | null,
    gateway_account_id?: string | null,
    status?: string | null,
    reference_id?: string | null
  } | null,
  balances?: {
    promotional_credits?: number | null,
    excess_payments?: number | null,
    refundable_credits?: number | null,
    unbilled_charges?: number | null,
    currency_code?: string | null,
    business_entity_id?: string | null
  }[] | null,
  entity_identifiers?: {
    id?: string | null,
    value?: string | null,
    scheme?: string | null,
    standard?: string | null
  }[] | null,
  tax_providers_fields?: {
    provider_name?: string | null,
    field_id?: string | null,
    field_value?: string | null
  }[] | null,
  relationship?: {
    parent_id?: string | null,
    payment_owner_id?: string | null,
    invoice_owner_id?: string | null
  } | null,
  parent_account_access?: {
    portal_edit_child_subscriptions?: string | null,
    portal_download_child_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null,
  child_account_access?: {
    portal_edit_subscriptions?: string | null,
    portal_download_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null
} | null
```

```ts theme={null}
{
  payment_source_id?: string | null,
  status?: string | null,
  gateway?: string | null,
  gateway_account_id?: string | null,
  ref_tx_id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  iin?: string | null,
  last4?: string | null,
  card_type?: string | null,
  funding_type?: string | null,
  expiry_month?: number | null,
  expiry_year?: number | null,
  issuing_country?: string | null,
  billing_addr1?: string | null,
  billing_addr2?: string | null,
  billing_city?: string | null,
  billing_state_code?: string | null,
  billing_state?: string | null,
  billing_country?: string | null,
  billing_zip?: string | null,
  created_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  ip_address?: string | null,
  powered_by?: string | null,
  customer_id?: string | null,
  masked_number?: string | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  payment_owner?: string | null,
  subscription_id?: string | null,
  recurring?: boolean | null,
  status?: string | null,
  date?: number | null,
  due_date?: number | null,
  net_term_days?: number | null,
  po_number?: string | null,
  vat_number?: string | null,
  price_type?: string | null,
  exchange_rate?: number | null,
  local_currency_exchange_rate?: number | null,
  currency_code?: string | null,
  local_currency_code?: string | null,
  tax?: number | null,
  sub_total?: number | null,
  sub_total_in_local_currency?: number | null,
  total?: number | null,
  total_in_local_currency?: number | null,
  amount_due?: number | null,
  amount_adjusted?: number | null,
  amount_paid?: number | null,
  paid_at?: number | null,
  write_off_amount?: number | null,
  credits_applied?: number | null,
  dunning_status?: string | null,
  next_retry_at?: number | null,
  voided_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  line_items_next_offset?: string | null,
  first_invoice?: boolean | null,
  new_sales_amount?: number | null,
  has_advance_charges?: boolean | null,
  offline_payment_method?: string | null,
  term_finalized?: boolean | null,
  is_gifted?: boolean | null,
  generated_at?: number | null,
  expected_payment_date?: number | null,
  amount_to_collect?: number | null,
  round_off_amount?: number | null,
  retry_segment_id?: string | null,
  void_reason_code?: string | null,
  deleted?: boolean | null,
  tax_category?: string | null,
  vat_number_prefix?: string | null,
  channel?: string | null,
  business_entity_id?: string | null,
  brand_id?: string | null,
  exchange_rates?: {
    currency_code?: string | null,
    rate?: number | null
  }[] | null,
  line_items?: {
    id?: string | null,
    subscription_id?: string | null,
    date_from?: number | null,
    date_to?: number | null,
    unit_amount?: number | null,
    quantity?: number | null,
    amount?: number | null,
    pricing_model?: string | null,
    is_taxed?: boolean | null,
    tax_amount?: number | null,
    tax_rate?: number | null,
    unit_amount_in_decimal?: string | null,
    quantity_in_decimal?: string | null,
    amount_in_decimal?: string | null,
    discount_amount?: number | null,
    item_level_discount_amount?: number | null,
    metered?: boolean | null,
    is_percentage_pricing?: boolean | null,
    reference_line_item_id?: string | null,
    description?: string | null,
    entity_description?: string | null,
    entity_type?: string | null,
    tax_exempt_reason?: string | null,
    entity_id?: string | null,
    customer_id?: string | null,
    proration_mode?: string | null
  }[] | null,
  line_item_tiers?: {
    line_item_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    quantity_used?: number | null,
    unit_amount?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    quantity_used_in_decimal?: string | null,
    unit_amount_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null
  }[] | null,
  line_item_discounts?: {
    line_item_id?: string | null,
    discount_type?: string | null,
    coupon_id?: string | null,
    entity_id?: string | null,
    discount_amount?: number | null
  }[] | null,
  line_item_taxes?: {
    line_item_id?: string | null,
    tax_name?: string | null,
    tax_rate?: number | null,
    date_to?: number | null,
    date_from?: number | null,
    prorated_taxable_amount?: number | null,
    is_partial_tax_applied?: boolean | null,
    is_non_compliance_tax?: boolean | null,
    taxable_amount?: number | null,
    tax_amount?: number | null,
    tax_juris_type?: string | null,
    tax_juris_name?: string | null,
    tax_juris_code?: string | null,
    tax_amount_in_local_currency?: number | null,
    local_currency_code?: string | null
  }[] | null,
  line_item_credits?: {
    cn_id?: string | null,
    applied_amount?: number | null,
    line_item_id?: string | null
  }[] | null,
  line_item_addresses?: {
    line_item_id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  }[] | null,
  discounts?: {
    amount?: number | null,
    description?: string | null,
    line_item_id?: string | null,
    entity_type?: string | null,
    discount_type?: string | null,
    entity_id?: string | null,
    coupon_set_code?: string | null
  }[] | null,
  taxes?: {
    name?: string | null,
    amount?: number | null,
    description?: string | null
  }[] | null,
  tax_origin?: {
    country?: string | null,
    registration_number?: string | null
  } | null,
  linked_taxes_withheld?: {
    id?: string | null,
    amount?: number | null,
    description?: string | null,
    date?: number | null,
    reference_number?: string | null
  }[] | null,
  linked_payments?: {
    txn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null
  }[] | null,
  reference_transactions?: {
    applied_amount?: number | null,
    applied_at?: number | null,
    txn_id?: string | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null,
    txn_type?: string | null,
    amount_capturable?: number | null,
    authorization_reason?: string | null
  }[] | null,
  dunning_attempts?: {
    attempt?: number | null,
    transaction_id?: string | null,
    dunning_type?: string | null,
    created_at?: number | null,
    txn_status?: string | null,
    txn_amount?: number | null,
    retry_engine?: string | null
  }[] | null,
  applied_credits?: {
    cn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_status?: string | null,
    tax_application?: string | null
  }[] | null,
  adjustment_credit_notes?: {
    cn_id?: string | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_total?: number | null,
    cn_status?: string | null
  }[] | null,
  issued_credit_notes?: {
    cn_id?: string | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_total?: number | null,
    cn_status?: string | null
  }[] | null,
  linked_orders?: {
    id?: string | null,
    document_number?: string | null,
    status?: string | null,
    order_type?: string | null,
    reference_id?: string | null,
    fulfillment_status?: string | null,
    batch_id?: string | null,
    created_at?: number | null
  }[] | null,
  notes?: {
    note?: string | null,
    entity_id?: string | null,
    entity_type?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  statement_descriptor?: {
    id?: string | null,
    descriptor?: string | null
  } | null,
  einvoice?: {
    id?: string | null,
    reference_id?: string | null,
    reference_number?: string | null,
    status?: string | null,
    message?: string | null,
    provider_references?: any[] | null
  } | null,
  site_details_at_creation?: {
    timezone?: string | null,
    organization_address?: {
    } | null
  } | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  subscription_id?: string | null,
  date_from?: number | null,
  date_to?: number | null,
  unit_amount?: number | null,
  pricing_model?: string | null,
  quantity?: number | null,
  amount?: number | null,
  currency_code?: string | null,
  discount_amount?: number | null,
  description?: string | null,
  entity_type?: string | null,
  entity_id?: string | null,
  is_voided?: boolean | null,
  voided_at?: number | null,
  unit_amount_in_decimal?: string | null,
  quantity_in_decimal?: string | null,
  amount_in_decimal?: string | null,
  created_at?: number | null,
  updated_at?: number | null,
  is_advance_charge?: boolean | null,
  business_entity_id?: string | null,
  deleted?: boolean | null,
  tiers?: {
    starting_unit?: number | null,
    ending_unit?: number | null,
    quantity_used?: number | null,
    unit_amount?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    quantity_used_in_decimal?: string | null,
    unit_amount_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null
  }[] | null
}[] | null
```

***

### createRamp

`subscriptions.createRamp`

Create a subscription ramp. Creates a ramp for a subscription. Note \* Subscription status : You cannot create ramps for subscriptions in the paused or cancelled status. \* Advance invoice : You cannot create ramps for subscriptions that have an advance invoice schedule.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.subscriptions.createRamp({ subscriptionId: 'sub_8gsnbYfsMLds', effective_from: 1 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `effective_from` | `number` | Yes | The time when this ramp takes effect. **Caution** \* Ensure the time is within **five** years from the current time. \* Ensure there is a minimum 24-hour interval between `effective_from` of two consecutive ramps. \* If the subscription is scheduled to be paused or canceled in the future, ensure the time is not on or after [pause\_date](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#pause_date) or [cancelled\_at](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#cancelled_at). |
| `description` | `string` | No | A brief summary of the pricing changes applied with this ramp. |
| `coupons_to_remove` | `string[]` | No | List of [coupons](https://docs.corsair.dev/docs/api/coupons) removed from the subscription through this ramp. **Caution** Ensure this list does **not** include: \* Coupons being added through this ramp. \* Coupons already removed by a previous ramp. |
| `discounts_to_remove` | `string[]` | No | List of [discounts](https://docs.corsair.dev/docs/api/discounts) removed from the subscription through this ramp. **Caution** Ensure this list does not include discounts already removed by a previous ramp. |
| `items_to_remove` | `string[]` | No | List of [item prices](https://docs.corsair.dev/docs/api/item_prices) removed from the subscription through this ramp. **Caution** Ensure this list does **not** include: \* Item prices being added or updated through this ramp. \* Item prices already removed by a previous ramp. |
| `billing_configuration` | `object` | No | Billing-related settings to update when this ramp is executed. |
| `contract_term` | `object` | No | An object that specifies the contract term details. |
| `items_to_add` | `object` | No | Details about the [item prices](https://docs.corsair.dev/docs/api/item_prices) added to the subscription through this ramp. |
| `items_to_update` | `object` | No | Details about the [item prices](https://docs.corsair.dev/docs/api/item_prices) updated in the subscription through this ramp. |
| `item_tiers` | `object` | No | **Note** Allowed only when both of these conditions are met: \* Price overriding is enabled for the site. \* pricing\_model of the item price is either tiered, volume, or stairstep. Replaces the existing item\_tiers for specific `item_price`s within the subscription. You must provide the complete tier set for any `item_price`, even if you're changing the price for only one tier. |
| `coupons_to_add` | `object` | No | Details about the [coupons](https://docs.corsair.dev/docs/api/coupons) added to the subscription through this ramp. |
| `discounts_to_add` | `object` | No | Details about the [discounts](https://docs.corsair.dev/docs/api/discounts) added to the subscription through this ramp. |

```ts theme={null}
{
  po_number?: string
}
```

```ts theme={null}
{
  action_at_term_end?: renew | evergreen | cancel | renew_once,
  cancellation_cutoff_period?: number,
  renewal_billing_cycles?: number
}
```

```ts theme={null}
{
  item_price_id: string[],
  quantity?: number[],
  quantity_in_decimal?: string[],
  unit_price?: number[],
  unit_price_in_decimal?: string[],
  billing_cycles?: number[],
  service_period_days?: number[],
  charge_on_event?: (subscription_trial_start | plan_activation | subscription_activation | contract_termination)[],
  charge_once?: boolean[],
  charge_on_option?: (immediately | on_event)[],
  description?: string[]
}
```

```ts theme={null}
{
  item_price_id: string[],
  quantity?: number[],
  quantity_in_decimal?: string[],
  unit_price?: number[],
  unit_price_in_decimal?: string[],
  billing_cycles?: number[],
  service_period_days?: number[],
  charge_on_event?: (subscription_trial_start | plan_activation | subscription_activation | contract_termination)[],
  charge_once?: boolean[],
  charge_on_option?: (immediately | on_event)[],
  description?: string[]
}
```

```ts theme={null}
{
  item_price_id?: string[],
  starting_unit?: number[],
  ending_unit?: number[],
  price?: number[],
  starting_unit_in_decimal?: string[],
  ending_unit_in_decimal?: string[],
  price_in_decimal?: string[],
  pricing_type?: (per_unit | flat_fee | package)[],
  package_size?: number[]
}
```

```ts theme={null}
{
  coupon_id?: string[],
  apply_till?: number[]
}
```

```ts theme={null}
{
  apply_on: (invoice_amount | specific_item_price)[],
  duration_type: (one_time | forever | limited_period)[],
  percentage?: number[],
  amount?: number[],
  quantity?: number[],
  period?: number[],
  period_unit?: (day | week | month | year)[],
  included_in_mrr?: boolean[],
  item_price_id?: string[]
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `ramp` | `object \| null` | No | A `ramp` resource, or subscription ramp, represents a planned change to a [`subscription`](https://docs.corsair.dev/docs/api/subscriptions) that occurs at a future date. Use this resource to define and schedule subscription modifications, such as updating pricing, altering quantity, or transitioning to a different plan, without immediately applying them. **Note** \* **Upcoming ramps limit** : A subscription can have a maximum of 12 upcoming ramps at any given time, excluding deleted ramps. Upcoming ramps are ramps with `status` as [`scheduled`](https://docs.corsair.dev/docs/api/ramps/ramp-object#status). \* **Total ramps limit**: A subscription can have a maximum of 100 ramps at any given time, excluding deleted ramps. #### Auto-draft conditions When you create or update a ramp, Chargebee automatically moves any existing ramps scheduled after that ramp to `draft` status if either of the following conditions is met: \* The new or updated ramp changes the subscription [term end date](subscriptions#subscription_current_term_end). \* The new or updated ramp changes the subscription billing frequency. That is, either of the following [attributes](subscriptions#subscription_items) is changed: \* `subscription_items[i].billing_period` \* `subscription_items[i].billing_period_unit` \* where `i` is the index where `subscription_items[i].item_type` is `plan`. \* The new or updated ramp introduces an [addon](item_prices#item_price_item_type) that is not [applicable](attached_items) to the plan in one or more of the subsequent ramps. |

```ts theme={null}
{
  id?: string | null,
  description?: string | null,
  subscription_id?: string | null,
  effective_from?: number | null,
  status?: string | null,
  created_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  items_to_remove?: string[] | null,
  coupons_to_remove?: string[] | null,
  discounts_to_remove?: string[] | null,
  deleted?: boolean | null,
  items_to_add?: {
    item_price_id?: string | null,
    item_type?: string | null,
    quantity?: number | null,
    quantity_in_decimal?: string | null,
    unit_price?: number | null,
    unit_price_in_decimal?: string | null,
    amount?: number | null,
    amount_in_decimal?: string | null,
    free_quantity?: number | null,
    free_quantity_in_decimal?: string | null,
    billing_cycles?: number | null,
    service_period_days?: number | null,
    metered_quantity?: string | null,
    charge_once?: boolean | null,
    charge_on_option?: string | null,
    description?: string | null,
    charge_on_event?: string | null
  }[] | null,
  items_to_update?: {
    item_price_id?: string | null,
    item_type?: string | null,
    quantity?: number | null,
    quantity_in_decimal?: string | null,
    unit_price?: number | null,
    unit_price_in_decimal?: string | null,
    amount?: number | null,
    amount_in_decimal?: string | null,
    free_quantity?: number | null,
    free_quantity_in_decimal?: string | null,
    billing_cycles?: number | null,
    service_period_days?: number | null,
    metered_quantity?: string | null,
    charge_once?: boolean | null,
    charge_on_option?: string | null,
    description?: string | null,
    charge_on_event?: string | null
  }[] | null,
  coupons_to_add?: {
    coupon_id?: string | null,
    apply_till?: number | null
  }[] | null,
  discounts_to_add?: {
    id?: string | null,
    invoice_name?: string | null,
    type?: string | null,
    percentage?: number | null,
    amount?: number | null,
    quantity?: number | null,
    duration_type?: string | null,
    period?: number | null,
    period_unit?: string | null,
    included_in_mrr?: boolean | null,
    apply_on?: string | null,
    item_price_id?: string | null,
    created_at?: number | null
  }[] | null,
  item_tiers?: {
    item_price_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    price?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    price_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null,
    index?: number | null
  }[] | null,
  contract_term?: {
    cancellation_cutoff_period?: number | null,
    renewal_billing_cycles?: number | null,
    action_at_term_end?: string | null
  } | null,
  billing_configuration?: {
    po_number?: string | null
  } | null,
  status_transition_reason?: {
    code?: string | null,
    message?: string | null
  } | null,
  entitlement_overrides_to_add?: {
    entity_id?: string | null,
    entity_type?: string | null,
    feature_id?: string | null,
    value?: string | null,
    is_enabled?: boolean | null
  }[] | null,
  entitlement_overrides_to_update?: {
    entity_id?: string | null,
    entity_type?: string | null,
    feature_id?: string | null,
    value?: string | null,
    is_enabled?: boolean | null
  }[] | null,
  entitlement_overrides_to_remove?: {
    entity_id?: string | null,
    entity_type?: string | null,
    feature_id?: string | null
  }[] | null,
  credit_unit_grants_to_add?: {
    entity_id?: string | null,
    entity_type?: string | null,
    unit_id?: string | null,
    unit_type?: string | null,
    is_enabled?: boolean | null,
    grant_policies?: any[] | null
  }[] | null,
  credit_unit_grants_to_update?: {
    entity_id?: string | null,
    entity_type?: string | null,
    unit_id?: string | null,
    unit_type?: string | null,
    is_enabled?: boolean | null,
    grant_policies?: any[] | null
  }[] | null,
  credit_unit_grants_to_remove?: {
    entity_id?: string | null,
    entity_type?: string | null,
    unit_id?: string | null,
    unit_type?: string | null
  }[] | null
} | null
```

***

### createUsage

`subscriptions.createUsage`

Advanced Usage-Based Billing For high-scale usage ingestion, use Advanced Usage-Based Billing with the Usage Events API. The Usage Events API supports schemaless event ingestion at scale, including individual events, batch ingestion, and usage file ingestion.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.subscriptions.createUsage({
	subscriptionId: 'sub_8gsnbYfsMLds',
	item_price_id: 'example',
	quantity: 'example',
	usage_date: 1,
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `id` | `string` | No | A unique and immutable id for the usage. If not provided, it is autogenerated. |
| `item_price_id` | `string` | Yes | The id of the [item price](https://docs.corsair.dev/docs/api/item_prices) to which this usage belongs. The item price must be a part of the subscription or should have been part of it historically. |
| `quantity` | `string` | Yes | The quantity specified for this usage record. |
| `usage_date` | `number` | Yes | The time at which this usage occurred. Chargebee bills only those usages whose `usage_date` falls within a time when the subscription `status` was `active` or `non_renewing`. However, the remaining usage records are still stored and are [retrievable](https://docs.corsair.dev/docs/api/usages/retrieve-a-usage). **Note:** If `usage_date` corresponds to a time already invoiced, then it is stored but never invoiced unless the [invoice is regenerated](https://docs.corsair.dev/docs/api/subscriptions/regenerate-an-invoice) . |
| `note` | `string` | No | A note for this usage record. This note is not displayed on any customer-facing document or interface such as [invoice PDFs](https://docs.corsair.dev/docs/api/invoices/retrieve-invoice-as-pdf) or [Hosted Pages](https://docs.corsair.dev/docs/api/hosted_pages) . |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `usage` | `object \| null` | No | **Advanced Usage-Based Billing** For high-scale usage ingestion, use [Advanced Usage-Based Billing](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/understanding-usages) with the [Usage Events API](https://docs.corsair.dev/docs/api/usage_events). The Usage Events API supports schemaless event ingestion at scale, including [individual events](https://docs.corsair.dev/docs/api/usage_events/create-a-usage-event), [batch ingestion](https://docs.corsair.dev/docs/api/usage_events/ingest-usages-in-batch), and [usage file ingestion](https://docs.corsair.dev/docs/api/usage_files/usage-file-object). The Usages API is used to record usage for metered item prices in a subscription. This API is only applicable when Automated Metered Billing is enabled in Chargebee. Metered items are those that are billed based on the service usage. Common examples include: \* Internet data services. \* SMS send/receive services. \* API services that are billed for the number of API calls made, say, per month. An [item](https://docs.corsair.dev/docs/api/items) is marked metered by setting its `metered` attribute as `true`. Only recurring items can be can be set as `metered`. Recurring items are those of `type` `plan` or `addon`. A subscription can have both metered and non-metered items. The usages API (described in this page), is used to add, retrieve and delete usages for the metered items in a subscription. #### Invoicing Metered Item Prices While non-metered items are invoiced in a prepaid manner at the beginning of each billing cycle; for metered items, the charges are raised at the end of the billing term (postpaid). During the course of the billing period, [usages can be added](https://docs.corsair.dev/docs/api/usages/create-a-usage) as and when they occur. For a given `subscription_id` and `item_price_id`, there can be only one usage record for a specific `usage_date`. At the end of each term, the invoice is generated with `status` as `pending`. Any remaining usage records can continue to be added to the subscription until the invoice [closes automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or is [closed via an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). If a usage record has erroneous information and you want to correct it, [delete the usage](https://docs.corsair.dev/docs/api/usages/delete-a-usage) and add it again. **Max Usages** \* Legacy metered billing applies per-subscription usage limits over the subscription lifetime. [Contact 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) for the limit applicable to your site or to request an increase. For high-volume usage at scale, see [Usage-Based Billing](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/understanding-usages). \* If there are no usages for an item price, the item price is not invoiced. |

```ts theme={null}
{
  id?: string | null,
  usage_date?: number | null,
  subscription_id?: string | null,
  item_price_id?: string | null,
  invoice_id?: string | null,
  line_item_id?: string | null,
  quantity?: string | null,
  source?: string | null,
  note?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  created_at?: number | null
} | null
```

***

### delete

`subscriptions.delete`

Delete a subscription. Deletes a specified subscription. This operation schedules the subscription resource for deletion, and it is permanently deleted after a few minutes. If you wish to retain the subscription data but stop further renewals, consider canceling or pausing the subscription instead.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.subscriptions.delete({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `subscription` | `object \| null` | No | A Chargebee subscription connects a customer record to products/services. It describes what the customer has signed up for and how often they're charged for it. The essential components of a subscription are: \* A [plan-item price](https://docs.corsair.dev/docs/api/item_prices). \* Any addon- and charge-item prices applied to the subscription. \* Any [coupons](https://docs.corsair.dev/docs/api/coupons) applied. \* Any [discounts](https://docs.corsair.dev/docs/api/discounts) applied. The charges in a subscription are billed via invoices. **Note:** The maximum number of subscriptions for any given [customer](https://docs.corsair.dev/docs/api/customers) ([active](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#status) or not) is 900. #### Subscription billing frequencies Chargebee offers two billing frequency options for subscriptions: \* **Plan-based billing** (`default`): Subscriptions are billed based on the billing period defined for the item price of the `item_type` `plan`. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/subscriptions#plan-based-billing). \* **Multi-frequency billing** : Subscriptions are billed according to the billing period of each recurring item price within the subscription. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing). **Important** [Limitations](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing#limitations) of Multi-frequency billing. The selection of the billing frequency preference is configured at the site level. #### Item price compatibility in a subscription When creating or updating a subscription, one of the item prices specified under subscription\_items must be a plan-item price. The remaining must be compatible addon- or charge-item prices. An item price is compatible with a plan-item price if their currencies are the same. Additionally, an addon-item price is compatible with a plan-item price only if their billing frequencies meet the following conditions: \| `period_unit` for plan-item price \| Compatible `period_unit` for addon-item price \| Compatible period for addon-item price \| \|-----------------------------------\|-----------------------------------------------\|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `day` \| `day` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `10`, then the period of the addon-item price can be `10`, `5`, `2`, or `1`. \| \| `week` \| `week` or `day` \| The `period` (in days) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the period of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `week`, `period` can be `2` or `1`. \* for `period_unit` as `day`, `period` can be `14`, `7`, `2`, or `1`. \| \| `month` \| `month` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `6`, then the `period` of the addon-item price can be `6`, `3`, `2`, or `1`. \| \| `year` \| `year` or `month` \| The `period` (in months) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the `period` of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `year`, `period` can be `2` or `1`. \* for `period_unit` as `month`, `period` can be `24`, `12`, `8`, `6`, `4`, `3`, `2`, or `1`. \| #### Tax provider fields **Avalara** : Merchants using **Avalara Sales Tax** can optionally associate each item price with a locationCode (from their Avalara company locations), so tax can be resolved correctly at the line item level. \| Field ID \| Field Value \| APIs \| \|--------------------------------------------------------------------------------\|----------------------------------------------------------------------\|--------------------------------------------------------------------------------\| \| `locationCode` \| Merchant to configure it on Avalara Platform under company locations \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| **Anrok**: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation \| Field ID \| Field Value \| APIs \| \|---------------------------------------------------------------------------------------------------------------------------------------\|---------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------\| \| `additionalTaxRegistrationNumber` \| Canadian tax registration numbers in comma separated fashion. \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| **Vertex**: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration **Note:** Field Id like `customerCode` , `customerClass` , and`taxExempted` belong to the customer object. Field Id like `productCode` , `productClass` , `productTaxCode` , and `productClass` belong to the product object. \| Field ID \| Field Value \| APIs \| \|-----------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productCode` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `customerCode` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `customerClass` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **Taxamo:** Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration \| Field Id \| Field Value \| APIs \| \|------------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productTaxCode` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `taxExempted` \| Merchant to configure it on Taxamo Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **cbtaxes**: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India. \| Field ID \| Field Value \| APIs \| \|---------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `indiaSez` \| `SEZ_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaSez` \| `SEZ_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **All**: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level \| Field ID \| Field Value \| APIs \| \|-------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `priceType` \| `TAX_INCLUSIVE` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| \| `TAX_EXCLUSIVE` \| \| \| \| `SITE_DEFAULT` or blank \| Removes price type override, and allows site level configuration to be used for tax calculation. \| #### Ramps API compatibility mode If you want to schedule changes on a subscription, use the [Ramps API](https://docs.corsair.dev/docs/api/ramps). If you are currently scheduling changes through the [Update subscription API](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items), migrate to the Ramps API. To get started, [request access for Subscription Ramps](https://app.chargebee.com/login?forward=https://app.chargebee.com/request_access/subscription-ramps\&ref=feature). Chargebee will enable Ramps compatibility mode for your site. Once enabled, you can test the Ramps API without impacting your existing integrations. The following parts of the Billing API have subtle differences in behavior when the Ramps feature is disabled versus when it is enabled with compatibility mode. (Follow the links to learn more.) \* The value of the [`subscription.has_scheduled_changes`](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#has_scheduled_changes) attribute. \* [Update subscription](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#impact-scheduled-changes) \* [Create Checkout for updating a subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription#impact-scheduled-changes) \* [Remove scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/remove-scheduled-changes) \* [Retrieve with scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/retrieve-with-scheduled-changes) \* [Create a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/create-a-quote-for-update-subscription-items) \* [Edit a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/edit-update-subscription-quote-for-items) \* [Portal sessions](https://docs.corsair.dev/docs/api/portal_sessions#scheduled-subscription-changes) |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |

```ts theme={null}
{
  id?: string | null,
  currency_code?: string | null,
  billing_period?: number | null,
  billing_period_unit?: string | null,
  start_date?: number | null,
  trial_end?: number | null,
  remaining_billing_cycles?: number | null,
  po_number?: string | null,
  auto_collection?: string | null,
  plan_quantity_in_decimal?: string | null,
  plan_unit_price_in_decimal?: string | null,
  customer_id?: string | null,
  status?: string | null,
  trial_start?: number | null,
  trial_end_action?: string | null,
  current_term_start?: number | null,
  current_term_end?: number | null,
  next_billing_at?: number | null,
  created_at?: number | null,
  started_at?: number | null,
  activated_at?: number | null,
  contract_term_billing_cycle_on_renewal?: number | null,
  override_relationship?: boolean | null,
  pause_date?: number | null,
  resume_date?: number | null,
  cancelled_at?: number | null,
  cancel_reason?: string | null,
  created_from_ip?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  has_scheduled_advance_invoices?: boolean | null,
  has_scheduled_changes?: boolean | null,
  payment_source_id?: string | null,
  plan_free_quantity_in_decimal?: string | null,
  plan_amount_in_decimal?: string | null,
  cancel_schedule_created_at?: number | null,
  offline_payment_method?: string | null,
  channel?: string | null,
  net_term_days?: number | null,
  active_id?: string | null,
  due_invoices_count?: number | null,
  due_since?: number | null,
  total_dues?: number | null,
  mrr?: number | null,
  exchange_rate?: number | null,
  base_currency_code?: string | null,
  invoice_notes?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  changes_scheduled_at?: number | null,
  cancel_reason_code?: string | null,
  free_period?: number | null,
  free_period_unit?: string | null,
  create_pending_invoices?: boolean | null,
  auto_close_invoices?: boolean | null,
  business_entity_id?: string | null,
  decommissioned?: boolean | null,
  brand_id?: string | null,
  subscription_items?: {
    item_price_id?: string | null,
    item_type?: string | null,
    quantity?: number | null,
    quantity_in_decimal?: string | null,
    unit_price?: number | null,
    unit_price_in_decimal?: string | null,
    amount?: number | null,
    current_term_start?: number | null,
    current_term_end?: number | null,
    next_billing_at?: number | null,
    amount_in_decimal?: string | null,
    billing_period?: number | null,
    billing_period_unit?: string | null,
    free_quantity?: number | null,
    free_quantity_in_decimal?: string | null,
    trial_end?: number | null,
    billing_cycles?: number | null,
    service_period_days?: number | null,
    charge_on_event?: string | null,
    charge_once?: boolean | null,
    charge_on_option?: string | null,
    proration_type?: string | null,
    usage_accumulation_reset_frequency?: string | null,
    description?: string | null
  }[] | null,
  item_tiers?: {
    item_price_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    price?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    price_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null,
    index?: number | null
  }[] | null,
  charged_items?: {
    item_price_id?: string | null,
    last_charged_at?: number | null
  }[] | null,
  coupons?: {
    coupon_id?: string | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_code?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_info?: {
    referral_code?: string | null,
    coupon_code?: string | null,
    referrer_id?: string | null,
    external_reference_id?: string | null,
    reward_status?: string | null,
    referral_system?: string | null,
    account_id?: string | null,
    campaign_id?: string | null,
    external_campaign_id?: string | null,
    friend_offer_type?: string | null,
    referrer_reward_type?: string | null,
    notify_referral_system?: string | null,
    destination_url?: string | null,
    post_purchase_widget_enabled?: boolean | null
  } | null,
  billing_override?: {
    max_excess_payment_usage?: number | null,
    max_refundable_credits_usage?: number | null
  } | null,
  contract_term?: {
    id?: string | null,
    status?: string | null,
    contract_start?: number | null,
    contract_end?: number | null,
    billing_cycle?: number | null,
    action_at_term_end?: string | null,
    total_contract_value?: number | null,
    total_contract_value_before_tax?: number | null,
    cancellation_cutoff_period?: number | null,
    created_at?: number | null,
    subscription_id?: string | null,
    remaining_billing_cycles?: number | null
  } | null,
  discounts?: {
    id?: string | null,
    invoice_name?: string | null,
    description?: string | null,
    type?: string | null,
    percentage?: number | null,
    amount?: number | null,
    quantity?: number | null,
    currency_code?: string | null,
    duration_type?: string | null,
    period?: number | null,
    period_unit?: string | null,
    included_in_mrr?: boolean | null,
    apply_on?: string | null,
    item_price_id?: string | null,
    created_at?: number | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_id?: string | null,
    index?: number | null
  }[] | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  email?: string | null,
  phone?: string | null,
  company?: string | null,
  vat_number?: string | null,
  auto_collection?: string | null,
  offline_payment_method?: string | null,
  net_term_days?: number | null,
  vat_number_validated_time?: number | null,
  vat_number_status?: string | null,
  allow_direct_debit?: boolean | null,
  is_location_valid?: boolean | null,
  created_at?: number | null,
  created_from_ip?: string | null,
  exemption_details?: any[] | null,
  taxability?: string | null,
  entity_code?: string | null,
  exempt_number?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  locale?: string | null,
  billing_date?: number | null,
  billing_month?: number | null,
  billing_date_mode?: string | null,
  billing_day_of_week?: string | null,
  billing_day_of_week_mode?: string | null,
  pii_cleared?: string | null,
  auto_close_invoices?: boolean | null,
  channel?: string | null,
  active_id?: string | null,
  fraud_flag?: string | null,
  primary_payment_source_id?: string | null,
  backup_payment_source_id?: string | null,
  invoice_notes?: string | null,
  business_entity_id?: string | null,
  preferred_currency_code?: string | null,
  promotional_credits?: number | null,
  unbilled_charges?: number | null,
  refundable_credits?: number | null,
  excess_payments?: number | null,
  is_einvoice_enabled?: boolean | null,
  einvoicing_method?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  registered_for_gst?: boolean | null,
  consolidated_invoicing?: boolean | null,
  customer_type?: string | null,
  business_customer_without_vat_number?: boolean | null,
  client_profile_id?: string | null,
  use_default_hierarchy_settings?: boolean | null,
  vat_number_prefix?: string | null,
  entity_identifier_scheme?: string | null,
  entity_identifier_standard?: string | null,
  brand_id?: string | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_urls?: {
    external_customer_id?: string | null,
    referral_sharing_url?: string | null,
    created_at?: number | null,
    updated_at?: number | null,
    referral_campaign_id?: string | null,
    referral_account_id?: string | null,
    referral_external_campaign_id?: string | null,
    referral_system?: string | null
  }[] | null,
  contacts?: {
    id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    phone?: string | null,
    label?: string | null,
    enabled?: boolean | null,
    send_account_email?: boolean | null,
    send_billing_email?: boolean | null
  }[] | null,
  payment_method?: {
    type?: string | null,
    gateway?: string | null,
    gateway_account_id?: string | null,
    status?: string | null,
    reference_id?: string | null
  } | null,
  balances?: {
    promotional_credits?: number | null,
    excess_payments?: number | null,
    refundable_credits?: number | null,
    unbilled_charges?: number | null,
    currency_code?: string | null,
    business_entity_id?: string | null
  }[] | null,
  entity_identifiers?: {
    id?: string | null,
    value?: string | null,
    scheme?: string | null,
    standard?: string | null
  }[] | null,
  tax_providers_fields?: {
    provider_name?: string | null,
    field_id?: string | null,
    field_value?: string | null
  }[] | null,
  relationship?: {
    parent_id?: string | null,
    payment_owner_id?: string | null,
    invoice_owner_id?: string | null
  } | null,
  parent_account_access?: {
    portal_edit_child_subscriptions?: string | null,
    portal_download_child_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null,
  child_account_access?: {
    portal_edit_subscriptions?: string | null,
    portal_download_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null
} | null
```

```ts theme={null}
{
  payment_source_id?: string | null,
  status?: string | null,
  gateway?: string | null,
  gateway_account_id?: string | null,
  ref_tx_id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  iin?: string | null,
  last4?: string | null,
  card_type?: string | null,
  funding_type?: string | null,
  expiry_month?: number | null,
  expiry_year?: number | null,
  issuing_country?: string | null,
  billing_addr1?: string | null,
  billing_addr2?: string | null,
  billing_city?: string | null,
  billing_state_code?: string | null,
  billing_state?: string | null,
  billing_country?: string | null,
  billing_zip?: string | null,
  created_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  ip_address?: string | null,
  powered_by?: string | null,
  customer_id?: string | null,
  masked_number?: string | null
} | null
```

***

### deleteUsage

`subscriptions.deleteUsage`

Advanced Usage-Based Billing For high-scale usage ingestion, use Advanced Usage-Based Billing with the Usage Events API. The Usage Events API supports schemaless event ingestion at scale, including individual events, batch ingestion, and usage file ingestion. Deletes a usage record.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.subscriptions.deleteUsage({ subscriptionId: 'sub_8gsnbYfsMLds', id: 'cust_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `id` | `string` | Yes | A unique and immutable id for the usage. If not provided, it is autogenerated. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `usage` | `object \| null` | No | **Advanced Usage-Based Billing** For high-scale usage ingestion, use [Advanced Usage-Based Billing](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/understanding-usages) with the [Usage Events API](https://docs.corsair.dev/docs/api/usage_events). The Usage Events API supports schemaless event ingestion at scale, including [individual events](https://docs.corsair.dev/docs/api/usage_events/create-a-usage-event), [batch ingestion](https://docs.corsair.dev/docs/api/usage_events/ingest-usages-in-batch), and [usage file ingestion](https://docs.corsair.dev/docs/api/usage_files/usage-file-object). The Usages API is used to record usage for metered item prices in a subscription. This API is only applicable when Automated Metered Billing is enabled in Chargebee. Metered items are those that are billed based on the service usage. Common examples include: \* Internet data services. \* SMS send/receive services. \* API services that are billed for the number of API calls made, say, per month. An [item](https://docs.corsair.dev/docs/api/items) is marked metered by setting its `metered` attribute as `true`. Only recurring items can be can be set as `metered`. Recurring items are those of `type` `plan` or `addon`. A subscription can have both metered and non-metered items. The usages API (described in this page), is used to add, retrieve and delete usages for the metered items in a subscription. #### Invoicing Metered Item Prices While non-metered items are invoiced in a prepaid manner at the beginning of each billing cycle; for metered items, the charges are raised at the end of the billing term (postpaid). During the course of the billing period, [usages can be added](https://docs.corsair.dev/docs/api/usages/create-a-usage) as and when they occur. For a given `subscription_id` and `item_price_id`, there can be only one usage record for a specific `usage_date`. At the end of each term, the invoice is generated with `status` as `pending`. Any remaining usage records can continue to be added to the subscription until the invoice [closes automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or is [closed via an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). If a usage record has erroneous information and you want to correct it, [delete the usage](https://docs.corsair.dev/docs/api/usages/delete-a-usage) and add it again. **Max Usages** \* Legacy metered billing applies per-subscription usage limits over the subscription lifetime. [Contact 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) for the limit applicable to your site or to request an increase. For high-volume usage at scale, see [Usage-Based Billing](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/understanding-usages). \* If there are no usages for an item price, the item price is not invoiced. |

```ts theme={null}
{
  id?: string | null,
  usage_date?: number | null,
  subscription_id?: string | null,
  item_price_id?: string | null,
  invoice_id?: string | null,
  line_item_id?: string | null,
  quantity?: string | null,
  source?: string | null,
  note?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  created_at?: number | null
} | null
```

***

### editAdvanceInvoiceSchedule

`subscriptions.editAdvanceInvoiceSchedule`

Edit advance invoice schedule. Caution This API will return an error when multi-frequency billing is enabled. Modifies the advance invoicing schedule for a subscription.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.subscriptions.editAdvanceInvoiceSchedule({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `terms_to_charge` | `number` | No | The number of billing cycles in one interval. |
| `schedule_type` | `specific_dates \| fixed_intervals` | No | The type of advance invoice or advance invoicing schedule. \* specific\_dates - Charge on [specific dates](https://docs.corsair.dev/docs/api/subscriptions/charge-future-renewals#specific_dates_schedule_date). For each date, specify the [number of billing cycles](https://docs.corsair.dev/docs/api/subscriptions/charge-future-renewals#specific_dates_schedule_terms_to_charge) to charge for. Up to 5 dates can be configured. \* fixed\_intervals - Charge at fixed intervals of time. Specify the [number of billing cycles](https://docs.corsair.dev/docs/api/subscriptions/charge-future-renewals#terms_to_charge) that constitute an interval and the number of [days before each interval](https://docs.corsair.dev/docs/api/subscriptions/charge-future-renewals#fixed_interval_schedule_days_before_renewal) that the invoice should be generated. Also specify [when the schedule should end](https://docs.corsair.dev/docs/api/subscriptions/charge-future-renewals#fixed_interval_schedule_end_schedule_on) . |
| `fixed_interval_schedule` | `object` | No | Parameters for fixed\_interval\_schedule |
| `specific_dates_schedule` | `object` | No | Parameters for specific\_dates\_schedule |

```ts theme={null}
{
  number_of_occurrences?: number,
  days_before_renewal?: number,
  end_schedule_on?: after_number_of_intervals | specific_date | subscription_end,
  end_date?: number
}
```

```ts theme={null}
{
  id?: string[],
  terms_to_charge?: number[],
  date?: number[]
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `advance_invoice_schedules` | `object[] \| null` | No | Resource object representing advance\_invoice\_schedule |

```ts theme={null}
{
  id?: string | null,
  schedule_type?: string | null,
  fixed_interval_schedule?: {
    end_schedule_on?: string | null,
    number_of_occurrences?: number | null,
    days_before_renewal?: number | null,
    end_date?: number | null,
    created_at?: number | null,
    terms_to_charge?: number | null
  } | null,
  specific_dates_schedule?: {
    terms_to_charge?: number | null,
    date?: number | null,
    created_at?: number | null
  } | null
}[] | null
```

***

### get

`subscriptions.get`

Retrieve a subscription. Retrieves a subscription.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.subscriptions.get({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `subscription` | `object \| null` | No | A Chargebee subscription connects a customer record to products/services. It describes what the customer has signed up for and how often they're charged for it. The essential components of a subscription are: \* A [plan-item price](https://docs.corsair.dev/docs/api/item_prices). \* Any addon- and charge-item prices applied to the subscription. \* Any [coupons](https://docs.corsair.dev/docs/api/coupons) applied. \* Any [discounts](https://docs.corsair.dev/docs/api/discounts) applied. The charges in a subscription are billed via invoices. **Note:** The maximum number of subscriptions for any given [customer](https://docs.corsair.dev/docs/api/customers) ([active](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#status) or not) is 900. #### Subscription billing frequencies Chargebee offers two billing frequency options for subscriptions: \* **Plan-based billing** (`default`): Subscriptions are billed based on the billing period defined for the item price of the `item_type` `plan`. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/subscriptions#plan-based-billing). \* **Multi-frequency billing** : Subscriptions are billed according to the billing period of each recurring item price within the subscription. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing). **Important** [Limitations](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing#limitations) of Multi-frequency billing. The selection of the billing frequency preference is configured at the site level. #### Item price compatibility in a subscription When creating or updating a subscription, one of the item prices specified under subscription\_items must be a plan-item price. The remaining must be compatible addon- or charge-item prices. An item price is compatible with a plan-item price if their currencies are the same. Additionally, an addon-item price is compatible with a plan-item price only if their billing frequencies meet the following conditions: \| `period_unit` for plan-item price \| Compatible `period_unit` for addon-item price \| Compatible period for addon-item price \| \|-----------------------------------\|-----------------------------------------------\|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `day` \| `day` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `10`, then the period of the addon-item price can be `10`, `5`, `2`, or `1`. \| \| `week` \| `week` or `day` \| The `period` (in days) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the period of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `week`, `period` can be `2` or `1`. \* for `period_unit` as `day`, `period` can be `14`, `7`, `2`, or `1`. \| \| `month` \| `month` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `6`, then the `period` of the addon-item price can be `6`, `3`, `2`, or `1`. \| \| `year` \| `year` or `month` \| The `period` (in months) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the `period` of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `year`, `period` can be `2` or `1`. \* for `period_unit` as `month`, `period` can be `24`, `12`, `8`, `6`, `4`, `3`, `2`, or `1`. \| #### Tax provider fields **Avalara** : Merchants using **Avalara Sales Tax** can optionally associate each item price with a locationCode (from their Avalara company locations), so tax can be resolved correctly at the line item level. \| Field ID \| Field Value \| APIs \| \|--------------------------------------------------------------------------------\|----------------------------------------------------------------------\|--------------------------------------------------------------------------------\| \| `locationCode` \| Merchant to configure it on Avalara Platform under company locations \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| **Anrok**: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation \| Field ID \| Field Value \| APIs \| \|---------------------------------------------------------------------------------------------------------------------------------------\|---------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------\| \| `additionalTaxRegistrationNumber` \| Canadian tax registration numbers in comma separated fashion. \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| **Vertex**: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration **Note:** Field Id like `customerCode` , `customerClass` , and`taxExempted` belong to the customer object. Field Id like `productCode` , `productClass` , `productTaxCode` , and `productClass` belong to the product object. \| Field ID \| Field Value \| APIs \| \|-----------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productCode` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `customerCode` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `customerClass` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **Taxamo:** Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration \| Field Id \| Field Value \| APIs \| \|------------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productTaxCode` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `taxExempted` \| Merchant to configure it on Taxamo Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **cbtaxes**: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India. \| Field ID \| Field Value \| APIs \| \|---------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `indiaSez` \| `SEZ_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaSez` \| `SEZ_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **All**: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level \| Field ID \| Field Value \| APIs \| \|-------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `priceType` \| `TAX_INCLUSIVE` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| \| `TAX_EXCLUSIVE` \| \| \| \| `SITE_DEFAULT` or blank \| Removes price type override, and allows site level configuration to be used for tax calculation. \| #### Ramps API compatibility mode If you want to schedule changes on a subscription, use the [Ramps API](https://docs.corsair.dev/docs/api/ramps). If you are currently scheduling changes through the [Update subscription API](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items), migrate to the Ramps API. To get started, [request access for Subscription Ramps](https://app.chargebee.com/login?forward=https://app.chargebee.com/request_access/subscription-ramps\&ref=feature). Chargebee will enable Ramps compatibility mode for your site. Once enabled, you can test the Ramps API without impacting your existing integrations. The following parts of the Billing API have subtle differences in behavior when the Ramps feature is disabled versus when it is enabled with compatibility mode. (Follow the links to learn more.) \* The value of the [`subscription.has_scheduled_changes`](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#has_scheduled_changes) attribute. \* [Update subscription](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#impact-scheduled-changes) \* [Create Checkout for updating a subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription#impact-scheduled-changes) \* [Remove scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/remove-scheduled-changes) \* [Retrieve with scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/retrieve-with-scheduled-changes) \* [Create a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/create-a-quote-for-update-subscription-items) \* [Edit a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/edit-update-subscription-quote-for-items) \* [Portal sessions](https://docs.corsair.dev/docs/api/portal_sessions#scheduled-subscription-changes) |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |

```ts theme={null}
{
  id?: string | null,
  currency_code?: string | null,
  billing_period?: number | null,
  billing_period_unit?: string | null,
  start_date?: number | null,
  trial_end?: number | null,
  remaining_billing_cycles?: number | null,
  po_number?: string | null,
  auto_collection?: string | null,
  plan_quantity_in_decimal?: string | null,
  plan_unit_price_in_decimal?: string | null,
  customer_id?: string | null,
  status?: string | null,
  trial_start?: number | null,
  trial_end_action?: string | null,
  current_term_start?: number | null,
  current_term_end?: number | null,
  next_billing_at?: number | null,
  created_at?: number | null,
  started_at?: number | null,
  activated_at?: number | null,
  contract_term_billing_cycle_on_renewal?: number | null,
  override_relationship?: boolean | null,
  pause_date?: number | null,
  resume_date?: number | null,
  cancelled_at?: number | null,
  cancel_reason?: string | null,
  created_from_ip?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  has_scheduled_advance_invoices?: boolean | null,
  has_scheduled_changes?: boolean | null,
  payment_source_id?: string | null,
  plan_free_quantity_in_decimal?: string | null,
  plan_amount_in_decimal?: string | null,
  cancel_schedule_created_at?: number | null,
  offline_payment_method?: string | null,
  channel?: string | null,
  net_term_days?: number | null,
  active_id?: string | null,
  due_invoices_count?: number | null,
  due_since?: number | null,
  total_dues?: number | null,
  mrr?: number | null,
  exchange_rate?: number | null,
  base_currency_code?: string | null,
  invoice_notes?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  changes_scheduled_at?: number | null,
  cancel_reason_code?: string | null,
  free_period?: number | null,
  free_period_unit?: string | null,
  create_pending_invoices?: boolean | null,
  auto_close_invoices?: boolean | null,
  business_entity_id?: string | null,
  decommissioned?: boolean | null,
  brand_id?: string | null,
  subscription_items?: {
    item_price_id?: string | null,
    item_type?: string | null,
    quantity?: number | null,
    quantity_in_decimal?: string | null,
    unit_price?: number | null,
    unit_price_in_decimal?: string | null,
    amount?: number | null,
    current_term_start?: number | null,
    current_term_end?: number | null,
    next_billing_at?: number | null,
    amount_in_decimal?: string | null,
    billing_period?: number | null,
    billing_period_unit?: string | null,
    free_quantity?: number | null,
    free_quantity_in_decimal?: string | null,
    trial_end?: number | null,
    billing_cycles?: number | null,
    service_period_days?: number | null,
    charge_on_event?: string | null,
    charge_once?: boolean | null,
    charge_on_option?: string | null,
    proration_type?: string | null,
    usage_accumulation_reset_frequency?: string | null,
    description?: string | null
  }[] | null,
  item_tiers?: {
    item_price_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    price?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    price_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null,
    index?: number | null
  }[] | null,
  charged_items?: {
    item_price_id?: string | null,
    last_charged_at?: number | null
  }[] | null,
  coupons?: {
    coupon_id?: string | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_code?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_info?: {
    referral_code?: string | null,
    coupon_code?: string | null,
    referrer_id?: string | null,
    external_reference_id?: string | null,
    reward_status?: string | null,
    referral_system?: string | null,
    account_id?: string | null,
    campaign_id?: string | null,
    external_campaign_id?: string | null,
    friend_offer_type?: string | null,
    referrer_reward_type?: string | null,
    notify_referral_system?: string | null,
    destination_url?: string | null,
    post_purchase_widget_enabled?: boolean | null
  } | null,
  billing_override?: {
    max_excess_payment_usage?: number | null,
    max_refundable_credits_usage?: number | null
  } | null,
  contract_term?: {
    id?: string | null,
    status?: string | null,
    contract_start?: number | null,
    contract_end?: number | null,
    billing_cycle?: number | null,
    action_at_term_end?: string | null,
    total_contract_value?: number | null,
    total_contract_value_before_tax?: number | null,
    cancellation_cutoff_period?: number | null,
    created_at?: number | null,
    subscription_id?: string | null,
    remaining_billing_cycles?: number | null
  } | null,
  discounts?: {
    id?: string | null,
    invoice_name?: string | null,
    description?: string | null,
    type?: string | null,
    percentage?: number | null,
    amount?: number | null,
    quantity?: number | null,
    currency_code?: string | null,
    duration_type?: string | null,
    period?: number | null,
    period_unit?: string | null,
    included_in_mrr?: boolean | null,
    apply_on?: string | null,
    item_price_id?: string | null,
    created_at?: number | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_id?: string | null,
    index?: number | null
  }[] | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  email?: string | null,
  phone?: string | null,
  company?: string | null,
  vat_number?: string | null,
  auto_collection?: string | null,
  offline_payment_method?: string | null,
  net_term_days?: number | null,
  vat_number_validated_time?: number | null,
  vat_number_status?: string | null,
  allow_direct_debit?: boolean | null,
  is_location_valid?: boolean | null,
  created_at?: number | null,
  created_from_ip?: string | null,
  exemption_details?: any[] | null,
  taxability?: string | null,
  entity_code?: string | null,
  exempt_number?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  locale?: string | null,
  billing_date?: number | null,
  billing_month?: number | null,
  billing_date_mode?: string | null,
  billing_day_of_week?: string | null,
  billing_day_of_week_mode?: string | null,
  pii_cleared?: string | null,
  auto_close_invoices?: boolean | null,
  channel?: string | null,
  active_id?: string | null,
  fraud_flag?: string | null,
  primary_payment_source_id?: string | null,
  backup_payment_source_id?: string | null,
  invoice_notes?: string | null,
  business_entity_id?: string | null,
  preferred_currency_code?: string | null,
  promotional_credits?: number | null,
  unbilled_charges?: number | null,
  refundable_credits?: number | null,
  excess_payments?: number | null,
  is_einvoice_enabled?: boolean | null,
  einvoicing_method?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  registered_for_gst?: boolean | null,
  consolidated_invoicing?: boolean | null,
  customer_type?: string | null,
  business_customer_without_vat_number?: boolean | null,
  client_profile_id?: string | null,
  use_default_hierarchy_settings?: boolean | null,
  vat_number_prefix?: string | null,
  entity_identifier_scheme?: string | null,
  entity_identifier_standard?: string | null,
  brand_id?: string | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_urls?: {
    external_customer_id?: string | null,
    referral_sharing_url?: string | null,
    created_at?: number | null,
    updated_at?: number | null,
    referral_campaign_id?: string | null,
    referral_account_id?: string | null,
    referral_external_campaign_id?: string | null,
    referral_system?: string | null
  }[] | null,
  contacts?: {
    id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    phone?: string | null,
    label?: string | null,
    enabled?: boolean | null,
    send_account_email?: boolean | null,
    send_billing_email?: boolean | null
  }[] | null,
  payment_method?: {
    type?: string | null,
    gateway?: string | null,
    gateway_account_id?: string | null,
    status?: string | null,
    reference_id?: string | null
  } | null,
  balances?: {
    promotional_credits?: number | null,
    excess_payments?: number | null,
    refundable_credits?: number | null,
    unbilled_charges?: number | null,
    currency_code?: string | null,
    business_entity_id?: string | null
  }[] | null,
  entity_identifiers?: {
    id?: string | null,
    value?: string | null,
    scheme?: string | null,
    standard?: string | null
  }[] | null,
  tax_providers_fields?: {
    provider_name?: string | null,
    field_id?: string | null,
    field_value?: string | null
  }[] | null,
  relationship?: {
    parent_id?: string | null,
    payment_owner_id?: string | null,
    invoice_owner_id?: string | null
  } | null,
  parent_account_access?: {
    portal_edit_child_subscriptions?: string | null,
    portal_download_child_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null,
  child_account_access?: {
    portal_edit_subscriptions?: string | null,
    portal_download_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null
} | null
```

```ts theme={null}
{
  payment_source_id?: string | null,
  status?: string | null,
  gateway?: string | null,
  gateway_account_id?: string | null,
  ref_tx_id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  iin?: string | null,
  last4?: string | null,
  card_type?: string | null,
  funding_type?: string | null,
  expiry_month?: number | null,
  expiry_year?: number | null,
  issuing_country?: string | null,
  billing_addr1?: string | null,
  billing_addr2?: string | null,
  billing_city?: string | null,
  billing_state_code?: string | null,
  billing_state?: string | null,
  billing_country?: string | null,
  billing_zip?: string | null,
  created_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  ip_address?: string | null,
  powered_by?: string | null,
  customer_id?: string | null,
  masked_number?: string | null
} | null
```

***

### getAdvanceInvoiceSchedule

`subscriptions.getAdvanceInvoiceSchedule`

Retrieve advance invoice. Caution \* This API will return an error when multi-frequency billing is enabled. Retrieves the *advance\_invoice\_schedule* for a subscription. Note that this endpoint is only applicable for *schedule\_type = specific\_dates* or fixed\_intervals.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.subscriptions.getAdvanceInvoiceSchedule({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `advance_invoice_schedules` | `object[] \| null` | No | Resource object representing advance\_invoice\_schedule |

```ts theme={null}
{
  id?: string | null,
  schedule_type?: string | null,
  fixed_interval_schedule?: {
    end_schedule_on?: string | null,
    number_of_occurrences?: number | null,
    days_before_renewal?: number | null,
    end_date?: number | null,
    created_at?: number | null,
    terms_to_charge?: number | null
  } | null,
  specific_dates_schedule?: {
    terms_to_charge?: number | null,
    date?: number | null,
    created_at?: number | null
  } | null
}[] | null
```

***

### getScheduledChanges

`subscriptions.getScheduledChanges`

Scheduled\_changes a subscription\_scheduled\_change.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.subscriptions.getScheduledChanges({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `subscription_scheduled_change` | `object \| null` | No | — |

```ts theme={null}
{
  action_type?: string | null,
  data?: string | null,
  created_at?: number | null,
  modified_at?: number | null
} | null
```

***

### getUsage

`subscriptions.getUsage`

Advanced Usage-Based Billing For high-scale usage ingestion, use Advanced Usage-Based Billing with the Usage Events API. The Usage Events API supports schemaless event ingestion at scale, including individual events, batch ingestion, and usage file ingestion.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.subscriptions.getUsage({ id: 'cust_8gsnbYfsMLds', subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | The unique identifier for the usage record to be retrieved. |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `usage` | `object \| null` | No | **Advanced Usage-Based Billing** For high-scale usage ingestion, use [Advanced Usage-Based Billing](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/understanding-usages) with the [Usage Events API](https://docs.corsair.dev/docs/api/usage_events). The Usage Events API supports schemaless event ingestion at scale, including [individual events](https://docs.corsair.dev/docs/api/usage_events/create-a-usage-event), [batch ingestion](https://docs.corsair.dev/docs/api/usage_events/ingest-usages-in-batch), and [usage file ingestion](https://docs.corsair.dev/docs/api/usage_files/usage-file-object). The Usages API is used to record usage for metered item prices in a subscription. This API is only applicable when Automated Metered Billing is enabled in Chargebee. Metered items are those that are billed based on the service usage. Common examples include: \* Internet data services. \* SMS send/receive services. \* API services that are billed for the number of API calls made, say, per month. An [item](https://docs.corsair.dev/docs/api/items) is marked metered by setting its `metered` attribute as `true`. Only recurring items can be can be set as `metered`. Recurring items are those of `type` `plan` or `addon`. A subscription can have both metered and non-metered items. The usages API (described in this page), is used to add, retrieve and delete usages for the metered items in a subscription. #### Invoicing Metered Item Prices While non-metered items are invoiced in a prepaid manner at the beginning of each billing cycle; for metered items, the charges are raised at the end of the billing term (postpaid). During the course of the billing period, [usages can be added](https://docs.corsair.dev/docs/api/usages/create-a-usage) as and when they occur. For a given `subscription_id` and `item_price_id`, there can be only one usage record for a specific `usage_date`. At the end of each term, the invoice is generated with `status` as `pending`. Any remaining usage records can continue to be added to the subscription until the invoice [closes automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or is [closed via an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). If a usage record has erroneous information and you want to correct it, [delete the usage](https://docs.corsair.dev/docs/api/usages/delete-a-usage) and add it again. **Max Usages** \* Legacy metered billing applies per-subscription usage limits over the subscription lifetime. [Contact 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) for the limit applicable to your site or to request an increase. For high-volume usage at scale, see [Usage-Based Billing](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/understanding-usages). \* If there are no usages for an item price, the item price is not invoiced. |

```ts theme={null}
{
  id?: string | null,
  usage_date?: number | null,
  subscription_id?: string | null,
  item_price_id?: string | null,
  invoice_id?: string | null,
  line_item_id?: string | null,
  quantity?: string | null,
  source?: string | null,
  note?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  created_at?: number | null
} | null
```

***

### getUsageCharges

`subscriptions.getUsageCharges`

Retrieve usage charges for a subscription. Returns the current, unbilled usage charges for the metered features on a subscription. This endpoint returns usage for each feature's current usage period.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.subscriptions.getUsageCharges({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `feature_id` | `object` | No | optional, string filter Unique identifier of the metered [feature](https://docs.corsair.dev/docs/api/features/feature-object#id) for which usage is tracked. **Supported operators :** is **Example →** *feature\_id\\\[is\\] = "fea-user-licenses"* |

```ts theme={null}
{
  is?: string
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

```ts theme={null}
{
  usage_charge?: {
    subscription_id?: string | null,
    feature_id?: string | null,
    included_usage?: string | null,
    total_usage?: string | null,
    on_demand_usage?: string | null,
    metered_item_price_id?: string | null,
    amount?: string | null,
    currency_code?: string | null,
    usage_from?: number | null,
    usage_to?: number | null
  } | null
}[] | null
```

***

### getUsageSummary

`subscriptions.getUsageSummary`

Retrieve usage summary for a subscription. Retrieves aggregated usage data for a metered feature in a subscription over a specified reporting window.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.subscriptions.getUsageSummary({ subscriptionId: 'sub_8gsnbYfsMLds', feature_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `feature_id` | `string` | Yes | Unique identifier of the metered [feature](https://docs.corsair.dev/docs/api/features/feature-object#id) for which usage is aggregated |
| `window_size` | `month \| week \| day \| hour \| minute` | No | Specifies the aggregation interval for the reporting window. If omitted, the response includes a single aggregate for the entire reporting window. \* day - Aggregates usage by day. \* minute - Aggregates usage by minute. \* hour - Aggregates usage by hour. \* month - Aggregates usage by month. \* week - Aggregates usage by week. |
| `timeframe_start` | `number` | No | Start of the reporting window, in Unix epoch seconds. If not provided, defaults to the start of the current subscription term. |
| `timeframe_end` | `number` | No | End of the reporting window, in Unix epoch seconds. If not provided, defaults to the current time |
| `group_by` | `string[]` | No | The group-by attributes used to group usage in each aggregation window. Each distinct set of group-by attribute values forms one group. The response returns each group as a separate `usage_summary` object and identifies it in the `attributes` list. The order of names in `group_by` is preserved in each `attributes` list. For example, specifying `region` before `gpu_type` returns `region` first and `gpu_type` second. This does not determine the order of the `usage_summary` objects. Use optional `attributes` filters to restrict usage before it is grouped for the response. Attribute filtering is available only for grouped usage requests, so include at least one `group_by` value. Each filtered attribute and each `group_by` attribute must be configured on the metered feature, but they do not have to be the same. **Prerequisites** \* The metered feature's `query` includes a `GROUP BY` clause. **Constraints** \* You can specify up to 5 group-by attributes. \* Each name is case-sensitive and must match a value in the metered feature's [`group_by`](https://docs.corsair.dev/docs/api/metered_features/metered-feature-object#group_by) attribute. |
| `attributes` | `object` | No | — |

```ts theme={null}
{
  not_in?: string,
  is_not?: string,
  is?: string,
  in?: string
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

```ts theme={null}
{
  usage_summary?: {
    subscription_id?: string | null,
    feature_id?: string | null,
    aggregated_value?: string | null,
    aggregated_from?: number | null,
    aggregated_to?: number | null,
    attributes?: any[] | null
  } | null
}[] | null
```

***

### getWithScheduledChanges

`subscriptions.getWithScheduledChanges`

Retrieve a subscription with scheduled changes. Note If the ramps feature is enabled and there is more than one ramp on a subscription, this API will return the subscription with the upcoming ramp applied. Retrieves a subscription with the scheduled changes applied.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.subscriptions.getWithScheduledChanges({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `subscription` | `object \| null` | No | A Chargebee subscription connects a customer record to products/services. It describes what the customer has signed up for and how often they're charged for it. The essential components of a subscription are: \* A [plan-item price](https://docs.corsair.dev/docs/api/item_prices). \* Any addon- and charge-item prices applied to the subscription. \* Any [coupons](https://docs.corsair.dev/docs/api/coupons) applied. \* Any [discounts](https://docs.corsair.dev/docs/api/discounts) applied. The charges in a subscription are billed via invoices. **Note:** The maximum number of subscriptions for any given [customer](https://docs.corsair.dev/docs/api/customers) ([active](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#status) or not) is 900. #### Subscription billing frequencies Chargebee offers two billing frequency options for subscriptions: \* **Plan-based billing** (`default`): Subscriptions are billed based on the billing period defined for the item price of the `item_type` `plan`. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/subscriptions#plan-based-billing). \* **Multi-frequency billing** : Subscriptions are billed according to the billing period of each recurring item price within the subscription. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing). **Important** [Limitations](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing#limitations) of Multi-frequency billing. The selection of the billing frequency preference is configured at the site level. #### Item price compatibility in a subscription When creating or updating a subscription, one of the item prices specified under subscription\_items must be a plan-item price. The remaining must be compatible addon- or charge-item prices. An item price is compatible with a plan-item price if their currencies are the same. Additionally, an addon-item price is compatible with a plan-item price only if their billing frequencies meet the following conditions: \| `period_unit` for plan-item price \| Compatible `period_unit` for addon-item price \| Compatible period for addon-item price \| \|-----------------------------------\|-----------------------------------------------\|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `day` \| `day` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `10`, then the period of the addon-item price can be `10`, `5`, `2`, or `1`. \| \| `week` \| `week` or `day` \| The `period` (in days) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the period of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `week`, `period` can be `2` or `1`. \* for `period_unit` as `day`, `period` can be `14`, `7`, `2`, or `1`. \| \| `month` \| `month` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `6`, then the `period` of the addon-item price can be `6`, `3`, `2`, or `1`. \| \| `year` \| `year` or `month` \| The `period` (in months) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the `period` of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `year`, `period` can be `2` or `1`. \* for `period_unit` as `month`, `period` can be `24`, `12`, `8`, `6`, `4`, `3`, `2`, or `1`. \| #### Tax provider fields **Avalara** : Merchants using **Avalara Sales Tax** can optionally associate each item price with a locationCode (from their Avalara company locations), so tax can be resolved correctly at the line item level. \| Field ID \| Field Value \| APIs \| \|--------------------------------------------------------------------------------\|----------------------------------------------------------------------\|--------------------------------------------------------------------------------\| \| `locationCode` \| Merchant to configure it on Avalara Platform under company locations \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| **Anrok**: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation \| Field ID \| Field Value \| APIs \| \|---------------------------------------------------------------------------------------------------------------------------------------\|---------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------\| \| `additionalTaxRegistrationNumber` \| Canadian tax registration numbers in comma separated fashion. \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| **Vertex**: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration **Note:** Field Id like `customerCode` , `customerClass` , and`taxExempted` belong to the customer object. Field Id like `productCode` , `productClass` , `productTaxCode` , and `productClass` belong to the product object. \| Field ID \| Field Value \| APIs \| \|-----------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productCode` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `customerCode` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `customerClass` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **Taxamo:** Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration \| Field Id \| Field Value \| APIs \| \|------------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productTaxCode` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `taxExempted` \| Merchant to configure it on Taxamo Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **cbtaxes**: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India. \| Field ID \| Field Value \| APIs \| \|---------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `indiaSez` \| `SEZ_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaSez` \| `SEZ_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **All**: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level \| Field ID \| Field Value \| APIs \| \|-------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `priceType` \| `TAX_INCLUSIVE` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| \| `TAX_EXCLUSIVE` \| \| \| \| `SITE_DEFAULT` or blank \| Removes price type override, and allows site level configuration to be used for tax calculation. \| #### Ramps API compatibility mode If you want to schedule changes on a subscription, use the [Ramps API](https://docs.corsair.dev/docs/api/ramps). If you are currently scheduling changes through the [Update subscription API](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items), migrate to the Ramps API. To get started, [request access for Subscription Ramps](https://app.chargebee.com/login?forward=https://app.chargebee.com/request_access/subscription-ramps\&ref=feature). Chargebee will enable Ramps compatibility mode for your site. Once enabled, you can test the Ramps API without impacting your existing integrations. The following parts of the Billing API have subtle differences in behavior when the Ramps feature is disabled versus when it is enabled with compatibility mode. (Follow the links to learn more.) \* The value of the [`subscription.has_scheduled_changes`](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#has_scheduled_changes) attribute. \* [Update subscription](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#impact-scheduled-changes) \* [Create Checkout for updating a subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription#impact-scheduled-changes) \* [Remove scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/remove-scheduled-changes) \* [Retrieve with scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/retrieve-with-scheduled-changes) \* [Create a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/create-a-quote-for-update-subscription-items) \* [Edit a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/edit-update-subscription-quote-for-items) \* [Portal sessions](https://docs.corsair.dev/docs/api/portal_sessions#scheduled-subscription-changes) |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |

```ts theme={null}
{
  id?: string | null,
  currency_code?: string | null,
  billing_period?: number | null,
  billing_period_unit?: string | null,
  start_date?: number | null,
  trial_end?: number | null,
  remaining_billing_cycles?: number | null,
  po_number?: string | null,
  auto_collection?: string | null,
  plan_quantity_in_decimal?: string | null,
  plan_unit_price_in_decimal?: string | null,
  customer_id?: string | null,
  status?: string | null,
  trial_start?: number | null,
  trial_end_action?: string | null,
  current_term_start?: number | null,
  current_term_end?: number | null,
  next_billing_at?: number | null,
  created_at?: number | null,
  started_at?: number | null,
  activated_at?: number | null,
  contract_term_billing_cycle_on_renewal?: number | null,
  override_relationship?: boolean | null,
  pause_date?: number | null,
  resume_date?: number | null,
  cancelled_at?: number | null,
  cancel_reason?: string | null,
  created_from_ip?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  has_scheduled_advance_invoices?: boolean | null,
  has_scheduled_changes?: boolean | null,
  payment_source_id?: string | null,
  plan_free_quantity_in_decimal?: string | null,
  plan_amount_in_decimal?: string | null,
  cancel_schedule_created_at?: number | null,
  offline_payment_method?: string | null,
  channel?: string | null,
  net_term_days?: number | null,
  active_id?: string | null,
  due_invoices_count?: number | null,
  due_since?: number | null,
  total_dues?: number | null,
  mrr?: number | null,
  exchange_rate?: number | null,
  base_currency_code?: string | null,
  invoice_notes?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  changes_scheduled_at?: number | null,
  cancel_reason_code?: string | null,
  free_period?: number | null,
  free_period_unit?: string | null,
  create_pending_invoices?: boolean | null,
  auto_close_invoices?: boolean | null,
  business_entity_id?: string | null,
  decommissioned?: boolean | null,
  brand_id?: string | null,
  subscription_items?: {
    item_price_id?: string | null,
    item_type?: string | null,
    quantity?: number | null,
    quantity_in_decimal?: string | null,
    unit_price?: number | null,
    unit_price_in_decimal?: string | null,
    amount?: number | null,
    current_term_start?: number | null,
    current_term_end?: number | null,
    next_billing_at?: number | null,
    amount_in_decimal?: string | null,
    billing_period?: number | null,
    billing_period_unit?: string | null,
    free_quantity?: number | null,
    free_quantity_in_decimal?: string | null,
    trial_end?: number | null,
    billing_cycles?: number | null,
    service_period_days?: number | null,
    charge_on_event?: string | null,
    charge_once?: boolean | null,
    charge_on_option?: string | null,
    proration_type?: string | null,
    usage_accumulation_reset_frequency?: string | null,
    description?: string | null
  }[] | null,
  item_tiers?: {
    item_price_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    price?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    price_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null,
    index?: number | null
  }[] | null,
  charged_items?: {
    item_price_id?: string | null,
    last_charged_at?: number | null
  }[] | null,
  coupons?: {
    coupon_id?: string | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_code?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_info?: {
    referral_code?: string | null,
    coupon_code?: string | null,
    referrer_id?: string | null,
    external_reference_id?: string | null,
    reward_status?: string | null,
    referral_system?: string | null,
    account_id?: string | null,
    campaign_id?: string | null,
    external_campaign_id?: string | null,
    friend_offer_type?: string | null,
    referrer_reward_type?: string | null,
    notify_referral_system?: string | null,
    destination_url?: string | null,
    post_purchase_widget_enabled?: boolean | null
  } | null,
  billing_override?: {
    max_excess_payment_usage?: number | null,
    max_refundable_credits_usage?: number | null
  } | null,
  contract_term?: {
    id?: string | null,
    status?: string | null,
    contract_start?: number | null,
    contract_end?: number | null,
    billing_cycle?: number | null,
    action_at_term_end?: string | null,
    total_contract_value?: number | null,
    total_contract_value_before_tax?: number | null,
    cancellation_cutoff_period?: number | null,
    created_at?: number | null,
    subscription_id?: string | null,
    remaining_billing_cycles?: number | null
  } | null,
  discounts?: {
    id?: string | null,
    invoice_name?: string | null,
    description?: string | null,
    type?: string | null,
    percentage?: number | null,
    amount?: number | null,
    quantity?: number | null,
    currency_code?: string | null,
    duration_type?: string | null,
    period?: number | null,
    period_unit?: string | null,
    included_in_mrr?: boolean | null,
    apply_on?: string | null,
    item_price_id?: string | null,
    created_at?: number | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_id?: string | null,
    index?: number | null
  }[] | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  email?: string | null,
  phone?: string | null,
  company?: string | null,
  vat_number?: string | null,
  auto_collection?: string | null,
  offline_payment_method?: string | null,
  net_term_days?: number | null,
  vat_number_validated_time?: number | null,
  vat_number_status?: string | null,
  allow_direct_debit?: boolean | null,
  is_location_valid?: boolean | null,
  created_at?: number | null,
  created_from_ip?: string | null,
  exemption_details?: any[] | null,
  taxability?: string | null,
  entity_code?: string | null,
  exempt_number?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  locale?: string | null,
  billing_date?: number | null,
  billing_month?: number | null,
  billing_date_mode?: string | null,
  billing_day_of_week?: string | null,
  billing_day_of_week_mode?: string | null,
  pii_cleared?: string | null,
  auto_close_invoices?: boolean | null,
  channel?: string | null,
  active_id?: string | null,
  fraud_flag?: string | null,
  primary_payment_source_id?: string | null,
  backup_payment_source_id?: string | null,
  invoice_notes?: string | null,
  business_entity_id?: string | null,
  preferred_currency_code?: string | null,
  promotional_credits?: number | null,
  unbilled_charges?: number | null,
  refundable_credits?: number | null,
  excess_payments?: number | null,
  is_einvoice_enabled?: boolean | null,
  einvoicing_method?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  registered_for_gst?: boolean | null,
  consolidated_invoicing?: boolean | null,
  customer_type?: string | null,
  business_customer_without_vat_number?: boolean | null,
  client_profile_id?: string | null,
  use_default_hierarchy_settings?: boolean | null,
  vat_number_prefix?: string | null,
  entity_identifier_scheme?: string | null,
  entity_identifier_standard?: string | null,
  brand_id?: string | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_urls?: {
    external_customer_id?: string | null,
    referral_sharing_url?: string | null,
    created_at?: number | null,
    updated_at?: number | null,
    referral_campaign_id?: string | null,
    referral_account_id?: string | null,
    referral_external_campaign_id?: string | null,
    referral_system?: string | null
  }[] | null,
  contacts?: {
    id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    phone?: string | null,
    label?: string | null,
    enabled?: boolean | null,
    send_account_email?: boolean | null,
    send_billing_email?: boolean | null
  }[] | null,
  payment_method?: {
    type?: string | null,
    gateway?: string | null,
    gateway_account_id?: string | null,
    status?: string | null,
    reference_id?: string | null
  } | null,
  balances?: {
    promotional_credits?: number | null,
    excess_payments?: number | null,
    refundable_credits?: number | null,
    unbilled_charges?: number | null,
    currency_code?: string | null,
    business_entity_id?: string | null
  }[] | null,
  entity_identifiers?: {
    id?: string | null,
    value?: string | null,
    scheme?: string | null,
    standard?: string | null
  }[] | null,
  tax_providers_fields?: {
    provider_name?: string | null,
    field_id?: string | null,
    field_value?: string | null
  }[] | null,
  relationship?: {
    parent_id?: string | null,
    payment_owner_id?: string | null,
    invoice_owner_id?: string | null
  } | null,
  parent_account_access?: {
    portal_edit_child_subscriptions?: string | null,
    portal_download_child_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null,
  child_account_access?: {
    portal_edit_subscriptions?: string | null,
    portal_download_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null
} | null
```

```ts theme={null}
{
  payment_source_id?: string | null,
  status?: string | null,
  gateway?: string | null,
  gateway_account_id?: string | null,
  ref_tx_id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  iin?: string | null,
  last4?: string | null,
  card_type?: string | null,
  funding_type?: string | null,
  expiry_month?: number | null,
  expiry_year?: number | null,
  issuing_country?: string | null,
  billing_addr1?: string | null,
  billing_addr2?: string | null,
  billing_city?: string | null,
  billing_state_code?: string | null,
  billing_state?: string | null,
  billing_country?: string | null,
  billing_zip?: string | null,
  created_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  ip_address?: string | null,
  powered_by?: string | null,
  customer_id?: string | null,
  masked_number?: string | null
} | null
```

***

### importContractTerm

`subscriptions.importContractTerm`

Import contract term. Imports an active or historical contract term for a subscription. Use this operation to import contract terms when migrating subscriptions from another billing system, or to add historical contract term data for existing subscriptions.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.subscriptions.importContractTerm({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `contract_term_billing_cycle_on_renewal` | `number` | No | The number of billing cycles the new contract term should run for when the contract term renews. This value is used when `action_at_term_end` is `renew` or `renew_once`. **Constraints** \* Should not be sent when `action_at_term_end` is `cancel` or `evergreen`. **Default value** \* Defaults to the value of `billing_cycle` or a custom value depending on the [site configuration](https://www.chargebee.com/docs/billing/2.0/subscriptions/contract-terms#configuring-contract-terms). |
| `contract_term` | `object` | No | Parameters for contract\_term |

```ts theme={null}
{
  id?: string,
  created_at?: number,
  contract_start?: number,
  contract_end?: number,
  status?: active | completed | cancelled | terminated,
  total_amount_raised?: number,
  total_amount_raised_before_tax?: number,
  total_contract_value?: number,
  total_contract_value_before_tax?: number,
  billing_cycle?: number,
  action_at_term_end?: renew | evergreen | cancel | renew_once,
  cancellation_cutoff_period?: number
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `contract_term` | `object \| null` | No | Subscriptions can run indefinitely or they may run for a fixed number of billing cycles. Subscription can have "contract terms", which define a lock-in period on the subscription for a certain number of billing cycles. This prevents the subscription from being canceled by the customer when it is within the contract term. The **contract term** resource described below defines the properties of this lock-in period. This includes the [number of billing cycles](https://docs.corsair.dev/docs/api/contract_terms/contract_term-object#remaining_billing_cycles), the [total contract value](https://docs.corsair.dev/docs/api/contract_terms/contract_term-object#total_contract_value), the [action to be taken](https://docs.corsair.dev/docs/api/contract_terms/contract_term-object#action_at_term_end) at the end of the contract term, and so on. To allow for exceptions, you also have the option of terminating an [`active`](https://docs.corsair.dev/docs/api/contract_terms/contract_term-object#status) contract term and charging a [termination fee](https://docs.corsair.dev/docs/api/contract_terms). A contract term starts in the `active` state and ends in the `completed` state. If the contract was canceled due to non-payment or other reasons, it can end in the `canceled` or `terminated` state. A given contract term is always associated with one, and only one subscription. A subscription, however, can be associated with only one `active` contract term. Over time, a subscription can be associated with several non-`active` contract terms. The `active` contract term for a subscription is available as an [object](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#contract_term) within the subscription. To enable and configure contract terms, follow these steps in the Chargebee UI: 1. Click **Settings** on the left navigation. 2. Click **Configure Chargebee**. 3. Under **Billing** , click **Contract Terms**. 4. Enable and configure the feature as needed. Once contract terms have been configured, the following actions can be performed using the API: \* **Define a contract term** for a subscription and **set renewal options** for the contract term. The following endpoints support this: \* [Create a subscription](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) \* [Update a subscription](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) \* [Reactivate a subscription](https://docs.corsair.dev/docs/api/subscriptions/reactivate-a-subscription) \* [Create a subscription ramp](https://docs.corsair.dev/docs/api/ramps/create-a-ramp) \* [Update a subscription ramp](https://docs.corsair.dev/docs/api/ramps/update-a-subscription-ramp) \* **Retrieving** a historical record of all contract terms for a subscription can be done via the following endpoint: \* [List contract terms for a subscription](https://docs.corsair.dev/docs/api/subscriptions/list-contract-terms-for-a-subscription) \* **Canceling a contract term** can be done via the following endpoints: \* [Update a subscription](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) \* [Cancel a subscription](https://docs.corsair.dev/docs/api/subscriptions/cancel-subscription-for-items) \* [Update a subscription ramp](https://docs.corsair.dev/docs/api/ramps/update-a-subscription-ramp) #### Including a termination fee When a contract is canceled mid-term, you can set a termination fee to be levied. Here's how: 1. [Create](https://docs.corsair.dev/docs/api/item_prices/create-an-item-price) an item price for an item of [type](https://docs.corsair.dev/docs/api/items/item-object#type) `charge` with [price](https://docs.corsair.dev/docs/api/item_prices/create-an-item-price#price) set to the termination fee. 2. Do one of the following: \* [Attach the charge-item to a plan](https://docs.corsair.dev/docs/api/attached_items/create-an-attached-item), setting the `charge_on_event` parameter to `contract_termination`. OR \* [Include the charge-item price on a subscription](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items), setting the `subscription_items[charge_on_event][i]` parameter to `contract_termination`. Once the above steps are done, the termination fee will be charged automatically if you [terminate the contract in the middle of its term](https://docs.corsair.dev/docs/api/subscriptions/cancel-subscription-for-items#contract_term_cancel_option). |

```ts theme={null}
{
  id?: string | null,
  status?: string | null,
  contract_start?: number | null,
  contract_end?: number | null,
  billing_cycle?: number | null,
  action_at_term_end?: string | null,
  total_contract_value?: number | null,
  total_contract_value_before_tax?: number | null,
  cancellation_cutoff_period?: number | null,
  created_at?: number | null,
  subscription_id?: string | null,
  remaining_billing_cycles?: number | null
} | null
```

***

### importSubscription

`subscriptions.importSubscription`

Import a subscription. Imports a subscription into Chargebee. Product Catalog 1.0 sites only.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.subscriptions.importSubscription({ plan_id: 'example', status: 'future' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `id` | `string` | No | Id for the new subscription. If not given, this will be auto-generated. |
| `client_profile_id` | `string` | No | 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. |
| `plan_id` | `string` | Yes | Identifier of the plan for this subscription. |
| `plan_quantity` | `number` | No | Plan quantity for this subscription. |
| `plan_quantity_in_decimal` | `string` | No | The decimal representation of the quantity of the plan purchased. Can be provided for quantity-based plans and only when [multi-decimal pricing](https://docs.corsair.dev/docs/api/v2/pcv-1/currencies) is enabled. |
| `plan_unit_price` | `number` | No | Amount that will override the Plan's default price. The unit depends on the [type of currency](https://docs.corsair.dev/docs/api/getting-started) . |
| `plan_unit_price_in_decimal` | `string` | No | When [price overriding](http://chargebee.com/docs/price-override.html) is enabled for the site, the price or per-unit price of the plan can be set here. The value [set for the plan](https://docs.corsair.dev/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](https://docs.corsair.dev/docs/api/v2/pcv-1/currencies) is enabled. |
| `setup_fee` | `number` | No | Amount that will override the default setup fee. The unit depends on the [type of currency](https://docs.corsair.dev/docs/api/getting-started) . |
| `trial_end` | `number` | No | The time at which the trial ends for this subscription. Can be specified to override the default trial period.If **'0'** is passed, the subscription will be activated immediately. |
| `billing_cycles` | `number` | No | Number of cycles(plan interval) this subscription should be charged. After the billing cycles exhausted, the subscription will be cancelled. |
| `start_date` | `number` | No | The date/time at which the subscription is to start or has started. If not provided, the subscription starts immediately. |
| `auto_collection` | `on \| off` | No | Defines whether payments need to be collected automatically for this subscription. Overrides customer's auto-collection property. \* 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. |
| `po_number` | `string` | No | Purchase order number for this subscription. |
| `coupon_ids` | `string[]` | No | List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes. |
| `contract_term_billing_cycle_on_renewal` | `number` | No | 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) . |
| `status` | `future \| in_trial \| active \| non_renewing \| paused \| cancelled \| transferred` | Yes | Current state of the subscription. \* future - The subscription is scheduled to start at a future date. \* non\_renewing - The subscription will be canceled at the end of the current term. \* active - The subscription is active and will be charged for automatically based on the items in it. \* cancelled - The subscription has been canceled and is no longer in service. \* transferred - The subscription has been transferred to another business entity within the organization. \* in\_trial - The subscription is in trial. \* paused - The subscription is [paused](https://www.chargebee.com/docs/2.0/pause-subscription.html). The subscription will not renew while in this state. |
| `current_term_end` | `number` | No | End of the current billing term. Subscription is renewed immediately after this. If not given, this will be calculated based on plan billing cycle. **Note:** For subscription status: `non_renewing`, `active`, and `paused`, `current_term_end` is required. . |
| `current_term_start` | `number` | No | Start of the current billing period of the subscription. This is required when the subscription `status` is `paused`. When the `status` is `active` or `non_renewing` , it defaults to the current time. |
| `trial_start` | `number` | No | Start of the trial period for the subscription. When not passed, it is assumed to be current time. When passed for a `future` subscription, it implies that the subscription goes into `in_trial` when it starts. |
| `cancelled_at` | `number` | No | Time at which subscription was cancelled or is set to be cancelled. |
| `started_at` | `number` | No | Time at which the subscription was started. Is `null` for `future` subscriptions as it is yet to be started. |
| `activated_at` | `number` | No | The time at which the subscription was activated. A subscription is "activated" when its `status` changes from any other, to either `active` or `non_renewing`. The following conditions must be satisfied when passing this parameter: \* When `status` is `active`, `non_renewing`, or `paused`, `activated_at` must be on or after `trial_end` or `started_at`. Additionally, `activated_at` must be on or before `current_term_start`. \* When `status` is `in_trial`, `activated_at` must precede `trial_start` #### Note: This parameter should not be provided when passing `status` as `future` or `cancelled`. |
| `pause_date` | `number` | No | When a pause has been scheduled, it is the date/time of scheduled pause. When the subscription is in the `paused` state, it is the date/time when the subscription was paused. |
| `resume_date` | `number` | No | For a paused subscription, it is the date/time when the subscription is scheduled to resume. If the pause is for an indefinite period, this value is not returned. |
| `create_current_term_invoice` | `boolean` | No | Set as `true` if you want an invoice to be created for the subscription. \* The invoice will be created for the subscription only if it has an `active` or `non_renewing` status. \* The period of the invoice is from `current_term_start` to `current_term_end`. \* The invoice will not be generated if the subscription amount is zero dollars (for that period) and 'Hide Zero Value Line Items' option is enabled in site settings. |
| `affiliate_token` | `string` | No | A unique tracking token. |
| `invoice_notes` | `string` | No | A customer-facing note added to all invoices associated with this subscription. This note is one among [all the notes](https://docs.corsair.dev/docs/api/invoices/invoice-object#notes) displayed on the invoice PDF. |
| `meta_data` | `object` | No | A collection of key-value pairs that provides extra information about the subscription. **Note:** There's a character limit of 65,535. [Learn more](https://docs.corsair.dev/docs/api/v2/pcv-1/advanced-features) . |
| `customer` | `object` | No | Parameters for customer |
| `contract_term` | `object` | No | Parameters for contract\_term |
| `card` | `object` | No | Parameters for card |
| `payment_method` | `object` | No | Parameters for payment\_method |
| `billing_address` | `object` | No | Parameters for billing\_address |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `transaction` | `object` | No | Parameters for transaction |
| `addons` | `object` | No | Parameters for addons |
| `event_based_addons` | `object` | No | Parameters for event\_based\_addons |
| `charged_event_based_addons` | `object` | No | Parameters for charged\_event\_based\_addons |

```ts theme={null}
{
}
```

```ts theme={null}
{
  id?: string,
  email?: string,
  first_name?: string,
  last_name?: string,
  company?: string,
  phone?: string,
  locale?: string,
  taxability?: taxable | exempt | zero_rated,
  entity_code?: a | b | c | d | e | f | g | h | i | j | k | l | m | n | p | q | r | med1 | med2,
  exempt_number?: string,
  net_term_days?: number,
  taxjar_exemption_category?: wholesale | government | other,
  customer_type?: residential | business | senior_citizen | industrial,
  auto_collection?: on | off,
  allow_direct_debit?: boolean,
  vat_number?: string,
  vat_number_prefix?: string
}
```

```ts theme={null}
{
  id?: string,
  created_at?: number,
  contract_start?: number,
  billing_cycle?: number,
  total_amount_raised?: number,
  total_amount_raised_before_tax?: number,
  action_at_term_end?: renew | evergreen | cancel | renew_once,
  cancellation_cutoff_period?: number
}
```

```ts theme={null}
{
  gateway_account_id?: string,
  first_name?: string,
  last_name?: string,
  number?: string,
  expiry_month?: number,
  expiry_year?: number,
  cvv?: string,
  preferred_scheme?: cartes_bancaires | mastercard | visa | dankort,
  billing_addr1?: string,
  billing_addr2?: string,
  billing_city?: string,
  billing_state_code?: string,
  billing_state?: string,
  billing_zip?: string,
  billing_country?: string,
  additional_information?: {
  }
}
```

```ts theme={null}
{
  type?: card | paypal_express_checkout | amazon_payments | direct_debit | generic | alipay | unionpay | apple_pay | wechat_pay | ideal | google_pay | sofort | bancontact | giropay | dotpay | upi | netbanking_emandates | venmo | pay_to | faster_payments | sepa_instant_transfer | automated_bank_transfer | klarna_pay_now | online_banking_poland | payconiq_by_bancontact | electronic_payment_standard | kbc_payment_button | pay_by_bank | trustly | stablecoin | kakao_pay | naver_pay | revolut_pay | cash_app_pay | twint | go_pay | grab_pay | pay_co | after_pay | swish | payme | pix | klarna | alipay_hk | paypay | gcash | south_korean_cards | paynow | bizum | promptpay | dana | touch_n_go | tamara | qpay | ovo | momo | mercado_pago | nequi | nupay | picpay | thai_qr | blik | fpx | wero | p24 | affirm_pay | rakuten_pay,
  gateway_account_id?: string,
  reference_id?: string,
  issuing_country?: string,
  additional_information?: {
  }
}
```

```ts theme={null}
{
  first_name?: string,
  last_name?: string,
  email?: string,
  company?: string,
  phone?: string,
  line1?: string,
  line2?: string,
  line3?: string,
  city?: string,
  state_code?: string,
  state?: string,
  zip?: string,
  country?: string,
  validation_status?: not_validated | valid | partially_valid | invalid
}
```

```ts theme={null}
{
  first_name?: string,
  last_name?: string,
  email?: string,
  company?: string,
  phone?: string,
  line1?: string,
  line2?: string,
  line3?: string,
  city?: string,
  state_code?: string,
  state?: string,
  zip?: string,
  country?: string,
  validation_status?: not_validated | valid | partially_valid | invalid
}
```

```ts theme={null}
{
  amount?: number,
  payment_method?: cash | check | bank_transfer | other | custom,
  reference_number?: string,
  date?: number
}
```

```ts theme={null}
{
  id?: string[],
  quantity?: number[],
  quantity_in_decimal?: string[],
  unit_price?: number[],
  unit_price_in_decimal?: string[],
  billing_cycles?: number[]
}
```

```ts theme={null}
{
  id?: string[],
  quantity?: number[],
  unit_price?: number[],
  quantity_in_decimal?: string[],
  unit_price_in_decimal?: string[],
  service_period_in_days?: number[],
  on_event?: (subscription_creation | subscription_trial_start | plan_activation | subscription_activation | contract_termination)[],
  charge_once?: boolean[]
}
```

```ts theme={null}
{
  id?: string[],
  last_charged_at?: number[]
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `subscription` | `object \| null` | No | Subscription represents the recurring items a customer has subscribed to. The recurring items can be - plan, addons. It may also contain the discount items like coupons. Subscriptions are invoiced at the start of every term based on the recurring items and charged immediately against the customer's credit card if 'auto\_collection' is turned 'on', otherwise the resulting invoice will be created as 'Payment Due'. **Note:** The maximum number of subscriptions for any given [customer](https://docs.corsair.dev/docs/api/customers) ([active](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#status) or not) is 900. Tax provider fields **Avalara** : Merchants using **Avalara Sales Tax** can optionally associate each item price with a locationCode (from their Avalara company locations), so tax can be resolved correctly at the line item level. \| Field ID \| Field Value \| APIs \| \|--------------------------------------------------------------------------------\|----------------------------------------------------------------------\|--------------------------------------------------------------------------------\| \| `locationCode` \| Merchant to configure it on Avalara Platform under company locations \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| **Anrok**: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation \| Field ID \| Field Value \| APIs \| \|---------------------------------------------------------------------------------------------------------------------------------------\|---------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------\| \| `additionalTaxRegistrationNumber` \| Canadian tax registration numbers in comma separated fashion. \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| **Vertex**: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration **Note:** Field Id like `customerCode` , `customerClass` , and`taxExempted` belong to the customer object. Field Id like `productCode` , `productClass` , `productTaxCode` , and `productClass` belong to the product object. \| Field ID \| Field Value \| APIs \| \|-----------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productCode` \| Merchant to configure it on Vertex Platform \| APIs having [Plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object)(PC1), [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object)(PC1) and [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object)(PC2) attributes. \| \| `productClass` \| Merchant to configure it on Vertex Platform \| APIs having [Plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object)(PC1), [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object)(PC1) and [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object)(PC2) attributes. \| \| `customerCode` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `customerClass` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **Taxamo:** Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration \| Field Id \| Field Value \| APIs \| \|------------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productTaxCode` \| Merchant to configure it on Taxamo Platform \| APIs having [Plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object)(PC1), [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object)(PC1) and Item Prices (PC2) attributes. \| \| `productClass` \| Merchant to configure it on Taxamo Platform \| APIs having [Plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object)(PC1), [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object)(PC1) and Item Prices (PC2) attributes. \| \| `taxExempted` \| Merchant to configure it on Taxamo Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **cbtaxes**: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India. \| Field ID \| Field Value \| APIs \| \|---------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `indiaSez` \| `SEZ_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaSez` \| `SEZ_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **All**: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level \| Field ID \| Field Value \| APIs \| \|-------------\|-----------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `priceType` \| `TAX_INCLUSIVE` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| \| `TAX_EXCLUSIVE` \| \| \| \| `SITE_DEFAULT` \| Removes price type override, and allows site level configuration to be used for tax calculation. \| **Note:** Make sure you choose the correct **Field ID** and **Available APIs** combination from the table above. All Product Catalog APIs include [Plans](https://docs.corsair.dev/docs/api/v2/pcv-1/plans) , [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons) , [Coupons](https://docs.corsair.dev/docs/api/v2/pcv-1/coupons) , [Coupon Sets](https://docs.corsair.dev/docs/api/v2/pcv-1/coupon_sets) , [Coupon Codes](https://docs.corsair.dev/docs/api/v2/pcv-1/coupon_codes) . |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/v2/pcv-1/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/v2/pcv-1/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any custom attributes you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/1.0/sites-intro.html)\\*\\* created before March 1, 2014\\*\\*: [updating the card](https://docs.corsair.dev/docs/api/v2/pcv-1/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/v2/pcv-1/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |
| `invoice` | `object \| null` | No | Invoices are statements containing charges, adjustments and any discounts for a subscription specific to a term. For every subscription a draft invoice (upcoming invoice) is used to track all the charges, credits and adjustments for the current term. Generally, an invoice is closed at start of the next term. However, cancellation and other such operations on subscription may trigger premature closing. While closing the invoice, in addition to recurring charges, credits and coupons are applied to calculate the final amount that is due. When invoice is closed, an attempt to charge the credit card is made. If the payment succeeds, it is marked as **paid** . If the payment fails, the invoice is marked as **payment\_due** and retry settings are taken into account. If no retry attempts are configured, the invoice is marked as **not\_paid** . If the amount due is zero or negative, the invoice is immediately marked as **paid** and the balance if any is carried forward to the next term of the invoice. **Note:** If *consolidated invoicing* is enabled, the attribute *invoice.subscription\_id* should **not** be used (as it will not be present if the invoice has lines from multiple subscriptions). Instead to know the related subscriptions, their [line\_items](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) *subscription\_id* attribute should be referred. |

```ts theme={null}
{
  id?: string | null,
  currency_code?: string | null,
  plan_id?: string | null,
  plan_quantity?: number | null,
  plan_unit_price?: number | null,
  setup_fee?: number | null,
  billing_period?: number | null,
  billing_period_unit?: string | null,
  start_date?: number | null,
  trial_end?: number | null,
  remaining_billing_cycles?: number | null,
  po_number?: string | null,
  auto_collection?: string | null,
  plan_quantity_in_decimal?: string | null,
  plan_unit_price_in_decimal?: string | null,
  customer_id?: string | null,
  plan_amount?: number | null,
  plan_free_quantity?: number | null,
  status?: string | null,
  trial_start?: number | null,
  trial_end_action?: string | null,
  current_term_start?: number | null,
  current_term_end?: number | null,
  next_billing_at?: number | null,
  created_at?: number | null,
  started_at?: number | null,
  activated_at?: number | null,
  gift_id?: string | null,
  contract_term_billing_cycle_on_renewal?: number | null,
  override_relationship?: boolean | null,
  pause_date?: number | null,
  resume_date?: number | null,
  cancelled_at?: number | null,
  cancel_reason?: string | null,
  affiliate_token?: string | null,
  created_from_ip?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  has_scheduled_advance_invoices?: boolean | null,
  has_scheduled_changes?: boolean | null,
  payment_source_id?: string | null,
  plan_free_quantity_in_decimal?: string | null,
  plan_amount_in_decimal?: string | null,
  cancel_schedule_created_at?: number | null,
  offline_payment_method?: string | null,
  channel?: string | null,
  active_id?: string | null,
  due_invoices_count?: number | null,
  due_since?: number | null,
  total_dues?: number | null,
  mrr?: number | null,
  exchange_rate?: number | null,
  base_currency_code?: string | null,
  invoice_notes?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  changes_scheduled_at?: number | null,
  cancel_reason_code?: string | null,
  free_period?: number | null,
  free_period_unit?: string | null,
  create_pending_invoices?: boolean | null,
  auto_close_invoices?: boolean | null,
  business_entity_id?: string | null,
  decommissioned?: boolean | null,
  brand_id?: string | null,
  addons?: {
    id?: string | null,
    quantity?: number | null,
    unit_price?: number | null,
    amount?: number | null,
    trial_end?: number | null,
    remaining_billing_cycles?: number | null,
    quantity_in_decimal?: string | null,
    unit_price_in_decimal?: string | null,
    amount_in_decimal?: string | null,
    proration_type?: string | null
  }[] | null,
  event_based_addons?: {
    id?: string | null,
    quantity?: number | null,
    unit_price?: number | null,
    on_event?: string | null,
    charge_once?: boolean | null,
    quantity_in_decimal?: string | null,
    unit_price_in_decimal?: string | null
  }[] | null,
  charged_event_based_addons?: {
    id?: string | null,
    last_charged_at?: number | null
  }[] | null,
  coupons?: {
    coupon_id?: string | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_code?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_info?: {
    referral_code?: string | null,
    coupon_code?: string | null,
    referrer_id?: string | null,
    external_reference_id?: string | null,
    reward_status?: string | null,
    referral_system?: string | null,
    account_id?: string | null,
    campaign_id?: string | null,
    external_campaign_id?: string | null,
    friend_offer_type?: string | null,
    referrer_reward_type?: string | null,
    notify_referral_system?: string | null,
    destination_url?: string | null,
    post_purchase_widget_enabled?: boolean | null
  } | null,
  contract_term?: {
    id?: string | null,
    status?: string | null,
    contract_start?: number | null,
    contract_end?: number | null,
    billing_cycle?: number | null,
    action_at_term_end?: string | null,
    total_contract_value?: number | null,
    total_contract_value_before_tax?: number | null,
    cancellation_cutoff_period?: number | null,
    created_at?: number | null,
    subscription_id?: string | null,
    remaining_billing_cycles?: number | null
  } | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  email?: string | null,
  phone?: string | null,
  company?: string | null,
  vat_number?: string | null,
  auto_collection?: string | null,
  offline_payment_method?: string | null,
  net_term_days?: number | null,
  vat_number_validated_time?: number | null,
  vat_number_status?: string | null,
  allow_direct_debit?: boolean | null,
  is_location_valid?: boolean | null,
  created_at?: number | null,
  created_from_ip?: string | null,
  exemption_details?: any[] | null,
  taxability?: string | null,
  entity_code?: string | null,
  exempt_number?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  locale?: string | null,
  billing_date?: number | null,
  billing_month?: number | null,
  billing_date_mode?: string | null,
  billing_day_of_week?: string | null,
  billing_day_of_week_mode?: string | null,
  pii_cleared?: string | null,
  auto_close_invoices?: boolean | null,
  channel?: string | null,
  active_id?: string | null,
  fraud_flag?: string | null,
  primary_payment_source_id?: string | null,
  backup_payment_source_id?: string | null,
  invoice_notes?: string | null,
  business_entity_id?: string | null,
  preferred_currency_code?: string | null,
  promotional_credits?: number | null,
  unbilled_charges?: number | null,
  refundable_credits?: number | null,
  excess_payments?: number | null,
  is_einvoice_enabled?: boolean | null,
  einvoicing_method?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  registered_for_gst?: boolean | null,
  consolidated_invoicing?: boolean | null,
  customer_type?: string | null,
  business_customer_without_vat_number?: boolean | null,
  client_profile_id?: string | null,
  use_default_hierarchy_settings?: boolean | null,
  vat_number_prefix?: string | null,
  entity_identifier_scheme?: string | null,
  entity_identifier_standard?: string | null,
  brand_id?: string | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_urls?: {
    external_customer_id?: string | null,
    referral_sharing_url?: string | null,
    created_at?: number | null,
    updated_at?: number | null,
    referral_campaign_id?: string | null,
    referral_account_id?: string | null,
    referral_external_campaign_id?: string | null,
    referral_system?: string | null
  }[] | null,
  contacts?: {
    id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    phone?: string | null,
    label?: string | null,
    enabled?: boolean | null,
    send_account_email?: boolean | null,
    send_billing_email?: boolean | null
  }[] | null,
  payment_method?: {
    type?: string | null,
    gateway?: string | null,
    gateway_account_id?: string | null,
    status?: string | null,
    reference_id?: string | null
  } | null,
  balances?: {
    promotional_credits?: number | null,
    excess_payments?: number | null,
    refundable_credits?: number | null,
    unbilled_charges?: number | null,
    currency_code?: string | null,
    business_entity_id?: string | null
  }[] | null,
  entity_identifiers?: {
    id?: string | null,
    value?: string | null,
    scheme?: string | null,
    standard?: string | null
  }[] | null,
  tax_providers_fields?: {
    provider_name?: string | null,
    field_id?: string | null,
    field_value?: string | null
  }[] | null,
  relationship?: {
    parent_id?: string | null,
    payment_owner_id?: string | null,
    invoice_owner_id?: string | null
  } | null,
  parent_account_access?: {
    portal_edit_child_subscriptions?: string | null,
    portal_download_child_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null,
  child_account_access?: {
    portal_edit_subscriptions?: string | null,
    portal_download_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null
} | null
```

```ts theme={null}
{
  payment_source_id?: string | null,
  status?: string | null,
  gateway?: string | null,
  gateway_account_id?: string | null,
  ref_tx_id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  iin?: string | null,
  last4?: string | null,
  card_type?: string | null,
  funding_type?: string | null,
  expiry_month?: number | null,
  expiry_year?: number | null,
  issuing_country?: string | null,
  billing_addr1?: string | null,
  billing_addr2?: string | null,
  billing_city?: string | null,
  billing_state_code?: string | null,
  billing_state?: string | null,
  billing_country?: string | null,
  billing_zip?: string | null,
  created_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  ip_address?: string | null,
  powered_by?: string | null,
  customer_id?: string | null,
  masked_number?: string | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  payment_owner?: string | null,
  subscription_id?: string | null,
  recurring?: boolean | null,
  status?: string | null,
  date?: number | null,
  due_date?: number | null,
  net_term_days?: number | null,
  po_number?: string | null,
  vat_number?: string | null,
  price_type?: string | null,
  exchange_rate?: number | null,
  local_currency_exchange_rate?: number | null,
  currency_code?: string | null,
  local_currency_code?: string | null,
  tax?: number | null,
  sub_total?: number | null,
  sub_total_in_local_currency?: number | null,
  total?: number | null,
  total_in_local_currency?: number | null,
  amount_due?: number | null,
  amount_adjusted?: number | null,
  amount_paid?: number | null,
  paid_at?: number | null,
  write_off_amount?: number | null,
  credits_applied?: number | null,
  dunning_status?: string | null,
  next_retry_at?: number | null,
  voided_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  line_items_next_offset?: string | null,
  first_invoice?: boolean | null,
  new_sales_amount?: number | null,
  has_advance_charges?: boolean | null,
  offline_payment_method?: string | null,
  term_finalized?: boolean | null,
  is_gifted?: boolean | null,
  generated_at?: number | null,
  expected_payment_date?: number | null,
  amount_to_collect?: number | null,
  round_off_amount?: number | null,
  retry_segment_id?: string | null,
  void_reason_code?: string | null,
  deleted?: boolean | null,
  tax_category?: string | null,
  vat_number_prefix?: string | null,
  channel?: string | null,
  business_entity_id?: string | null,
  brand_id?: string | null,
  exchange_rates?: {
    currency_code?: string | null,
    rate?: number | null
  }[] | null,
  line_items?: {
    id?: string | null,
    subscription_id?: string | null,
    date_from?: number | null,
    date_to?: number | null,
    unit_amount?: number | null,
    quantity?: number | null,
    amount?: number | null,
    pricing_model?: string | null,
    is_taxed?: boolean | null,
    tax_amount?: number | null,
    tax_rate?: number | null,
    unit_amount_in_decimal?: string | null,
    quantity_in_decimal?: string | null,
    amount_in_decimal?: string | null,
    discount_amount?: number | null,
    item_level_discount_amount?: number | null,
    metered?: boolean | null,
    is_percentage_pricing?: boolean | null,
    reference_line_item_id?: string | null,
    description?: string | null,
    entity_description?: string | null,
    entity_type?: string | null,
    tax_exempt_reason?: string | null,
    entity_id?: string | null,
    customer_id?: string | null,
    proration_mode?: string | null
  }[] | null,
  line_item_tiers?: {
    line_item_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    quantity_used?: number | null,
    unit_amount?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    quantity_used_in_decimal?: string | null,
    unit_amount_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null
  }[] | null,
  line_item_discounts?: {
    line_item_id?: string | null,
    discount_type?: string | null,
    coupon_id?: string | null,
    entity_id?: string | null,
    discount_amount?: number | null
  }[] | null,
  line_item_taxes?: {
    line_item_id?: string | null,
    tax_name?: string | null,
    tax_rate?: number | null,
    date_to?: number | null,
    date_from?: number | null,
    prorated_taxable_amount?: number | null,
    is_partial_tax_applied?: boolean | null,
    is_non_compliance_tax?: boolean | null,
    taxable_amount?: number | null,
    tax_amount?: number | null,
    tax_juris_type?: string | null,
    tax_juris_name?: string | null,
    tax_juris_code?: string | null,
    tax_amount_in_local_currency?: number | null,
    local_currency_code?: string | null
  }[] | null,
  line_item_credits?: {
    cn_id?: string | null,
    applied_amount?: number | null,
    line_item_id?: string | null
  }[] | null,
  line_item_addresses?: {
    line_item_id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  }[] | null,
  discounts?: {
    amount?: number | null,
    description?: string | null,
    line_item_id?: string | null,
    entity_type?: string | null,
    discount_type?: string | null,
    entity_id?: string | null,
    coupon_set_code?: string | null
  }[] | null,
  taxes?: {
    name?: string | null,
    amount?: number | null,
    description?: string | null
  }[] | null,
  tax_origin?: {
    country?: string | null,
    registration_number?: string | null
  } | null,
  linked_taxes_withheld?: {
    id?: string | null,
    amount?: number | null,
    description?: string | null,
    date?: number | null,
    reference_number?: string | null
  }[] | null,
  linked_payments?: {
    txn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null
  }[] | null,
  reference_transactions?: {
    applied_amount?: number | null,
    applied_at?: number | null,
    txn_id?: string | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null,
    txn_type?: string | null,
    amount_capturable?: number | null,
    authorization_reason?: string | null
  }[] | null,
  dunning_attempts?: {
    attempt?: number | null,
    transaction_id?: string | null,
    dunning_type?: string | null,
    created_at?: number | null,
    txn_status?: string | null,
    txn_amount?: number | null,
    retry_engine?: string | null
  }[] | null,
  applied_credits?: {
    cn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_status?: string | null,
    tax_application?: string | null
  }[] | null,
  adjustment_credit_notes?: {
    cn_id?: string | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_total?: number | null,
    cn_status?: string | null
  }[] | null,
  issued_credit_notes?: {
    cn_id?: string | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_total?: number | null,
    cn_status?: string | null
  }[] | null,
  linked_orders?: {
    id?: string | null,
    document_number?: string | null,
    status?: string | null,
    order_type?: string | null,
    reference_id?: string | null,
    fulfillment_status?: string | null,
    batch_id?: string | null,
    created_at?: number | null
  }[] | null,
  notes?: {
    note?: string | null,
    entity_id?: string | null,
    entity_type?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  statement_descriptor?: {
    id?: string | null,
    descriptor?: string | null
  } | null,
  einvoice?: {
    id?: string | null,
    reference_id?: string | null,
    reference_number?: string | null,
    status?: string | null,
    message?: string | null,
    provider_references?: any[] | null
  } | null,
  site_details_at_creation?: {
    timezone?: string | null,
    organization_address?: {
    } | null
  } | null
} | null
```

***

### importUnbilledCharges

`subscriptions.importUnbilledCharges`

Import unbilled charges. Imports one or more unbilled charges into an existing subscription. Use this operation to add usage-based or other unbilled charges recorded in external systems to the subscription.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.subscriptions.importUnbilledCharges({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `unbilled_charges` | `object` | No | Parameters for unbilled\_charges |
| `discounts` | `object` | No | Parameters for discounts |
| `tiers` | `object` | No | Parameters for tiers |

```ts theme={null}
{
  id?: string[],
  date_from: number[],
  date_to: number[],
  entity_type: (adhoc | plan_item_price | addon_item_price | charge_item_price)[],
  entity_id?: string[],
  description?: string[],
  unit_amount?: number[],
  quantity?: number[],
  amount?: number[],
  unit_amount_in_decimal?: string[],
  quantity_in_decimal?: string[],
  amount_in_decimal?: string[],
  discount_amount?: number[],
  use_for_proration?: boolean[],
  is_advance_charge?: boolean[]
}
```

```ts theme={null}
{
  unbilled_charge_id?: string[],
  entity_type?: (item_level_coupon | document_level_coupon | item_level_discount | document_level_discount)[],
  entity_id?: string[],
  description?: string[],
  amount: number[]
}
```

```ts theme={null}
{
  unbilled_charge_id: string[],
  starting_unit?: number[],
  ending_unit?: number[],
  quantity_used?: number[],
  unit_amount?: number[],
  starting_unit_in_decimal?: string[],
  ending_unit_in_decimal?: string[],
  quantity_used_in_decimal?: string[],
  unit_amount_in_decimal?: string[]
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `unbilled_charges` | `object[] \| null` | No | Resource object representing unbilled\_charge |

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  subscription_id?: string | null,
  date_from?: number | null,
  date_to?: number | null,
  unit_amount?: number | null,
  pricing_model?: string | null,
  quantity?: number | null,
  amount?: number | null,
  currency_code?: string | null,
  discount_amount?: number | null,
  description?: string | null,
  entity_type?: string | null,
  entity_id?: string | null,
  is_voided?: boolean | null,
  voided_at?: number | null,
  unit_amount_in_decimal?: string | null,
  quantity_in_decimal?: string | null,
  amount_in_decimal?: string | null,
  created_at?: number | null,
  updated_at?: number | null,
  is_advance_charge?: boolean | null,
  business_entity_id?: string | null,
  deleted?: boolean | null,
  tiers?: {
    starting_unit?: number | null,
    ending_unit?: number | null,
    quantity_used?: number | null,
    unit_amount?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    quantity_used_in_decimal?: string | null,
    unit_amount_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null
  }[] | null
}[] | null
```

***

### list

`subscriptions.list`

List subscriptions. Returns a list of subscriptions meeting all the conditions specified in the filter parameters below.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.subscriptions.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `include_deleted` | `boolean` | No | Indicates whether to include deleted objects in the list. The deleted objects have the attribute `deleted` as `true` . |
| `id` | `object` | No | optional, string filter A unique and immutable identifier for the subscription. If not provided, it is autogenerated. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *id\\\[is\_not\\] = "8gsnbYfsMLds"* |
| `customer_id` | `object` | No | optional, string filter Identifier of the customer with whom this subscription is associated. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *customer\_id\\\[is\\] = "8gsnbYfsMLds"* |
| `item_id` | `object` | No | optional, string filter The plan item code. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *item\_id\\\[is\_not\\] = "silver"* |
| `item_price_id` | `object` | No | optional, string filter The plan item price code. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *item\_price\_id\\\[is\\] = "silver-USD-monthly"* |
| `status` | `object` | No | optional, enumerated string filter Current state of the subscription. Possible values are : future, in\_trial, active, non\_renewing, paused, cancelled. **Supported operators :** is, is\_not, in, not\_in **Example →** *status\\\[is\_not\\] = "active"* |
| `cancel_reason` | `object` | No | optional, enumerated string filter The reason for canceling the subscription. Set by Chargebee automatically. Possible values are : not\_paid, no\_card, fraud\_review\_failed, non\_compliant\_eu\_customer, tax\_calculation\_failed, currency\_incompatible\_with\_gateway, non\_compliant\_customer. **Supported operators :** is, is\_not, in, not\_in, is\_present **Example →** *cancel\_reason\\\[is\\] = "not\_paid"* |
| `cancel_reason_code` | `object` | No | optional, string filter Reason code for canceling the subscription. Must be one from a list of reason codes set in the Chargebee app in **Settings \\> Configure Chargebee \\> Reason Codes \\> Subscriptions \\> Subscription Cancellation** . Must be passed if set as mandatory in the app. The codes are case-sensitive. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *cancel\_reason\_code\\\[is\\] = "Not Paid"* |
| `remaining_billing_cycles` | `object` | No | optional, integer filter \* When the subscription is not on a contract term: this value is the number of billing cycles remaining after the current cycle, at the end of which, the subscription cancels. \* When the subscription is on a [contract term](https://docs.corsair.dev/docs/api/contract_terms): this value is the number of billing cycles remaining in the contract term after the current billing cycle. . **Supported operators :** is, is\_not, lt, lte, gt, gte, between, is\_present **Example →** *remaining\_billing\_cycles\\\[is\_not\\] = "3"* |
| `created_at` | `object` | No | optional, timestamp(UTC) in seconds filter The time at which the subscription was created. **Supported operators :** after, before, on, between **Example →** *created\_at\\\[before\\] = "1435054328"* |
| `activated_at` | `object` | No | optional, timestamp(UTC) in seconds filter Time at which the subscription `status` last changed to `active`. For example, this value is updated when an `in_trial` or `cancelled` subscription activates. **Supported operators :** after, before, on, between, is\_present **Example →** *activated\_at\\\[after\\] = "1435054328"* |
| `next_billing_at` | `object` | No | optional, timestamp(UTC) in seconds filter The date/time at which the next billing for the subscription happens. This is usually right after `current_term_end` unless multiple subscription terms were invoiced in advance using the `terms_to_charge` parameter. **Supported operators :** after, before, on, between **Example →** *next\_billing\_at\\\[after\\] = "1435054328"* |
| `cancelled_at` | `object` | No | optional, timestamp(UTC) in seconds filter Time at which subscription was cancelled or is set to be cancelled. **Supported operators :** after, before, on, between **Example →** *cancelled\_at\\\[after\\] = "1435054328"* |
| `has_scheduled_changes` | `object` | No | optional, boolean filter If `true` , there are subscription changes scheduled on next renewal. Possible values are : *true, false* **Supported operators :** is **Example →** *has\_scheduled\_changes\\\[is\\] = "true"* |
| `updated_at` | `object` | No | optional, timestamp(UTC) in seconds filter To filter based on `updated_at`. This attribute will be present only if the resource has been updated after 2016-09-28. It is advisable when using this filter, to pass the `sort_by` input parameter as `updated_at` for a faster response. **Supported operators :** after, before, on, between **Example →** *updated\_at\\\[after\\] = "1243545465"* |
| `offline_payment_method` | `object` | No | optional, enumerated string filter The preferred offline payment method for the subscription. Possible values are : no\_preference, cash, check, bank\_transfer, ach\_credit, sepa\_credit. **Supported operators :** is, is\_not, in, not\_in **Example →** *offline\_payment\_method\\\[is\_not\\] = "cash"* |
| `auto_close_invoices` | `object` | No | optional, boolean filter Set to `false` to override for this subscription, the [site-level setting](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) for auto-closing invoices. Only applicable when auto-closing invoices has been enabled for the site. This attribute has a higher precedence than the same attribute at the [customer level](https://docs.corsair.dev/docs/api/customers/customer-object#auto_close_invoices). Possible values are : *true, false* **Supported operators :** is **Example →** *auto\_close\_invoices\\\[is\\] = "true"* |
| `override_relationship` | `object` | No | optional, boolean filter If `true` , ignores the [hierarchy relationship](https://docs.corsair.dev/docs/api/customers/customer-object#relationship) and uses customer as payment and invoice owner. Possible values are : *true, false* **Supported operators :** is **Example →** *override\_relationship\\\[is\\] = "false"* |
| `sort_by` | `object` | No | optional, string filter Sorts based on the specified attribute. **Supported attributes :** created\_at, updated\_at **Supported sort-orders :** asc, desc **Example →** *sort\_by\\\[asc\\] = "created\_at"* This will sort the result based on the 'created\_at' attribute in ascending(earliest first) order. |
| `business_entity_id` | `object` | No | optional, string filter The unique ID of the [business entity](https://docs.corsair.dev/docs/api/advanced-features) of this subscription. This is always the same as the [business entity](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#customer_id) of the customer. **Supported operators :** is, is\_not, starts\_with **Example →** *business\_entity\_id\\\[is\_not\\] = "business\_entity\_id"* |
| `channel` | `object` | No | optional, enumerated string filter The subscription channel this object originated from and is maintained in. Possible values are : web, app\_store, play\_store. **Supported operators :** is, is\_not, in, not\_in **Example →** *channel\\\[is\_not\\] = "APP STORE"* |
| `decommissioned` | `object` | No | optional, boolean filter Filter subscriptions based on whether they have been [decommissioned](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#decommissioned). **Example →** `decommissioned[is] = "true"` |

```ts theme={null}
{
  is?: string,
  is_not?: string,
  starts_with?: string,
  in?: string,
  not_in?: string
}
```

```ts theme={null}
{
  is?: string,
  is_not?: string,
  starts_with?: string,
  in?: string,
  not_in?: string
}
```

```ts theme={null}
{
  is?: string,
  is_not?: string,
  starts_with?: string,
  in?: string,
  not_in?: string
}
```

```ts theme={null}
{
  is?: string,
  is_not?: string,
  starts_with?: string,
  in?: string,
  not_in?: string
}
```

```ts theme={null}
{
  is?: future | in_trial | active | non_renewing | paused | cancelled | transferred,
  is_not?: future | in_trial | active | non_renewing | paused | cancelled | transferred,
  in?: string,
  not_in?: string
}
```

```ts theme={null}
{
  is?: not_paid | no_card | fraud_review_failed | non_compliant_eu_customer | tax_calculation_failed | currency_incompatible_with_gateway | non_compliant_customer,
  is_not?: not_paid | no_card | fraud_review_failed | non_compliant_eu_customer | tax_calculation_failed | currency_incompatible_with_gateway | non_compliant_customer,
  in?: string,
  not_in?: string,
  is_present?: true | false
}
```

```ts theme={null}
{
  is?: string,
  is_not?: string,
  starts_with?: string,
  in?: string,
  not_in?: string
}
```

```ts theme={null}
{
  is?: string,
  is_not?: string,
  lt?: string,
  lte?: string,
  gt?: string,
  gte?: string,
  between?: string,
  is_present?: true | false
}
```

```ts theme={null}
{
  after?: string,
  before?: string,
  on?: string,
  between?: string
}
```

```ts theme={null}
{
  after?: string,
  before?: string,
  on?: string,
  between?: string,
  is_present?: true | false
}
```

```ts theme={null}
{
  after?: string,
  before?: string,
  on?: string,
  between?: string
}
```

```ts theme={null}
{
  after?: string,
  before?: string,
  on?: string,
  between?: string
}
```

```ts theme={null}
{
  is?: true | false
}
```

```ts theme={null}
{
  after?: string,
  before?: string,
  on?: string,
  between?: string
}
```

```ts theme={null}
{
  is?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
  is_not?: no_preference | cash | check | bank_transfer | ach_credit | sepa_credit | boleto | us_automated_bank_transfer | eu_automated_bank_transfer | uk_automated_bank_transfer | jp_automated_bank_transfer | mx_automated_bank_transfer | custom,
  in?: string,
  not_in?: string
}
```

```ts theme={null}
{
  is?: true | false
}
```

```ts theme={null}
{
  is?: true | false
}
```

```ts theme={null}
{
  asc?: created_at | updated_at,
  desc?: created_at | updated_at
}
```

```ts theme={null}
{
  is?: string
}
```

```ts theme={null}
{
  is?: web | app_store | play_store,
  is_not?: web | app_store | play_store,
  in?: string,
  not_in?: string
}
```

```ts theme={null}
{
  is?: true | false
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

```ts theme={null}
{
  subscription?: {
    id?: string | null,
    currency_code?: string | null,
    billing_period?: number | null,
    billing_period_unit?: string | null,
    start_date?: number | null,
    trial_end?: number | null,
    remaining_billing_cycles?: number | null,
    po_number?: string | null,
    auto_collection?: string | null,
    plan_quantity_in_decimal?: string | null,
    plan_unit_price_in_decimal?: string | null,
    customer_id?: string | null,
    status?: string | null,
    trial_start?: number | null,
    trial_end_action?: string | null,
    current_term_start?: number | null,
    current_term_end?: number | null,
    next_billing_at?: number | null,
    created_at?: number | null,
    started_at?: number | null,
    activated_at?: number | null,
    contract_term_billing_cycle_on_renewal?: number | null,
    override_relationship?: boolean | null,
    pause_date?: number | null,
    resume_date?: number | null,
    cancelled_at?: number | null,
    cancel_reason?: string | null,
    created_from_ip?: string | null,
    resource_version?: number | null,
    updated_at?: number | null,
    has_scheduled_advance_invoices?: boolean | null,
    has_scheduled_changes?: boolean | null,
    payment_source_id?: string | null,
    plan_free_quantity_in_decimal?: string | null,
    plan_amount_in_decimal?: string | null,
    cancel_schedule_created_at?: number | null,
    offline_payment_method?: string | null,
    channel?: string | null,
    net_term_days?: number | null,
    active_id?: string | null,
    due_invoices_count?: number | null,
    due_since?: number | null,
    total_dues?: number | null,
    mrr?: number | null,
    exchange_rate?: number | null,
    base_currency_code?: string | null,
    invoice_notes?: string | null,
    meta_data?: {
    } | null,
    deleted?: boolean | null,
    changes_scheduled_at?: number | null,
    cancel_reason_code?: string | null,
    free_period?: number | null,
    free_period_unit?: string | null,
    create_pending_invoices?: boolean | null,
    auto_close_invoices?: boolean | null,
    business_entity_id?: string | null,
    decommissioned?: boolean | null,
    brand_id?: string | null,
    subscription_items?: {
      item_price_id?: string | null,
      item_type?: string | null,
      quantity?: number | null,
      quantity_in_decimal?: string | null,
      unit_price?: number | null,
      unit_price_in_decimal?: string | null,
      amount?: number | null,
      current_term_start?: number | null,
      current_term_end?: number | null,
      next_billing_at?: number | null,
      amount_in_decimal?: string | null,
      billing_period?: number | null,
      billing_period_unit?: string | null,
      free_quantity?: number | null,
      free_quantity_in_decimal?: string | null,
      trial_end?: number | null,
      billing_cycles?: number | null,
      service_period_days?: number | null,
      charge_on_event?: string | null,
      charge_once?: boolean | null,
      charge_on_option?: string | null,
      proration_type?: string | null,
      usage_accumulation_reset_frequency?: string | null,
      description?: string | null
    }[] | null,
    item_tiers?: {
      item_price_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      price?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      price_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null,
      index?: number | null
    }[] | null,
    charged_items?: {
      item_price_id?: string | null,
      last_charged_at?: number | null
    }[] | null,
    coupons?: {
      coupon_id?: string | null,
      apply_till?: number | null,
      applied_count?: number | null,
      coupon_code?: string | null
    }[] | null,
    shipping_address?: {
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    } | null,
    referral_info?: {
      referral_code?: string | null,
      coupon_code?: string | null,
      referrer_id?: string | null,
      external_reference_id?: string | null,
      reward_status?: string | null,
      referral_system?: string | null,
      account_id?: string | null,
      campaign_id?: string | null,
      external_campaign_id?: string | null,
      friend_offer_type?: string | null,
      referrer_reward_type?: string | null,
      notify_referral_system?: string | null,
      destination_url?: string | null,
      post_purchase_widget_enabled?: boolean | null
    } | null,
    billing_override?: {
      max_excess_payment_usage?: number | null,
      max_refundable_credits_usage?: number | null
    } | null,
    contract_term?: {
      id?: string | null,
      status?: string | null,
      contract_start?: number | null,
      contract_end?: number | null,
      billing_cycle?: number | null,
      action_at_term_end?: string | null,
      total_contract_value?: number | null,
      total_contract_value_before_tax?: number | null,
      cancellation_cutoff_period?: number | null,
      created_at?: number | null,
      subscription_id?: string | null,
      remaining_billing_cycles?: number | null
    } | null,
    discounts?: {
      id?: string | null,
      invoice_name?: string | null,
      description?: string | null,
      type?: string | null,
      percentage?: number | null,
      amount?: number | null,
      quantity?: number | null,
      currency_code?: string | null,
      duration_type?: string | null,
      period?: number | null,
      period_unit?: string | null,
      included_in_mrr?: boolean | null,
      apply_on?: string | null,
      item_price_id?: string | null,
      created_at?: number | null,
      apply_till?: number | null,
      applied_count?: number | null,
      coupon_id?: string | null,
      index?: number | null
    }[] | null
  } | null,
  customer?: {
    id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    phone?: string | null,
    company?: string | null,
    vat_number?: string | null,
    auto_collection?: string | null,
    offline_payment_method?: string | null,
    net_term_days?: number | null,
    vat_number_validated_time?: number | null,
    vat_number_status?: string | null,
    allow_direct_debit?: boolean | null,
    is_location_valid?: boolean | null,
    created_at?: number | null,
    created_from_ip?: string | null,
    exemption_details?: any[] | null,
    taxability?: string | null,
    entity_code?: string | null,
    exempt_number?: string | null,
    resource_version?: number | null,
    updated_at?: number | null,
    locale?: string | null,
    billing_date?: number | null,
    billing_month?: number | null,
    billing_date_mode?: string | null,
    billing_day_of_week?: string | null,
    billing_day_of_week_mode?: string | null,
    pii_cleared?: string | null,
    auto_close_invoices?: boolean | null,
    channel?: string | null,
    active_id?: string | null,
    fraud_flag?: string | null,
    primary_payment_source_id?: string | null,
    backup_payment_source_id?: string | null,
    invoice_notes?: string | null,
    business_entity_id?: string | null,
    preferred_currency_code?: string | null,
    promotional_credits?: number | null,
    unbilled_charges?: number | null,
    refundable_credits?: number | null,
    excess_payments?: number | null,
    is_einvoice_enabled?: boolean | null,
    einvoicing_method?: string | null,
    meta_data?: {
    } | null,
    deleted?: boolean | null,
    registered_for_gst?: boolean | null,
    consolidated_invoicing?: boolean | null,
    customer_type?: string | null,
    business_customer_without_vat_number?: boolean | null,
    client_profile_id?: string | null,
    use_default_hierarchy_settings?: boolean | null,
    vat_number_prefix?: string | null,
    entity_identifier_scheme?: string | null,
    entity_identifier_standard?: string | null,
    brand_id?: string | null,
    billing_address?: {
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    } | null,
    referral_urls?: {
      external_customer_id?: string | null,
      referral_sharing_url?: string | null,
      created_at?: number | null,
      updated_at?: number | null,
      referral_campaign_id?: string | null,
      referral_account_id?: string | null,
      referral_external_campaign_id?: string | null,
      referral_system?: string | null
    }[] | null,
    contacts?: {
      id?: string | null,
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      phone?: string | null,
      label?: string | null,
      enabled?: boolean | null,
      send_account_email?: boolean | null,
      send_billing_email?: boolean | null
    }[] | null,
    payment_method?: {
      type?: string | null,
      gateway?: string | null,
      gateway_account_id?: string | null,
      status?: string | null,
      reference_id?: string | null
    } | null,
    balances?: {
      promotional_credits?: number | null,
      excess_payments?: number | null,
      refundable_credits?: number | null,
      unbilled_charges?: number | null,
      currency_code?: string | null,
      business_entity_id?: string | null
    }[] | null,
    entity_identifiers?: {
      id?: string | null,
      value?: string | null,
      scheme?: string | null,
      standard?: string | null
    }[] | null,
    tax_providers_fields?: {
      provider_name?: string | null,
      field_id?: string | null,
      field_value?: string | null
    }[] | null,
    relationship?: {
      parent_id?: string | null,
      payment_owner_id?: string | null,
      invoice_owner_id?: string | null
    } | null,
    parent_account_access?: {
      portal_edit_child_subscriptions?: string | null,
      portal_download_child_invoices?: string | null,
      send_subscription_emails?: boolean | null,
      send_invoice_emails?: boolean | null,
      send_payment_emails?: boolean | null
    } | null,
    child_account_access?: {
      portal_edit_subscriptions?: string | null,
      portal_download_invoices?: string | null,
      send_subscription_emails?: boolean | null,
      send_invoice_emails?: boolean | null,
      send_payment_emails?: boolean | null
    } | null
  } | null,
  card?: {
    payment_source_id?: string | null,
    status?: string | null,
    gateway?: string | null,
    gateway_account_id?: string | null,
    ref_tx_id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    iin?: string | null,
    last4?: string | null,
    card_type?: string | null,
    funding_type?: string | null,
    expiry_month?: number | null,
    expiry_year?: number | null,
    issuing_country?: string | null,
    billing_addr1?: string | null,
    billing_addr2?: string | null,
    billing_city?: string | null,
    billing_state_code?: string | null,
    billing_state?: string | null,
    billing_country?: string | null,
    billing_zip?: string | null,
    created_at?: number | null,
    resource_version?: number | null,
    updated_at?: number | null,
    ip_address?: string | null,
    powered_by?: string | null,
    customer_id?: string | null,
    masked_number?: string | null
  } | null
}[] | null
```

***

### listAlertStatuses

`subscriptions.listAlertStatuses`

List alert statuses for a subscription. Returns the runtime state of all alerts for a given subscription. Each entry in the response indicates whether the subscription is within\_limit or in\_alarm for a specific alert. Use this endpoint to build a subscription-level dashboard showing which thresholds have been breached and when.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.subscriptions.listAlertStatuses({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `limit` | `number` | No | optional, integer Maximum number of results to return. **Example →** *limit = 10* |
| `offset` | `string` | No | optional, string Pagination cursor returned by a previous list call. Use the `next_offset` value from the previous response. |
| `alarm_status` | `object` | No | optional, enumerated string filter Filter by [alarm\_status](https://docs.corsair.dev/docs/api/alert_statuses/alert-status-object#alarm_status) to find alerts in a specific runtime state. **Example →** *alarm\_status\\\[is\\] = "in\_alarm"* |
| `alert_id` | `object` | No | optional, string filter Filter by [alert\_id](https://docs.corsair.dev/docs/api/alert_statuses/alert-status-object#alert_id) to find the status for a specific alert. **Example →** *alert\_id\\\[is\\] = "alert\_\_\_dev\_\_3Nl7purV3LwbKYH"* |

```ts theme={null}
{
  is?: within_limit | in_alarm
}
```

```ts theme={null}
{
  in?: string
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | Returned only if more results are available. Pass this value as `offset` in the next request to fetch the next page. |

```ts theme={null}
{
  alert_status?: {
    alert_id?: string | null,
    subscription_id?: string | null,
    alarm_status?: string | null,
    alarm_triggered_at?: number | null
  } | null
}[] | null
```

***

### listApplicableAlerts

`subscriptions.listApplicableAlerts`

List applicable alerts for a subscription. Returns the effective set of alert configurations for a given subscription. This includes global alerts (filtered by the subscription's plan) and any subscription-scoped alerts, giving you a single view of all threshold rules in force.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.subscriptions.listApplicableAlerts({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `limit` | `number` | No | optional, integer Maximum number of results to return. **Example →** *limit = 25* |
| `offset` | `string` | No | optional, string Pagination cursor returned by a previous list call. Use the `next_offset` value from the previous response. |
| `status` | `object` | No | optional, enumerated string filter Filter by [status](https://docs.corsair.dev/docs/api/alerts/alert-object#status). **Example →** *status\\\[is\\] = "enabled"* |
| `type` | `object` | No | optional, enumerated string filter Filter by [type](https://docs.corsair.dev/docs/api/alerts/alert-object#type). Supported values are `usage_exceeded`, `spend_exceeded`, and `credit_balance_dropped`. **Example →** *type\\\[is\\] = "credit\_balance\_dropped"* |

```ts theme={null}
{
  is?: enabled | disabled
}
```

```ts theme={null}
{
  is?: usage_exceeded | spend_exceeded | credit_balance_dropped
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | Returned only if more results are available. Pass this value as `offset` in the next request to fetch the next page. |

```ts theme={null}
{
  alert?: {
    id?: string | null,
    type?: string | null,
    name?: string | null,
    description?: string | null,
    metered_feature_id?: string | null,
    currency_code?: string | null,
    unit_id?: string | null,
    subscription_id?: string | null,
    status?: string | null,
    meta?: string | null,
    created_at?: number | null,
    updated_at?: number | null,
    threshold?: {
      mode?: string | null,
      value?: number | null
    } | null,
    filter_conditions?: {
      field?: string | null,
      operator?: string | null,
      value?: string | null
    }[] | null
  } | null
}[] | null
```

***

### listContractTerms

`subscriptions.listContractTerms`

List contract terms for a subscription. Retrieves a list of contract term resources for the subscription specified in the path. Warning This API will return an error when multi-frequency billing is enabled.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.subscriptions.listContractTerms({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `sort_by` | `object` | No | optional, string filter Sorts based on the specified attribute. **Supported attributes :** created\_at **Supported sort-orders :** asc, desc **Example →** *sort\_by\\\[asc\\] = "created\_at"* This will sort the result based on the 'created\_at' attribute in ascending (earliest first) order. |

```ts theme={null}
{
  asc?: created_at,
  desc?: created_at
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

```ts theme={null}
{
  contract_term?: {
    id?: string | null,
    status?: string | null,
    contract_start?: number | null,
    contract_end?: number | null,
    billing_cycle?: number | null,
    action_at_term_end?: string | null,
    total_contract_value?: number | null,
    total_contract_value_before_tax?: number | null,
    cancellation_cutoff_period?: number | null,
    created_at?: number | null,
    subscription_id?: string | null,
    remaining_billing_cycles?: number | null
  } | null
}[] | null
```

***

### listDiscounts

`subscriptions.listDiscounts`

List discounts for a subscription. Retrieves a list of discount resources currently attached to a specific subscription. The list is sorted in descending order based on the created\_at timestamp. Note This endpoint does not return coupon or coupon\_code resources.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.subscriptions.listDiscounts({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

```ts theme={null}
{
  discount?: {
    id?: string | null,
    invoice_name?: string | null,
    description?: string | null,
    type?: string | null,
    percentage?: number | null,
    amount?: number | null,
    quantity?: number | null,
    currency_code?: string | null,
    duration_type?: string | null,
    period?: number | null,
    period_unit?: string | null,
    included_in_mrr?: boolean | null,
    apply_on?: string | null,
    item_price_id?: string | null,
    created_at?: number | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_id?: string | null,
    index?: number | null
  } | null
}[] | null
```

***

### listEntitlementOverrides

`subscriptions.listEntitlementOverrides`

List entitlement overrides for a subscription. Retrieve the list of entitlement overrides for a subscription.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.subscriptions.listEntitlementOverrides({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

```ts theme={null}
{
  entitlement_override?: {
    id?: string | null,
    subscription_id?: string | null,
    entity_id?: string | null,
    entity_type?: string | null,
    feature_id?: string | null,
    feature_name?: string | null,
    value?: string | null,
    name?: string | null,
    expires_at?: number | null,
    effective_from?: number | null,
    is_enabled?: boolean | null
  } | null
}[] | null
```

***

### listEntitlements

`subscriptions.listEntitlements`

List subscription entitlements. Retrieves the list of subscription\_entitlements for the subscription. Note: The components attribute is not returned for any of the subscription\_entitlements. Use the retrieve operation(coming soon) to obtain the components.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.subscriptions.listEntitlements({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

```ts theme={null}
{
  subscription_entitlement?: {
    subscription_id?: string | null,
    feature_id?: string | null,
    feature_name?: string | null,
    feature_unit?: string | null,
    feature_type?: string | null,
    value?: string | null,
    name?: string | null,
    is_overridden?: boolean | null,
    is_enabled?: boolean | null,
    expires_at?: number | null,
    components?: {
      entitlement_overrides?: {
        value?: string | null,
        name?: string | null
      } | null
    } | null
  } | null
}[] | null
```

***

### move

`subscriptions.move`

Move a subscription. Moves a subscription from one customer to another asynchronously. All related resources such as unbilled\_charge, invoice, credit\_note, and transaction are also moved to the new customer.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.subscriptions.move({ subscriptionId: 'sub_8gsnbYfsMLds', to_customer_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `to_customer_id` | `string` | Yes | Specifies the unique ID of the `customer` resource to which the subscription will be moved. **Note** : If there are [multiple business entities](https://docs.corsair.dev/docs/api/advanced-features) , the `customer.business_entity_id` of the destination customer must match the `subscription.business_entity_id`. |
| `copy_payment_source` | `boolean` | No | **When `true`:** If the subscription has an [associated `payment_source`](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#payment_source_id): 1. A new duplicate copy of the `payment_source` resource is created. 2. This new copy of the payment source is linked to the subscription and the destination customer. **Note** : Deleting any copy of the `payment_source` also deletes the other copies and the details stored at the payment gateway. **When `false`:** No new payment source is created for the subscription. Moreover, if a `payment_source` is already [linked](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#payment_source_id) to the subscription, it gets removed, meaning the `subscription.payment_source_id` is cleared. **Warning** : When `copy_payment_source` is `false` and if [subscription.auto\_collection](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items#auto_collection) is enabled, auto-collection will fail, in turn preventing subscription renewal. To prevent auto-collection failure, [link a payment source](https://docs.corsair.dev/docs/api/subscriptions/override-billing-profile) to the subscription after this operation. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `subscription` | `object \| null` | No | A Chargebee subscription connects a customer record to products/services. It describes what the customer has signed up for and how often they're charged for it. The essential components of a subscription are: \* A [plan-item price](https://docs.corsair.dev/docs/api/item_prices). \* Any addon- and charge-item prices applied to the subscription. \* Any [coupons](https://docs.corsair.dev/docs/api/coupons) applied. \* Any [discounts](https://docs.corsair.dev/docs/api/discounts) applied. The charges in a subscription are billed via invoices. **Note:** The maximum number of subscriptions for any given [customer](https://docs.corsair.dev/docs/api/customers) ([active](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#status) or not) is 900. #### Subscription billing frequencies Chargebee offers two billing frequency options for subscriptions: \* **Plan-based billing** (`default`): Subscriptions are billed based on the billing period defined for the item price of the `item_type` `plan`. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/subscriptions#plan-based-billing). \* **Multi-frequency billing** : Subscriptions are billed according to the billing period of each recurring item price within the subscription. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing). **Important** [Limitations](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing#limitations) of Multi-frequency billing. The selection of the billing frequency preference is configured at the site level. #### Item price compatibility in a subscription When creating or updating a subscription, one of the item prices specified under subscription\_items must be a plan-item price. The remaining must be compatible addon- or charge-item prices. An item price is compatible with a plan-item price if their currencies are the same. Additionally, an addon-item price is compatible with a plan-item price only if their billing frequencies meet the following conditions: \| `period_unit` for plan-item price \| Compatible `period_unit` for addon-item price \| Compatible period for addon-item price \| \|-----------------------------------\|-----------------------------------------------\|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `day` \| `day` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `10`, then the period of the addon-item price can be `10`, `5`, `2`, or `1`. \| \| `week` \| `week` or `day` \| The `period` (in days) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the period of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `week`, `period` can be `2` or `1`. \* for `period_unit` as `day`, `period` can be `14`, `7`, `2`, or `1`. \| \| `month` \| `month` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `6`, then the `period` of the addon-item price can be `6`, `3`, `2`, or `1`. \| \| `year` \| `year` or `month` \| The `period` (in months) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the `period` of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `year`, `period` can be `2` or `1`. \* for `period_unit` as `month`, `period` can be `24`, `12`, `8`, `6`, `4`, `3`, `2`, or `1`. \| #### Tax provider fields **Avalara** : Merchants using **Avalara Sales Tax** can optionally associate each item price with a locationCode (from their Avalara company locations), so tax can be resolved correctly at the line item level. \| Field ID \| Field Value \| APIs \| \|--------------------------------------------------------------------------------\|----------------------------------------------------------------------\|--------------------------------------------------------------------------------\| \| `locationCode` \| Merchant to configure it on Avalara Platform under company locations \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| **Anrok**: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation \| Field ID \| Field Value \| APIs \| \|---------------------------------------------------------------------------------------------------------------------------------------\|---------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------\| \| `additionalTaxRegistrationNumber` \| Canadian tax registration numbers in comma separated fashion. \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| **Vertex**: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration **Note:** Field Id like `customerCode` , `customerClass` , and`taxExempted` belong to the customer object. Field Id like `productCode` , `productClass` , `productTaxCode` , and `productClass` belong to the product object. \| Field ID \| Field Value \| APIs \| \|-----------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productCode` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `customerCode` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `customerClass` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **Taxamo:** Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration \| Field Id \| Field Value \| APIs \| \|------------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productTaxCode` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `taxExempted` \| Merchant to configure it on Taxamo Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **cbtaxes**: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India. \| Field ID \| Field Value \| APIs \| \|---------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `indiaSez` \| `SEZ_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaSez` \| `SEZ_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **All**: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level \| Field ID \| Field Value \| APIs \| \|-------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `priceType` \| `TAX_INCLUSIVE` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| \| `TAX_EXCLUSIVE` \| \| \| \| `SITE_DEFAULT` or blank \| Removes price type override, and allows site level configuration to be used for tax calculation. \| #### Ramps API compatibility mode If you want to schedule changes on a subscription, use the [Ramps API](https://docs.corsair.dev/docs/api/ramps). If you are currently scheduling changes through the [Update subscription API](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items), migrate to the Ramps API. To get started, [request access for Subscription Ramps](https://app.chargebee.com/login?forward=https://app.chargebee.com/request_access/subscription-ramps\&ref=feature). Chargebee will enable Ramps compatibility mode for your site. Once enabled, you can test the Ramps API without impacting your existing integrations. The following parts of the Billing API have subtle differences in behavior when the Ramps feature is disabled versus when it is enabled with compatibility mode. (Follow the links to learn more.) \* The value of the [`subscription.has_scheduled_changes`](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#has_scheduled_changes) attribute. \* [Update subscription](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#impact-scheduled-changes) \* [Create Checkout for updating a subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription#impact-scheduled-changes) \* [Remove scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/remove-scheduled-changes) \* [Retrieve with scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/retrieve-with-scheduled-changes) \* [Create a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/create-a-quote-for-update-subscription-items) \* [Edit a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/edit-update-subscription-quote-for-items) \* [Portal sessions](https://docs.corsair.dev/docs/api/portal_sessions#scheduled-subscription-changes) |

```ts theme={null}
{
  id?: string | null,
  currency_code?: string | null,
  billing_period?: number | null,
  billing_period_unit?: string | null,
  start_date?: number | null,
  trial_end?: number | null,
  remaining_billing_cycles?: number | null,
  po_number?: string | null,
  auto_collection?: string | null,
  plan_quantity_in_decimal?: string | null,
  plan_unit_price_in_decimal?: string | null,
  customer_id?: string | null,
  status?: string | null,
  trial_start?: number | null,
  trial_end_action?: string | null,
  current_term_start?: number | null,
  current_term_end?: number | null,
  next_billing_at?: number | null,
  created_at?: number | null,
  started_at?: number | null,
  activated_at?: number | null,
  contract_term_billing_cycle_on_renewal?: number | null,
  override_relationship?: boolean | null,
  pause_date?: number | null,
  resume_date?: number | null,
  cancelled_at?: number | null,
  cancel_reason?: string | null,
  created_from_ip?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  has_scheduled_advance_invoices?: boolean | null,
  has_scheduled_changes?: boolean | null,
  payment_source_id?: string | null,
  plan_free_quantity_in_decimal?: string | null,
  plan_amount_in_decimal?: string | null,
  cancel_schedule_created_at?: number | null,
  offline_payment_method?: string | null,
  channel?: string | null,
  net_term_days?: number | null,
  active_id?: string | null,
  due_invoices_count?: number | null,
  due_since?: number | null,
  total_dues?: number | null,
  mrr?: number | null,
  exchange_rate?: number | null,
  base_currency_code?: string | null,
  invoice_notes?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  changes_scheduled_at?: number | null,
  cancel_reason_code?: string | null,
  free_period?: number | null,
  free_period_unit?: string | null,
  create_pending_invoices?: boolean | null,
  auto_close_invoices?: boolean | null,
  business_entity_id?: string | null,
  decommissioned?: boolean | null,
  brand_id?: string | null,
  subscription_items?: {
    item_price_id?: string | null,
    item_type?: string | null,
    quantity?: number | null,
    quantity_in_decimal?: string | null,
    unit_price?: number | null,
    unit_price_in_decimal?: string | null,
    amount?: number | null,
    current_term_start?: number | null,
    current_term_end?: number | null,
    next_billing_at?: number | null,
    amount_in_decimal?: string | null,
    billing_period?: number | null,
    billing_period_unit?: string | null,
    free_quantity?: number | null,
    free_quantity_in_decimal?: string | null,
    trial_end?: number | null,
    billing_cycles?: number | null,
    service_period_days?: number | null,
    charge_on_event?: string | null,
    charge_once?: boolean | null,
    charge_on_option?: string | null,
    proration_type?: string | null,
    usage_accumulation_reset_frequency?: string | null,
    description?: string | null
  }[] | null,
  item_tiers?: {
    item_price_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    price?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    price_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null,
    index?: number | null
  }[] | null,
  charged_items?: {
    item_price_id?: string | null,
    last_charged_at?: number | null
  }[] | null,
  coupons?: {
    coupon_id?: string | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_code?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_info?: {
    referral_code?: string | null,
    coupon_code?: string | null,
    referrer_id?: string | null,
    external_reference_id?: string | null,
    reward_status?: string | null,
    referral_system?: string | null,
    account_id?: string | null,
    campaign_id?: string | null,
    external_campaign_id?: string | null,
    friend_offer_type?: string | null,
    referrer_reward_type?: string | null,
    notify_referral_system?: string | null,
    destination_url?: string | null,
    post_purchase_widget_enabled?: boolean | null
  } | null,
  billing_override?: {
    max_excess_payment_usage?: number | null,
    max_refundable_credits_usage?: number | null
  } | null,
  contract_term?: {
    id?: string | null,
    status?: string | null,
    contract_start?: number | null,
    contract_end?: number | null,
    billing_cycle?: number | null,
    action_at_term_end?: string | null,
    total_contract_value?: number | null,
    total_contract_value_before_tax?: number | null,
    cancellation_cutoff_period?: number | null,
    created_at?: number | null,
    subscription_id?: string | null,
    remaining_billing_cycles?: number | null
  } | null,
  discounts?: {
    id?: string | null,
    invoice_name?: string | null,
    description?: string | null,
    type?: string | null,
    percentage?: number | null,
    amount?: number | null,
    quantity?: number | null,
    currency_code?: string | null,
    duration_type?: string | null,
    period?: number | null,
    period_unit?: string | null,
    included_in_mrr?: boolean | null,
    apply_on?: string | null,
    item_price_id?: string | null,
    created_at?: number | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_id?: string | null,
    index?: number | null
  }[] | null
} | null
```

***

### overrideBillingProfile

`subscriptions.overrideBillingProfile`

Override billing profile. Assigns the payment source and sets auto collection state for the subscription. When you don't pass any input param for this API, payment source and auto collection for the subscription will be the same as the customer's default settings.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.subscriptions.overrideBillingProfile({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `payment_source_id` | `string` | No | Unique identifier of the payment source to be attached to this subscription. |
| `auto_collection` | `on \| off` | No | Defines whether payments need to be collected automatically for this subscription. Overrides customer's auto-collection property. \* off - Automatic collection of charges will not be made for this subscription. Use this for offline payments. \* on - Whenever an invoice is created for this subscription, an automatic charge will be attempted on the payment method available. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `subscription` | `object \| null` | No | A Chargebee subscription connects a customer record to products/services. It describes what the customer has signed up for and how often they're charged for it. The essential components of a subscription are: \* A [plan-item price](https://docs.corsair.dev/docs/api/item_prices). \* Any addon- and charge-item prices applied to the subscription. \* Any [coupons](https://docs.corsair.dev/docs/api/coupons) applied. \* Any [discounts](https://docs.corsair.dev/docs/api/discounts) applied. The charges in a subscription are billed via invoices. **Note:** The maximum number of subscriptions for any given [customer](https://docs.corsair.dev/docs/api/customers) ([active](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#status) or not) is 900. #### Subscription billing frequencies Chargebee offers two billing frequency options for subscriptions: \* **Plan-based billing** (`default`): Subscriptions are billed based on the billing period defined for the item price of the `item_type` `plan`. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/subscriptions#plan-based-billing). \* **Multi-frequency billing** : Subscriptions are billed according to the billing period of each recurring item price within the subscription. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing). **Important** [Limitations](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing#limitations) of Multi-frequency billing. The selection of the billing frequency preference is configured at the site level. #### Item price compatibility in a subscription When creating or updating a subscription, one of the item prices specified under subscription\_items must be a plan-item price. The remaining must be compatible addon- or charge-item prices. An item price is compatible with a plan-item price if their currencies are the same. Additionally, an addon-item price is compatible with a plan-item price only if their billing frequencies meet the following conditions: \| `period_unit` for plan-item price \| Compatible `period_unit` for addon-item price \| Compatible period for addon-item price \| \|-----------------------------------\|-----------------------------------------------\|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `day` \| `day` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `10`, then the period of the addon-item price can be `10`, `5`, `2`, or `1`. \| \| `week` \| `week` or `day` \| The `period` (in days) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the period of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `week`, `period` can be `2` or `1`. \* for `period_unit` as `day`, `period` can be `14`, `7`, `2`, or `1`. \| \| `month` \| `month` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `6`, then the `period` of the addon-item price can be `6`, `3`, `2`, or `1`. \| \| `year` \| `year` or `month` \| The `period` (in months) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the `period` of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `year`, `period` can be `2` or `1`. \* for `period_unit` as `month`, `period` can be `24`, `12`, `8`, `6`, `4`, `3`, `2`, or `1`. \| #### Tax provider fields **Avalara** : Merchants using **Avalara Sales Tax** can optionally associate each item price with a locationCode (from their Avalara company locations), so tax can be resolved correctly at the line item level. \| Field ID \| Field Value \| APIs \| \|--------------------------------------------------------------------------------\|----------------------------------------------------------------------\|--------------------------------------------------------------------------------\| \| `locationCode` \| Merchant to configure it on Avalara Platform under company locations \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| **Anrok**: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation \| Field ID \| Field Value \| APIs \| \|---------------------------------------------------------------------------------------------------------------------------------------\|---------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------\| \| `additionalTaxRegistrationNumber` \| Canadian tax registration numbers in comma separated fashion. \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| **Vertex**: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration **Note:** Field Id like `customerCode` , `customerClass` , and`taxExempted` belong to the customer object. Field Id like `productCode` , `productClass` , `productTaxCode` , and `productClass` belong to the product object. \| Field ID \| Field Value \| APIs \| \|-----------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productCode` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `customerCode` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `customerClass` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **Taxamo:** Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration \| Field Id \| Field Value \| APIs \| \|------------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productTaxCode` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `taxExempted` \| Merchant to configure it on Taxamo Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **cbtaxes**: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India. \| Field ID \| Field Value \| APIs \| \|---------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `indiaSez` \| `SEZ_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaSez` \| `SEZ_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **All**: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level \| Field ID \| Field Value \| APIs \| \|-------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `priceType` \| `TAX_INCLUSIVE` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| \| `TAX_EXCLUSIVE` \| \| \| \| `SITE_DEFAULT` or blank \| Removes price type override, and allows site level configuration to be used for tax calculation. \| #### Ramps API compatibility mode If you want to schedule changes on a subscription, use the [Ramps API](https://docs.corsair.dev/docs/api/ramps). If you are currently scheduling changes through the [Update subscription API](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items), migrate to the Ramps API. To get started, [request access for Subscription Ramps](https://app.chargebee.com/login?forward=https://app.chargebee.com/request_access/subscription-ramps\&ref=feature). Chargebee will enable Ramps compatibility mode for your site. Once enabled, you can test the Ramps API without impacting your existing integrations. The following parts of the Billing API have subtle differences in behavior when the Ramps feature is disabled versus when it is enabled with compatibility mode. (Follow the links to learn more.) \* The value of the [`subscription.has_scheduled_changes`](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#has_scheduled_changes) attribute. \* [Update subscription](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#impact-scheduled-changes) \* [Create Checkout for updating a subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription#impact-scheduled-changes) \* [Remove scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/remove-scheduled-changes) \* [Retrieve with scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/retrieve-with-scheduled-changes) \* [Create a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/create-a-quote-for-update-subscription-items) \* [Edit a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/edit-update-subscription-quote-for-items) \* [Portal sessions](https://docs.corsair.dev/docs/api/portal_sessions#scheduled-subscription-changes) |
| `payment_source` | `object \| null` | No | **Updates** This API obsoletes the [Cards API](https://docs.corsair.dev/docs/api/cards) in Chargebee. Represents the payment source for the customer. Specific types of payment source (Card, Direct Debit, Paypal Express Checkout, etc.) is defined as sub-resource in the response object. You can find the list of supported payment sources and the expected input parameters [here](https://docs.corsair.dev/docs/api/payment_parameters). See [Payment source attributes](https://docs.corsair.dev/docs/api/payment_sources/payment-source-object) for a descriptive list of attributes and payment source types. |

```ts theme={null}
{
  id?: string | null,
  currency_code?: string | null,
  billing_period?: number | null,
  billing_period_unit?: string | null,
  start_date?: number | null,
  trial_end?: number | null,
  remaining_billing_cycles?: number | null,
  po_number?: string | null,
  auto_collection?: string | null,
  plan_quantity_in_decimal?: string | null,
  plan_unit_price_in_decimal?: string | null,
  customer_id?: string | null,
  status?: string | null,
  trial_start?: number | null,
  trial_end_action?: string | null,
  current_term_start?: number | null,
  current_term_end?: number | null,
  next_billing_at?: number | null,
  created_at?: number | null,
  started_at?: number | null,
  activated_at?: number | null,
  contract_term_billing_cycle_on_renewal?: number | null,
  override_relationship?: boolean | null,
  pause_date?: number | null,
  resume_date?: number | null,
  cancelled_at?: number | null,
  cancel_reason?: string | null,
  created_from_ip?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  has_scheduled_advance_invoices?: boolean | null,
  has_scheduled_changes?: boolean | null,
  payment_source_id?: string | null,
  plan_free_quantity_in_decimal?: string | null,
  plan_amount_in_decimal?: string | null,
  cancel_schedule_created_at?: number | null,
  offline_payment_method?: string | null,
  channel?: string | null,
  net_term_days?: number | null,
  active_id?: string | null,
  due_invoices_count?: number | null,
  due_since?: number | null,
  total_dues?: number | null,
  mrr?: number | null,
  exchange_rate?: number | null,
  base_currency_code?: string | null,
  invoice_notes?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  changes_scheduled_at?: number | null,
  cancel_reason_code?: string | null,
  free_period?: number | null,
  free_period_unit?: string | null,
  create_pending_invoices?: boolean | null,
  auto_close_invoices?: boolean | null,
  business_entity_id?: string | null,
  decommissioned?: boolean | null,
  brand_id?: string | null,
  subscription_items?: {
    item_price_id?: string | null,
    item_type?: string | null,
    quantity?: number | null,
    quantity_in_decimal?: string | null,
    unit_price?: number | null,
    unit_price_in_decimal?: string | null,
    amount?: number | null,
    current_term_start?: number | null,
    current_term_end?: number | null,
    next_billing_at?: number | null,
    amount_in_decimal?: string | null,
    billing_period?: number | null,
    billing_period_unit?: string | null,
    free_quantity?: number | null,
    free_quantity_in_decimal?: string | null,
    trial_end?: number | null,
    billing_cycles?: number | null,
    service_period_days?: number | null,
    charge_on_event?: string | null,
    charge_once?: boolean | null,
    charge_on_option?: string | null,
    proration_type?: string | null,
    usage_accumulation_reset_frequency?: string | null,
    description?: string | null
  }[] | null,
  item_tiers?: {
    item_price_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    price?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    price_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null,
    index?: number | null
  }[] | null,
  charged_items?: {
    item_price_id?: string | null,
    last_charged_at?: number | null
  }[] | null,
  coupons?: {
    coupon_id?: string | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_code?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_info?: {
    referral_code?: string | null,
    coupon_code?: string | null,
    referrer_id?: string | null,
    external_reference_id?: string | null,
    reward_status?: string | null,
    referral_system?: string | null,
    account_id?: string | null,
    campaign_id?: string | null,
    external_campaign_id?: string | null,
    friend_offer_type?: string | null,
    referrer_reward_type?: string | null,
    notify_referral_system?: string | null,
    destination_url?: string | null,
    post_purchase_widget_enabled?: boolean | null
  } | null,
  billing_override?: {
    max_excess_payment_usage?: number | null,
    max_refundable_credits_usage?: number | null
  } | null,
  contract_term?: {
    id?: string | null,
    status?: string | null,
    contract_start?: number | null,
    contract_end?: number | null,
    billing_cycle?: number | null,
    action_at_term_end?: string | null,
    total_contract_value?: number | null,
    total_contract_value_before_tax?: number | null,
    cancellation_cutoff_period?: number | null,
    created_at?: number | null,
    subscription_id?: string | null,
    remaining_billing_cycles?: number | null
  } | null,
  discounts?: {
    id?: string | null,
    invoice_name?: string | null,
    description?: string | null,
    type?: string | null,
    percentage?: number | null,
    amount?: number | null,
    quantity?: number | null,
    currency_code?: string | null,
    duration_type?: string | null,
    period?: number | null,
    period_unit?: string | null,
    included_in_mrr?: boolean | null,
    apply_on?: string | null,
    item_price_id?: string | null,
    created_at?: number | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_id?: string | null,
    index?: number | null
  }[] | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  created_at?: number | null,
  customer_id?: string | null,
  type?: string | null,
  reference_id?: string | null,
  status?: string | null,
  gateway?: string | null,
  gateway_account_id?: string | null,
  ip_address?: string | null,
  issuing_country?: string | null,
  vault_token?: {
  } | null,
  deleted?: boolean | null,
  business_entity_id?: string | null,
  brand_id?: string | null,
  card?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    iin?: string | null,
    last4?: string | null,
    brand?: string | null,
    funding_type?: string | null,
    expiry_month?: number | null,
    expiry_year?: number | null,
    billing_addr1?: string | null,
    billing_addr2?: string | null,
    billing_city?: string | null,
    billing_state_code?: string | null,
    billing_state?: string | null,
    billing_country?: string | null,
    billing_zip?: string | null,
    masked_number?: string | null
  } | null,
  bank_account?: {
    last4?: string | null,
    name_on_account?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    direct_debit_scheme?: string | null,
    bank_name?: string | null,
    mandate_id?: string | null,
    account_type?: string | null,
    echeck_type?: string | null,
    account_holder_type?: string | null,
    email?: string | null
  } | null,
  boleto?: {
    last4?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null
  } | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  amazon_payment?: {
    email?: string | null,
    agreement_id?: string | null
  } | null,
  upi?: {
    vpa?: string | null
  } | null,
  paypal?: {
    email?: string | null,
    agreement_id?: string | null
  } | null,
  venmo?: {
    user_name?: string | null
  } | null,
  klarna_pay_now?: {
    email?: string | null
  } | null,
  mandates?: {
    id?: string | null,
    subscription_id?: string | null,
    created_at?: number | null
  }[] | null,
  network_transaction_reference?: {
    original_network_transaction_id?: string | null,
    transaction_link_id?: string | null
  } | null
} | null
```

***

### pause

`subscriptions.pause`

Pause a subscription. Use this API to pause an active or non-renewing subscription. When a subscription is paused, it does not renew, and Chargebee does not generate renewal invoices for it. This allows you to temporarily suspend a customer's service without canceling the subscription.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.subscriptions.pause({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `pause_option` | `immediately \| end_of_term \| specific_date \| billing_cycles` | No | List of options to pause the subscription. \* billing\_cycles - Pause at the end of the current term, and resume automatically after the set number of billing cycles (in [skip\_billing\_cycles](https://docs.corsair.dev/docs/api/subscriptions/pause-a-subscription#skip_billing_cycles)) have been skipped \* immediately - Pause immediately \* end\_of\_term - Pause at the end of current term \* specific\_date - Pause on a specific date |
| `pause_date` | `number` | No | Date on which the subscription will be paused. Applicable when `specific_date` option is chosen in the [pause\_option](https://docs.corsair.dev/docs/api/subscriptions/pause-a-subscription#pause_option) field. For non-renewing subscriptions, `pause_date` should be before the cancellation date. |
| `unbilled_charges_handling` | `no_action \| invoice` | No | Applicable when unbilled charges are present for the subscription and [pause\_option](https://docs.corsair.dev/docs/api/subscriptions/pause-a-subscription#pause_option) is set as `immediately`. **Note:** On the invoice raised, an automatic charge is attempted on the payment method available, if customer's auto-collection property is set to `on`. \* invoice - Invoice charges If `invoice` is chosen, an automatic charge is attempted on the payment method available if the customer has enabled auto-collection. If a payment collection fails or when auto-collection is not enabled, the invoice is closed as unpaid. \* no\_action - Retain as unbilled If `no_action` is chosen, charges are added to the resumption invoice. |
| `invoice_dunning_handling` | `continue \| stop` | No | Handles dunning for invoices already in the dunning cycle when a subscription is paused. Applicable when [pause\_option](https://docs.corsair.dev/docs/api/subscriptions/pause-a-subscription#pause_option) is set as `immediately`. If invoice is in the dunning cycle, `invoice_dunning_handing` allows you to `stop` or `continue` dunning. \* continue - Continue dunning \* stop - Stop dunning |
| `skip_billing_cycles` | `number` | No | The number of subscription billing cycles that will be skipped. The subscription resumes after the set number of billing cycles have been skipped. This is applicable only when the value of of [pause\_option](https://docs.corsair.dev/docs/api/subscriptions/pause-a-subscription#pause_option) is `billing_cycles` . |
| `resume_date` | `number` | No | For a paused subscription, it is the date/time when the subscription is scheduled to resume. If the pause is for an indefinite period, this value is not returned. For non-renewing subscriptions,`resume_date` should be before the cancellation date. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `subscription` | `object \| null` | No | A Chargebee subscription connects a customer record to products/services. It describes what the customer has signed up for and how often they're charged for it. The essential components of a subscription are: \* A [plan-item price](https://docs.corsair.dev/docs/api/item_prices). \* Any addon- and charge-item prices applied to the subscription. \* Any [coupons](https://docs.corsair.dev/docs/api/coupons) applied. \* Any [discounts](https://docs.corsair.dev/docs/api/discounts) applied. The charges in a subscription are billed via invoices. **Note:** The maximum number of subscriptions for any given [customer](https://docs.corsair.dev/docs/api/customers) ([active](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#status) or not) is 900. #### Subscription billing frequencies Chargebee offers two billing frequency options for subscriptions: \* **Plan-based billing** (`default`): Subscriptions are billed based on the billing period defined for the item price of the `item_type` `plan`. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/subscriptions#plan-based-billing). \* **Multi-frequency billing** : Subscriptions are billed according to the billing period of each recurring item price within the subscription. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing). **Important** [Limitations](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing#limitations) of Multi-frequency billing. The selection of the billing frequency preference is configured at the site level. #### Item price compatibility in a subscription When creating or updating a subscription, one of the item prices specified under subscription\_items must be a plan-item price. The remaining must be compatible addon- or charge-item prices. An item price is compatible with a plan-item price if their currencies are the same. Additionally, an addon-item price is compatible with a plan-item price only if their billing frequencies meet the following conditions: \| `period_unit` for plan-item price \| Compatible `period_unit` for addon-item price \| Compatible period for addon-item price \| \|-----------------------------------\|-----------------------------------------------\|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `day` \| `day` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `10`, then the period of the addon-item price can be `10`, `5`, `2`, or `1`. \| \| `week` \| `week` or `day` \| The `period` (in days) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the period of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `week`, `period` can be `2` or `1`. \* for `period_unit` as `day`, `period` can be `14`, `7`, `2`, or `1`. \| \| `month` \| `month` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `6`, then the `period` of the addon-item price can be `6`, `3`, `2`, or `1`. \| \| `year` \| `year` or `month` \| The `period` (in months) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the `period` of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `year`, `period` can be `2` or `1`. \* for `period_unit` as `month`, `period` can be `24`, `12`, `8`, `6`, `4`, `3`, `2`, or `1`. \| #### Tax provider fields **Avalara** : Merchants using **Avalara Sales Tax** can optionally associate each item price with a locationCode (from their Avalara company locations), so tax can be resolved correctly at the line item level. \| Field ID \| Field Value \| APIs \| \|--------------------------------------------------------------------------------\|----------------------------------------------------------------------\|--------------------------------------------------------------------------------\| \| `locationCode` \| Merchant to configure it on Avalara Platform under company locations \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| **Anrok**: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation \| Field ID \| Field Value \| APIs \| \|---------------------------------------------------------------------------------------------------------------------------------------\|---------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------\| \| `additionalTaxRegistrationNumber` \| Canadian tax registration numbers in comma separated fashion. \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| **Vertex**: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration **Note:** Field Id like `customerCode` , `customerClass` , and`taxExempted` belong to the customer object. Field Id like `productCode` , `productClass` , `productTaxCode` , and `productClass` belong to the product object. \| Field ID \| Field Value \| APIs \| \|-----------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productCode` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `customerCode` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `customerClass` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **Taxamo:** Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration \| Field Id \| Field Value \| APIs \| \|------------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productTaxCode` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `taxExempted` \| Merchant to configure it on Taxamo Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **cbtaxes**: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India. \| Field ID \| Field Value \| APIs \| \|---------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `indiaSez` \| `SEZ_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaSez` \| `SEZ_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **All**: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level \| Field ID \| Field Value \| APIs \| \|-------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `priceType` \| `TAX_INCLUSIVE` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| \| `TAX_EXCLUSIVE` \| \| \| \| `SITE_DEFAULT` or blank \| Removes price type override, and allows site level configuration to be used for tax calculation. \| #### Ramps API compatibility mode If you want to schedule changes on a subscription, use the [Ramps API](https://docs.corsair.dev/docs/api/ramps). If you are currently scheduling changes through the [Update subscription API](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items), migrate to the Ramps API. To get started, [request access for Subscription Ramps](https://app.chargebee.com/login?forward=https://app.chargebee.com/request_access/subscription-ramps\&ref=feature). Chargebee will enable Ramps compatibility mode for your site. Once enabled, you can test the Ramps API without impacting your existing integrations. The following parts of the Billing API have subtle differences in behavior when the Ramps feature is disabled versus when it is enabled with compatibility mode. (Follow the links to learn more.) \* The value of the [`subscription.has_scheduled_changes`](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#has_scheduled_changes) attribute. \* [Update subscription](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#impact-scheduled-changes) \* [Create Checkout for updating a subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription#impact-scheduled-changes) \* [Remove scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/remove-scheduled-changes) \* [Retrieve with scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/retrieve-with-scheduled-changes) \* [Create a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/create-a-quote-for-update-subscription-items) \* [Edit a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/edit-update-subscription-quote-for-items) \* [Portal sessions](https://docs.corsair.dev/docs/api/portal_sessions#scheduled-subscription-changes) |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |
| `unbilled_charges` | `object[] \| null` | No | Resource object representing unbilled\_charge |
| `credit_notes` | `object[] \| null` | No | Resource object representing credit\_note |

```ts theme={null}
{
  id?: string | null,
  currency_code?: string | null,
  billing_period?: number | null,
  billing_period_unit?: string | null,
  start_date?: number | null,
  trial_end?: number | null,
  remaining_billing_cycles?: number | null,
  po_number?: string | null,
  auto_collection?: string | null,
  plan_quantity_in_decimal?: string | null,
  plan_unit_price_in_decimal?: string | null,
  customer_id?: string | null,
  status?: string | null,
  trial_start?: number | null,
  trial_end_action?: string | null,
  current_term_start?: number | null,
  current_term_end?: number | null,
  next_billing_at?: number | null,
  created_at?: number | null,
  started_at?: number | null,
  activated_at?: number | null,
  contract_term_billing_cycle_on_renewal?: number | null,
  override_relationship?: boolean | null,
  pause_date?: number | null,
  resume_date?: number | null,
  cancelled_at?: number | null,
  cancel_reason?: string | null,
  created_from_ip?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  has_scheduled_advance_invoices?: boolean | null,
  has_scheduled_changes?: boolean | null,
  payment_source_id?: string | null,
  plan_free_quantity_in_decimal?: string | null,
  plan_amount_in_decimal?: string | null,
  cancel_schedule_created_at?: number | null,
  offline_payment_method?: string | null,
  channel?: string | null,
  net_term_days?: number | null,
  active_id?: string | null,
  due_invoices_count?: number | null,
  due_since?: number | null,
  total_dues?: number | null,
  mrr?: number | null,
  exchange_rate?: number | null,
  base_currency_code?: string | null,
  invoice_notes?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  changes_scheduled_at?: number | null,
  cancel_reason_code?: string | null,
  free_period?: number | null,
  free_period_unit?: string | null,
  create_pending_invoices?: boolean | null,
  auto_close_invoices?: boolean | null,
  business_entity_id?: string | null,
  decommissioned?: boolean | null,
  brand_id?: string | null,
  subscription_items?: {
    item_price_id?: string | null,
    item_type?: string | null,
    quantity?: number | null,
    quantity_in_decimal?: string | null,
    unit_price?: number | null,
    unit_price_in_decimal?: string | null,
    amount?: number | null,
    current_term_start?: number | null,
    current_term_end?: number | null,
    next_billing_at?: number | null,
    amount_in_decimal?: string | null,
    billing_period?: number | null,
    billing_period_unit?: string | null,
    free_quantity?: number | null,
    free_quantity_in_decimal?: string | null,
    trial_end?: number | null,
    billing_cycles?: number | null,
    service_period_days?: number | null,
    charge_on_event?: string | null,
    charge_once?: boolean | null,
    charge_on_option?: string | null,
    proration_type?: string | null,
    usage_accumulation_reset_frequency?: string | null,
    description?: string | null
  }[] | null,
  item_tiers?: {
    item_price_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    price?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    price_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null,
    index?: number | null
  }[] | null,
  charged_items?: {
    item_price_id?: string | null,
    last_charged_at?: number | null
  }[] | null,
  coupons?: {
    coupon_id?: string | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_code?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_info?: {
    referral_code?: string | null,
    coupon_code?: string | null,
    referrer_id?: string | null,
    external_reference_id?: string | null,
    reward_status?: string | null,
    referral_system?: string | null,
    account_id?: string | null,
    campaign_id?: string | null,
    external_campaign_id?: string | null,
    friend_offer_type?: string | null,
    referrer_reward_type?: string | null,
    notify_referral_system?: string | null,
    destination_url?: string | null,
    post_purchase_widget_enabled?: boolean | null
  } | null,
  billing_override?: {
    max_excess_payment_usage?: number | null,
    max_refundable_credits_usage?: number | null
  } | null,
  contract_term?: {
    id?: string | null,
    status?: string | null,
    contract_start?: number | null,
    contract_end?: number | null,
    billing_cycle?: number | null,
    action_at_term_end?: string | null,
    total_contract_value?: number | null,
    total_contract_value_before_tax?: number | null,
    cancellation_cutoff_period?: number | null,
    created_at?: number | null,
    subscription_id?: string | null,
    remaining_billing_cycles?: number | null
  } | null,
  discounts?: {
    id?: string | null,
    invoice_name?: string | null,
    description?: string | null,
    type?: string | null,
    percentage?: number | null,
    amount?: number | null,
    quantity?: number | null,
    currency_code?: string | null,
    duration_type?: string | null,
    period?: number | null,
    period_unit?: string | null,
    included_in_mrr?: boolean | null,
    apply_on?: string | null,
    item_price_id?: string | null,
    created_at?: number | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_id?: string | null,
    index?: number | null
  }[] | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  email?: string | null,
  phone?: string | null,
  company?: string | null,
  vat_number?: string | null,
  auto_collection?: string | null,
  offline_payment_method?: string | null,
  net_term_days?: number | null,
  vat_number_validated_time?: number | null,
  vat_number_status?: string | null,
  allow_direct_debit?: boolean | null,
  is_location_valid?: boolean | null,
  created_at?: number | null,
  created_from_ip?: string | null,
  exemption_details?: any[] | null,
  taxability?: string | null,
  entity_code?: string | null,
  exempt_number?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  locale?: string | null,
  billing_date?: number | null,
  billing_month?: number | null,
  billing_date_mode?: string | null,
  billing_day_of_week?: string | null,
  billing_day_of_week_mode?: string | null,
  pii_cleared?: string | null,
  auto_close_invoices?: boolean | null,
  channel?: string | null,
  active_id?: string | null,
  fraud_flag?: string | null,
  primary_payment_source_id?: string | null,
  backup_payment_source_id?: string | null,
  invoice_notes?: string | null,
  business_entity_id?: string | null,
  preferred_currency_code?: string | null,
  promotional_credits?: number | null,
  unbilled_charges?: number | null,
  refundable_credits?: number | null,
  excess_payments?: number | null,
  is_einvoice_enabled?: boolean | null,
  einvoicing_method?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  registered_for_gst?: boolean | null,
  consolidated_invoicing?: boolean | null,
  customer_type?: string | null,
  business_customer_without_vat_number?: boolean | null,
  client_profile_id?: string | null,
  use_default_hierarchy_settings?: boolean | null,
  vat_number_prefix?: string | null,
  entity_identifier_scheme?: string | null,
  entity_identifier_standard?: string | null,
  brand_id?: string | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_urls?: {
    external_customer_id?: string | null,
    referral_sharing_url?: string | null,
    created_at?: number | null,
    updated_at?: number | null,
    referral_campaign_id?: string | null,
    referral_account_id?: string | null,
    referral_external_campaign_id?: string | null,
    referral_system?: string | null
  }[] | null,
  contacts?: {
    id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    phone?: string | null,
    label?: string | null,
    enabled?: boolean | null,
    send_account_email?: boolean | null,
    send_billing_email?: boolean | null
  }[] | null,
  payment_method?: {
    type?: string | null,
    gateway?: string | null,
    gateway_account_id?: string | null,
    status?: string | null,
    reference_id?: string | null
  } | null,
  balances?: {
    promotional_credits?: number | null,
    excess_payments?: number | null,
    refundable_credits?: number | null,
    unbilled_charges?: number | null,
    currency_code?: string | null,
    business_entity_id?: string | null
  }[] | null,
  entity_identifiers?: {
    id?: string | null,
    value?: string | null,
    scheme?: string | null,
    standard?: string | null
  }[] | null,
  tax_providers_fields?: {
    provider_name?: string | null,
    field_id?: string | null,
    field_value?: string | null
  }[] | null,
  relationship?: {
    parent_id?: string | null,
    payment_owner_id?: string | null,
    invoice_owner_id?: string | null
  } | null,
  parent_account_access?: {
    portal_edit_child_subscriptions?: string | null,
    portal_download_child_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null,
  child_account_access?: {
    portal_edit_subscriptions?: string | null,
    portal_download_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null
} | null
```

```ts theme={null}
{
  payment_source_id?: string | null,
  status?: string | null,
  gateway?: string | null,
  gateway_account_id?: string | null,
  ref_tx_id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  iin?: string | null,
  last4?: string | null,
  card_type?: string | null,
  funding_type?: string | null,
  expiry_month?: number | null,
  expiry_year?: number | null,
  issuing_country?: string | null,
  billing_addr1?: string | null,
  billing_addr2?: string | null,
  billing_city?: string | null,
  billing_state_code?: string | null,
  billing_state?: string | null,
  billing_country?: string | null,
  billing_zip?: string | null,
  created_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  ip_address?: string | null,
  powered_by?: string | null,
  customer_id?: string | null,
  masked_number?: string | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  payment_owner?: string | null,
  subscription_id?: string | null,
  recurring?: boolean | null,
  status?: string | null,
  date?: number | null,
  due_date?: number | null,
  net_term_days?: number | null,
  po_number?: string | null,
  vat_number?: string | null,
  price_type?: string | null,
  exchange_rate?: number | null,
  local_currency_exchange_rate?: number | null,
  currency_code?: string | null,
  local_currency_code?: string | null,
  tax?: number | null,
  sub_total?: number | null,
  sub_total_in_local_currency?: number | null,
  total?: number | null,
  total_in_local_currency?: number | null,
  amount_due?: number | null,
  amount_adjusted?: number | null,
  amount_paid?: number | null,
  paid_at?: number | null,
  write_off_amount?: number | null,
  credits_applied?: number | null,
  dunning_status?: string | null,
  next_retry_at?: number | null,
  voided_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  line_items_next_offset?: string | null,
  first_invoice?: boolean | null,
  new_sales_amount?: number | null,
  has_advance_charges?: boolean | null,
  offline_payment_method?: string | null,
  term_finalized?: boolean | null,
  is_gifted?: boolean | null,
  generated_at?: number | null,
  expected_payment_date?: number | null,
  amount_to_collect?: number | null,
  round_off_amount?: number | null,
  retry_segment_id?: string | null,
  void_reason_code?: string | null,
  deleted?: boolean | null,
  tax_category?: string | null,
  vat_number_prefix?: string | null,
  channel?: string | null,
  business_entity_id?: string | null,
  brand_id?: string | null,
  exchange_rates?: {
    currency_code?: string | null,
    rate?: number | null
  }[] | null,
  line_items?: {
    id?: string | null,
    subscription_id?: string | null,
    date_from?: number | null,
    date_to?: number | null,
    unit_amount?: number | null,
    quantity?: number | null,
    amount?: number | null,
    pricing_model?: string | null,
    is_taxed?: boolean | null,
    tax_amount?: number | null,
    tax_rate?: number | null,
    unit_amount_in_decimal?: string | null,
    quantity_in_decimal?: string | null,
    amount_in_decimal?: string | null,
    discount_amount?: number | null,
    item_level_discount_amount?: number | null,
    metered?: boolean | null,
    is_percentage_pricing?: boolean | null,
    reference_line_item_id?: string | null,
    description?: string | null,
    entity_description?: string | null,
    entity_type?: string | null,
    tax_exempt_reason?: string | null,
    entity_id?: string | null,
    customer_id?: string | null,
    proration_mode?: string | null
  }[] | null,
  line_item_tiers?: {
    line_item_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    quantity_used?: number | null,
    unit_amount?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    quantity_used_in_decimal?: string | null,
    unit_amount_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null
  }[] | null,
  line_item_discounts?: {
    line_item_id?: string | null,
    discount_type?: string | null,
    coupon_id?: string | null,
    entity_id?: string | null,
    discount_amount?: number | null
  }[] | null,
  line_item_taxes?: {
    line_item_id?: string | null,
    tax_name?: string | null,
    tax_rate?: number | null,
    date_to?: number | null,
    date_from?: number | null,
    prorated_taxable_amount?: number | null,
    is_partial_tax_applied?: boolean | null,
    is_non_compliance_tax?: boolean | null,
    taxable_amount?: number | null,
    tax_amount?: number | null,
    tax_juris_type?: string | null,
    tax_juris_name?: string | null,
    tax_juris_code?: string | null,
    tax_amount_in_local_currency?: number | null,
    local_currency_code?: string | null
  }[] | null,
  line_item_credits?: {
    cn_id?: string | null,
    applied_amount?: number | null,
    line_item_id?: string | null
  }[] | null,
  line_item_addresses?: {
    line_item_id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  }[] | null,
  discounts?: {
    amount?: number | null,
    description?: string | null,
    line_item_id?: string | null,
    entity_type?: string | null,
    discount_type?: string | null,
    entity_id?: string | null,
    coupon_set_code?: string | null
  }[] | null,
  taxes?: {
    name?: string | null,
    amount?: number | null,
    description?: string | null
  }[] | null,
  tax_origin?: {
    country?: string | null,
    registration_number?: string | null
  } | null,
  linked_taxes_withheld?: {
    id?: string | null,
    amount?: number | null,
    description?: string | null,
    date?: number | null,
    reference_number?: string | null
  }[] | null,
  linked_payments?: {
    txn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null
  }[] | null,
  reference_transactions?: {
    applied_amount?: number | null,
    applied_at?: number | null,
    txn_id?: string | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null,
    txn_type?: string | null,
    amount_capturable?: number | null,
    authorization_reason?: string | null
  }[] | null,
  dunning_attempts?: {
    attempt?: number | null,
    transaction_id?: string | null,
    dunning_type?: string | null,
    created_at?: number | null,
    txn_status?: string | null,
    txn_amount?: number | null,
    retry_engine?: string | null
  }[] | null,
  applied_credits?: {
    cn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_status?: string | null,
    tax_application?: string | null
  }[] | null,
  adjustment_credit_notes?: {
    cn_id?: string | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_total?: number | null,
    cn_status?: string | null
  }[] | null,
  issued_credit_notes?: {
    cn_id?: string | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_total?: number | null,
    cn_status?: string | null
  }[] | null,
  linked_orders?: {
    id?: string | null,
    document_number?: string | null,
    status?: string | null,
    order_type?: string | null,
    reference_id?: string | null,
    fulfillment_status?: string | null,
    batch_id?: string | null,
    created_at?: number | null
  }[] | null,
  notes?: {
    note?: string | null,
    entity_id?: string | null,
    entity_type?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  statement_descriptor?: {
    id?: string | null,
    descriptor?: string | null
  } | null,
  einvoice?: {
    id?: string | null,
    reference_id?: string | null,
    reference_number?: string | null,
    status?: string | null,
    message?: string | null,
    provider_references?: any[] | null
  } | null,
  site_details_at_creation?: {
    timezone?: string | null,
    organization_address?: {
    } | null
  } | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  subscription_id?: string | null,
  date_from?: number | null,
  date_to?: number | null,
  unit_amount?: number | null,
  pricing_model?: string | null,
  quantity?: number | null,
  amount?: number | null,
  currency_code?: string | null,
  discount_amount?: number | null,
  description?: string | null,
  entity_type?: string | null,
  entity_id?: string | null,
  is_voided?: boolean | null,
  voided_at?: number | null,
  unit_amount_in_decimal?: string | null,
  quantity_in_decimal?: string | null,
  amount_in_decimal?: string | null,
  created_at?: number | null,
  updated_at?: number | null,
  is_advance_charge?: boolean | null,
  business_entity_id?: string | null,
  deleted?: boolean | null,
  tiers?: {
    starting_unit?: number | null,
    ending_unit?: number | null,
    quantity_used?: number | null,
    unit_amount?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    quantity_used_in_decimal?: string | null,
    unit_amount_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null
  }[] | null
}[] | null
```

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  subscription_id?: string | null,
  reference_invoice_id?: string | null,
  type?: string | null,
  reason_code?: string | null,
  status?: string | null,
  vat_number?: string | null,
  date?: number | null,
  price_type?: string | null,
  currency_code?: string | null,
  total?: number | null,
  amount_allocated?: number | null,
  amount_refunded?: number | null,
  amount_available?: number | null,
  refunded_at?: number | null,
  voided_at?: number | null,
  generated_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  channel?: string | null,
  line_items_next_offset?: string | null,
  sub_total?: number | null,
  sub_total_in_local_currency?: number | null,
  total_in_local_currency?: number | null,
  local_currency_code?: string | null,
  round_off_amount?: number | null,
  fractional_correction?: number | null,
  notes?: string[] | null,
  deleted?: boolean | null,
  tax_category?: string | null,
  local_currency_exchange_rate?: number | null,
  create_reason_code?: string | null,
  vat_number_prefix?: string | null,
  business_entity_id?: string | null,
  brand_id?: string | null,
  line_items?: {
    id?: string | null,
    subscription_id?: string | null,
    date_from?: number | null,
    date_to?: number | null,
    unit_amount?: number | null,
    quantity?: number | null,
    amount?: number | null,
    pricing_model?: string | null,
    is_taxed?: boolean | null,
    tax_amount?: number | null,
    tax_rate?: number | null,
    unit_amount_in_decimal?: string | null,
    quantity_in_decimal?: string | null,
    amount_in_decimal?: string | null,
    discount_amount?: number | null,
    item_level_discount_amount?: number | null,
    metered?: boolean | null,
    is_percentage_pricing?: boolean | null,
    reference_line_item_id?: string | null,
    description?: string | null,
    entity_description?: string | null,
    entity_type?: string | null,
    tax_exempt_reason?: string | null,
    entity_id?: string | null,
    customer_id?: string | null,
    proration_mode?: string | null
  }[] | null,
  line_item_tiers?: {
    line_item_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    quantity_used?: number | null,
    unit_amount?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    quantity_used_in_decimal?: string | null,
    unit_amount_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null
  }[] | null,
  line_item_discounts?: {
    line_item_id?: string | null,
    discount_type?: string | null,
    coupon_id?: string | null,
    entity_id?: string | null,
    discount_amount?: number | null
  }[] | null,
  line_item_taxes?: {
    line_item_id?: string | null,
    tax_name?: string | null,
    tax_rate?: number | null,
    date_to?: number | null,
    date_from?: number | null,
    prorated_taxable_amount?: number | null,
    is_partial_tax_applied?: boolean | null,
    is_non_compliance_tax?: boolean | null,
    taxable_amount?: number | null,
    tax_amount?: number | null,
    tax_juris_type?: string | null,
    tax_juris_name?: string | null,
    tax_juris_code?: string | null,
    tax_amount_in_local_currency?: number | null,
    local_currency_code?: string | null
  }[] | null,
  line_item_addresses?: {
    line_item_id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  }[] | null,
  discounts?: {
    amount?: number | null,
    description?: string | null,
    line_item_id?: string | null,
    entity_type?: string | null,
    discount_type?: string | null,
    entity_id?: string | null,
    coupon_set_code?: string | null
  }[] | null,
  taxes?: {
    name?: string | null,
    amount?: number | null,
    description?: string | null
  }[] | null,
  tax_origin?: {
    country?: string | null,
    registration_number?: string | null
  } | null,
  linked_refunds?: {
    txn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null,
    refund_reason_code?: string | null
  }[] | null,
  linked_tax_withheld_refunds?: {
    id?: string | null,
    amount?: number | null,
    description?: string | null,
    date?: number | null,
    reference_number?: string | null
  }[] | null,
  allocations?: {
    invoice_id?: string | null,
    allocated_amount?: number | null,
    allocated_at?: number | null,
    invoice_date?: number | null,
    invoice_status?: string | null,
    tax_application?: string | null
  }[] | null,
  exchange_rates?: {
    currency_code?: string | null,
    rate?: number | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  einvoice?: {
    id?: string | null,
    reference_id?: string | null,
    reference_number?: string | null,
    status?: string | null,
    message?: string | null,
    provider_references?: any[] | null
  } | null,
  site_details_at_creation?: {
    timezone?: string | null,
    organization_address?: {
    } | null
  } | null
}[] | null
```

***

### pauseSubscriptionEstimate

`subscriptions.pauseSubscriptionEstimate`

Pause subscription estimate. This API provides an estimate of the details pertaining to the pause\_subscription operation. It returns attributes such as pause\_date and resume\_date. This is similar to the Pause a subscription API with the exception that the subscription is not paused.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.subscriptions.pauseSubscriptionEstimate({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `pause_option` | `immediately \| end_of_term \| specific_date \| billing_cycles` | No | List of options to pause the subscription. \* billing\_cycles - Pause at the end of the current term, and resume automatically after the number of billing cycles you specify in [skip\_billing\_cycles](https://docs.corsair.dev/docs/api/estimates/pause-subscription-estimate#subscription_skip_billing_cycles) \* immediately - Pause immediately \* end\_of\_term - Pause at the end of current term \* specific\_date - Pause on a specific date |
| `unbilled_charges_handling` | `no_action \| invoice` | No | Applicable when unbilled charges are present for the subscription and [pause\_option](https://docs.corsair.dev/docs/api/estimates/pause-subscription-estimate#pause_option) is set as `immediately`. **Note:** On the invoice raised, an automatic charge is attempted on the payment method available, if customer's auto-collection property is set to `on`. \* invoice - Invoice charges If `invoice` is chosen, an automatic charge is attempted on the payment method available if the customer has enabled auto-collection. If a payment collection fails or when auto-collection is not enabled, the invoice is closed as unpaid. \* no\_action - Retain as unbilled If `no_action` is chosen, charges are added to the resumption invoice. |
| `subscription` | `object` | No | Parameters for subscription |

```ts theme={null}
{
  pause_date?: number,
  resume_date?: number,
  skip_billing_cycles?: number
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `estimate` | `object \| null` | No | During the process of signing up customers to subscriptions, use the Estimates API to evaluate the details of the purchase before actually signing them up. The details returned by the API include the invoice amounts, next billing date and unbilled charges. For example, consider that you are creating a new subscription or update an existing one. Use the Estimates API before that to deduce the details such as the amount the customer would be charged, the state the subscription would be in after creation or updation, and so on. If you have configured the [Avalara integration](https://www.chargebee.com/docs/2.0/avalara.html), Chargebee retrieves the tax amount from Avalara for the invoice. This counts against your Avalara API limits. |

```ts theme={null}
{
  created_at?: number | null,
  subscription_estimate?: {
    id?: string | null,
    currency_code?: string | null,
    status?: string | null,
    trial_end_action?: string | null,
    next_billing_at?: number | null,
    pause_date?: number | null,
    resume_date?: number | null,
    shipping_address?: {
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    } | null,
    contract_term?: {
      id?: string | null,
      status?: string | null,
      contract_start?: number | null,
      contract_end?: number | null,
      billing_cycle?: number | null,
      action_at_term_end?: string | null,
      total_contract_value?: number | null,
      total_contract_value_before_tax?: number | null,
      cancellation_cutoff_period?: number | null,
      created_at?: number | null,
      subscription_id?: string | null,
      remaining_billing_cycles?: number | null
    } | null
  } | null,
  subscription_estimates?: {
    id?: string | null,
    currency_code?: string | null,
    status?: string | null,
    trial_end_action?: string | null,
    next_billing_at?: number | null,
    pause_date?: number | null,
    resume_date?: number | null,
    shipping_address?: {
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    } | null,
    contract_term?: {
      id?: string | null,
      status?: string | null,
      contract_start?: number | null,
      contract_end?: number | null,
      billing_cycle?: number | null,
      action_at_term_end?: string | null,
      total_contract_value?: number | null,
      total_contract_value_before_tax?: number | null,
      cancellation_cutoff_period?: number | null,
      created_at?: number | null,
      subscription_id?: string | null,
      remaining_billing_cycles?: number | null
    } | null
  }[] | null,
  invoice_estimate?: {
    recurring?: boolean | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    credits_applied?: number | null,
    amount_paid?: number | null,
    amount_due?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    line_item_credits?: {
      cn_id?: string | null,
      applied_amount?: number | null,
      line_item_id?: string | null
    }[] | null,
    line_item_addresses?: {
      line_item_id?: string | null,
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  } | null,
  invoice_estimates?: {
    recurring?: boolean | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    credits_applied?: number | null,
    amount_paid?: number | null,
    amount_due?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    line_item_credits?: {
      cn_id?: string | null,
      applied_amount?: number | null,
      line_item_id?: string | null
    }[] | null,
    line_item_addresses?: {
      line_item_id?: string | null,
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  }[] | null,
  payment_schedule_estimates?: {
    id?: string | null,
    scheme_id?: string | null,
    entity_type?: string | null,
    entity_id?: string | null,
    amount?: number | null,
    currency_code?: string | null,
    schedule_entries?: {
      id?: string | null,
      date?: number | null,
      amount?: number | null,
      scheduled_amount?: number | null,
      status?: string | null
    }[] | null
  }[] | null,
  next_invoice_estimate?: {
    recurring?: boolean | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    credits_applied?: number | null,
    amount_paid?: number | null,
    amount_due?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    line_item_credits?: {
      cn_id?: string | null,
      applied_amount?: number | null,
      line_item_id?: string | null
    }[] | null,
    line_item_addresses?: {
      line_item_id?: string | null,
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  } | null,
  credit_note_estimates?: {
    reference_invoice_id?: string | null,
    type?: string | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    amount_allocated?: number | null,
    amount_available?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  }[] | null,
  unbilled_charge_estimates?: {
    id?: string | null,
    customer_id?: string | null,
    subscription_id?: string | null,
    date_from?: number | null,
    date_to?: number | null,
    unit_amount?: number | null,
    pricing_model?: string | null,
    quantity?: number | null,
    amount?: number | null,
    currency_code?: string | null,
    discount_amount?: number | null,
    description?: string | null,
    entity_type?: string | null,
    entity_id?: string | null,
    is_voided?: boolean | null,
    voided_at?: number | null,
    unit_amount_in_decimal?: string | null,
    quantity_in_decimal?: string | null,
    amount_in_decimal?: string | null,
    created_at?: number | null,
    updated_at?: number | null,
    tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    is_advance_charge?: boolean | null,
    business_entity_id?: string | null,
    deleted?: boolean | null
  }[] | null
} | null
```

***

### reactivate

`subscriptions.reactivate`

Reactivate a subscription. Reactivates a canceled subscription. Use this operation to restore a canceled subscription to an active or in-trial state. #### Extend non-renewing subscriptions To extend the billing cycles of a non\_renewing subscription, use the Remove scheduled cancellation API.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.subscriptions.reactivate({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `trial_end` | `number` | No | Providing this parameter indicates that the subscription reactivates with an `in_trial` status and the trial period ends at the date provided. **Constraints** \* Must not be earlier than `reactivate_from` if `reactivate_from` is provided. \* When `trial_end` is backdated, the subscription immediately goes into `active` or `non_renewing` status. |
| `billing_cycles` | `number` | No | The number of billing cycles (including the current cycle) this subscription should remain active for. After the billing cycles are exhausted, the subscription is canceled automatically. **Default value** \* If not specified, the billing cycles [configured for the plan](https://docs.corsair.dev/docs/api/item_prices#billing_cycles) are used. **Impact** \* The [`remaining_billing_cycles`](https://docs.corsair.dev/docs/api/subscriptions#remaining_billing_cycles) attribute of the subscription is updated to one less than the value of this parameter. |
| `reactivate_from` | `number` | No | The date-time at which the subscription was reactivated. When not provided, the subscription is reactivated immediately on calling this API. **Prerequisites** \* The [backdating feature](https://www.chargebee.com/docs/billing/2.0/subscriptions/backdating#configuring-backdated-subscription-actions-and-invoicing) has been enabled for subscription reactivation operations. \* The current day of the month does not exceed the limit set in Chargebee for backdating such operations. This day is the day of the month by which the accounting for the previous month must be closed. **Constraints** \* Must be in the past. \* Must not be more than the billing period of the plan into the past. For example, if the period of the plan in the subscription is 2 months and today is 14th April, `reactivate_from` cannot be earlier than 14th February. \* Must not be after `trial_end` if `trial_end` is provided. |
| `invoice_immediately` | `boolean` | No | 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. . |
| `billing_alignment_mode` | `immediate \| delayed` | No | Applicable when calendar billing is enabled and a new *active* term gets started during this operation. Unless specified the configured *default* value will be used. \* delayed - Subscription period will be aligned with the configured billing date at the next renewal. \* immediate - Subscription period will be aligned with the configured billing date immediately, with credits or charges raised accordingly. |
| `terms_to_charge` | `number` | No | 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. |
| `invoice_date` | `number` | No | The document date displayed on the invoice PDF. 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 `true`, and if the site is configured to set invoice dates to the 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`. **Default value** \* Current date. **Constraints** \* Must be in the past. \* Must 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. \* Must not be earlier than `reactivate_from` or `trial_end`. \* `invoice_immediately` must be `true`. |
| `contract_term_billing_cycle_on_renewal` | `number` | No | The number of billing cycles the new contract term should run for, on contract renewal. This value is used when `action_at_term_end` is `renew`. **Constraints** \* Should not be sent when `contract_term.action_at_term_end` is `cancel` or `evergreen`. **Default value** \* Defaults to the value of `billing_cycle` or a custom value depending on the [site configuration](https://www.chargebee.com/docs/billing/2.0/subscriptions/contract-terms#configuring-contract-terms). |
| `payment_initiator` | `customer \| merchant` | No | The initiator of this payment request. Sending this information can improve the success rate of the payment at the gateway. \* customer - The payment was initiated by your customer. \* merchant - The payment was initiated by you (the merchant). |
| `contract_term` | `object` | No | Parameters for creating a contract term for the subscription. **Prerequisites** \* [Contract Terms](https://www.chargebee.com/docs/contract-terms.html) feature must be enabled for the site. |
| `statement_descriptor` | `object` | No | Parameters for statement\_descriptor |
| `payment_intent` | `object` | No | Parameters for payment\_intent |

```ts theme={null}
{
  action_at_term_end?: renew | evergreen | cancel,
  cancellation_cutoff_period?: number
}
```

```ts theme={null}
{
  descriptor?: string
}
```

```ts theme={null}
{
  id?: string,
  gateway_account_id?: string,
  gw_token?: string,
  payment_method_type?: card | ideal | sofort | bancontact | google_pay | dotpay | giropay | apple_pay | upi | netbanking_emandates | paypal_express_checkout | direct_debit | boleto | venmo | amazon_payments | pay_to | faster_payments | sepa_instant_transfer | klarna_pay_now | online_banking_poland | payconiq_by_bancontact | electronic_payment_standard | kbc_payment_button | pay_by_bank | trustly | stablecoin | kakao_pay | naver_pay | revolut_pay | cash_app_pay | wechat_pay | alipay | twint | go_pay | grab_pay | pay_co | after_pay | swish | payme | pix | klarna | alipay_hk | paypay | gcash | south_korean_cards | paynow | bizum | promptpay | dana | touch_n_go | tamara | qpay | ovo | momo | mercado_pago | nequi | nupay | picpay | thai_qr | blik | fpx | wero | p24 | affirm_pay | rakuten_pay,
  reference_id?: string,
  additional_information?: {
  }
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `subscription` | `object \| null` | No | A Chargebee subscription connects a customer record to products/services. It describes what the customer has signed up for and how often they're charged for it. The essential components of a subscription are: \* A [plan-item price](https://docs.corsair.dev/docs/api/item_prices). \* Any addon- and charge-item prices applied to the subscription. \* Any [coupons](https://docs.corsair.dev/docs/api/coupons) applied. \* Any [discounts](https://docs.corsair.dev/docs/api/discounts) applied. The charges in a subscription are billed via invoices. **Note:** The maximum number of subscriptions for any given [customer](https://docs.corsair.dev/docs/api/customers) ([active](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#status) or not) is 900. #### Subscription billing frequencies Chargebee offers two billing frequency options for subscriptions: \* **Plan-based billing** (`default`): Subscriptions are billed based on the billing period defined for the item price of the `item_type` `plan`. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/subscriptions#plan-based-billing). \* **Multi-frequency billing** : Subscriptions are billed according to the billing period of each recurring item price within the subscription. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing). **Important** [Limitations](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing#limitations) of Multi-frequency billing. The selection of the billing frequency preference is configured at the site level. #### Item price compatibility in a subscription When creating or updating a subscription, one of the item prices specified under subscription\_items must be a plan-item price. The remaining must be compatible addon- or charge-item prices. An item price is compatible with a plan-item price if their currencies are the same. Additionally, an addon-item price is compatible with a plan-item price only if their billing frequencies meet the following conditions: \| `period_unit` for plan-item price \| Compatible `period_unit` for addon-item price \| Compatible period for addon-item price \| \|-----------------------------------\|-----------------------------------------------\|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `day` \| `day` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `10`, then the period of the addon-item price can be `10`, `5`, `2`, or `1`. \| \| `week` \| `week` or `day` \| The `period` (in days) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the period of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `week`, `period` can be `2` or `1`. \* for `period_unit` as `day`, `period` can be `14`, `7`, `2`, or `1`. \| \| `month` \| `month` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `6`, then the `period` of the addon-item price can be `6`, `3`, `2`, or `1`. \| \| `year` \| `year` or `month` \| The `period` (in months) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the `period` of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `year`, `period` can be `2` or `1`. \* for `period_unit` as `month`, `period` can be `24`, `12`, `8`, `6`, `4`, `3`, `2`, or `1`. \| #### Tax provider fields **Avalara** : Merchants using **Avalara Sales Tax** can optionally associate each item price with a locationCode (from their Avalara company locations), so tax can be resolved correctly at the line item level. \| Field ID \| Field Value \| APIs \| \|--------------------------------------------------------------------------------\|----------------------------------------------------------------------\|--------------------------------------------------------------------------------\| \| `locationCode` \| Merchant to configure it on Avalara Platform under company locations \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| **Anrok**: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation \| Field ID \| Field Value \| APIs \| \|---------------------------------------------------------------------------------------------------------------------------------------\|---------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------\| \| `additionalTaxRegistrationNumber` \| Canadian tax registration numbers in comma separated fashion. \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| **Vertex**: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration **Note:** Field Id like `customerCode` , `customerClass` , and`taxExempted` belong to the customer object. Field Id like `productCode` , `productClass` , `productTaxCode` , and `productClass` belong to the product object. \| Field ID \| Field Value \| APIs \| \|-----------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productCode` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `customerCode` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `customerClass` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **Taxamo:** Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration \| Field Id \| Field Value \| APIs \| \|------------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productTaxCode` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `taxExempted` \| Merchant to configure it on Taxamo Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **cbtaxes**: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India. \| Field ID \| Field Value \| APIs \| \|---------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `indiaSez` \| `SEZ_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaSez` \| `SEZ_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **All**: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level \| Field ID \| Field Value \| APIs \| \|-------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `priceType` \| `TAX_INCLUSIVE` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| \| `TAX_EXCLUSIVE` \| \| \| \| `SITE_DEFAULT` or blank \| Removes price type override, and allows site level configuration to be used for tax calculation. \| #### Ramps API compatibility mode If you want to schedule changes on a subscription, use the [Ramps API](https://docs.corsair.dev/docs/api/ramps). If you are currently scheduling changes through the [Update subscription API](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items), migrate to the Ramps API. To get started, [request access for Subscription Ramps](https://app.chargebee.com/login?forward=https://app.chargebee.com/request_access/subscription-ramps\&ref=feature). Chargebee will enable Ramps compatibility mode for your site. Once enabled, you can test the Ramps API without impacting your existing integrations. The following parts of the Billing API have subtle differences in behavior when the Ramps feature is disabled versus when it is enabled with compatibility mode. (Follow the links to learn more.) \* The value of the [`subscription.has_scheduled_changes`](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#has_scheduled_changes) attribute. \* [Update subscription](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#impact-scheduled-changes) \* [Create Checkout for updating a subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription#impact-scheduled-changes) \* [Remove scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/remove-scheduled-changes) \* [Retrieve with scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/retrieve-with-scheduled-changes) \* [Create a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/create-a-quote-for-update-subscription-items) \* [Edit a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/edit-update-subscription-quote-for-items) \* [Portal sessions](https://docs.corsair.dev/docs/api/portal_sessions#scheduled-subscription-changes) |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |
| `unbilled_charges` | `object[] \| null` | No | Resource object representing unbilled\_charge |

```ts theme={null}
{
  id?: string | null,
  currency_code?: string | null,
  billing_period?: number | null,
  billing_period_unit?: string | null,
  start_date?: number | null,
  trial_end?: number | null,
  remaining_billing_cycles?: number | null,
  po_number?: string | null,
  auto_collection?: string | null,
  plan_quantity_in_decimal?: string | null,
  plan_unit_price_in_decimal?: string | null,
  customer_id?: string | null,
  status?: string | null,
  trial_start?: number | null,
  trial_end_action?: string | null,
  current_term_start?: number | null,
  current_term_end?: number | null,
  next_billing_at?: number | null,
  created_at?: number | null,
  started_at?: number | null,
  activated_at?: number | null,
  contract_term_billing_cycle_on_renewal?: number | null,
  override_relationship?: boolean | null,
  pause_date?: number | null,
  resume_date?: number | null,
  cancelled_at?: number | null,
  cancel_reason?: string | null,
  created_from_ip?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  has_scheduled_advance_invoices?: boolean | null,
  has_scheduled_changes?: boolean | null,
  payment_source_id?: string | null,
  plan_free_quantity_in_decimal?: string | null,
  plan_amount_in_decimal?: string | null,
  cancel_schedule_created_at?: number | null,
  offline_payment_method?: string | null,
  channel?: string | null,
  net_term_days?: number | null,
  active_id?: string | null,
  due_invoices_count?: number | null,
  due_since?: number | null,
  total_dues?: number | null,
  mrr?: number | null,
  exchange_rate?: number | null,
  base_currency_code?: string | null,
  invoice_notes?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  changes_scheduled_at?: number | null,
  cancel_reason_code?: string | null,
  free_period?: number | null,
  free_period_unit?: string | null,
  create_pending_invoices?: boolean | null,
  auto_close_invoices?: boolean | null,
  business_entity_id?: string | null,
  decommissioned?: boolean | null,
  brand_id?: string | null,
  subscription_items?: {
    item_price_id?: string | null,
    item_type?: string | null,
    quantity?: number | null,
    quantity_in_decimal?: string | null,
    unit_price?: number | null,
    unit_price_in_decimal?: string | null,
    amount?: number | null,
    current_term_start?: number | null,
    current_term_end?: number | null,
    next_billing_at?: number | null,
    amount_in_decimal?: string | null,
    billing_period?: number | null,
    billing_period_unit?: string | null,
    free_quantity?: number | null,
    free_quantity_in_decimal?: string | null,
    trial_end?: number | null,
    billing_cycles?: number | null,
    service_period_days?: number | null,
    charge_on_event?: string | null,
    charge_once?: boolean | null,
    charge_on_option?: string | null,
    proration_type?: string | null,
    usage_accumulation_reset_frequency?: string | null,
    description?: string | null
  }[] | null,
  item_tiers?: {
    item_price_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    price?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    price_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null,
    index?: number | null
  }[] | null,
  charged_items?: {
    item_price_id?: string | null,
    last_charged_at?: number | null
  }[] | null,
  coupons?: {
    coupon_id?: string | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_code?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_info?: {
    referral_code?: string | null,
    coupon_code?: string | null,
    referrer_id?: string | null,
    external_reference_id?: string | null,
    reward_status?: string | null,
    referral_system?: string | null,
    account_id?: string | null,
    campaign_id?: string | null,
    external_campaign_id?: string | null,
    friend_offer_type?: string | null,
    referrer_reward_type?: string | null,
    notify_referral_system?: string | null,
    destination_url?: string | null,
    post_purchase_widget_enabled?: boolean | null
  } | null,
  billing_override?: {
    max_excess_payment_usage?: number | null,
    max_refundable_credits_usage?: number | null
  } | null,
  contract_term?: {
    id?: string | null,
    status?: string | null,
    contract_start?: number | null,
    contract_end?: number | null,
    billing_cycle?: number | null,
    action_at_term_end?: string | null,
    total_contract_value?: number | null,
    total_contract_value_before_tax?: number | null,
    cancellation_cutoff_period?: number | null,
    created_at?: number | null,
    subscription_id?: string | null,
    remaining_billing_cycles?: number | null
  } | null,
  discounts?: {
    id?: string | null,
    invoice_name?: string | null,
    description?: string | null,
    type?: string | null,
    percentage?: number | null,
    amount?: number | null,
    quantity?: number | null,
    currency_code?: string | null,
    duration_type?: string | null,
    period?: number | null,
    period_unit?: string | null,
    included_in_mrr?: boolean | null,
    apply_on?: string | null,
    item_price_id?: string | null,
    created_at?: number | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_id?: string | null,
    index?: number | null
  }[] | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  email?: string | null,
  phone?: string | null,
  company?: string | null,
  vat_number?: string | null,
  auto_collection?: string | null,
  offline_payment_method?: string | null,
  net_term_days?: number | null,
  vat_number_validated_time?: number | null,
  vat_number_status?: string | null,
  allow_direct_debit?: boolean | null,
  is_location_valid?: boolean | null,
  created_at?: number | null,
  created_from_ip?: string | null,
  exemption_details?: any[] | null,
  taxability?: string | null,
  entity_code?: string | null,
  exempt_number?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  locale?: string | null,
  billing_date?: number | null,
  billing_month?: number | null,
  billing_date_mode?: string | null,
  billing_day_of_week?: string | null,
  billing_day_of_week_mode?: string | null,
  pii_cleared?: string | null,
  auto_close_invoices?: boolean | null,
  channel?: string | null,
  active_id?: string | null,
  fraud_flag?: string | null,
  primary_payment_source_id?: string | null,
  backup_payment_source_id?: string | null,
  invoice_notes?: string | null,
  business_entity_id?: string | null,
  preferred_currency_code?: string | null,
  promotional_credits?: number | null,
  unbilled_charges?: number | null,
  refundable_credits?: number | null,
  excess_payments?: number | null,
  is_einvoice_enabled?: boolean | null,
  einvoicing_method?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  registered_for_gst?: boolean | null,
  consolidated_invoicing?: boolean | null,
  customer_type?: string | null,
  business_customer_without_vat_number?: boolean | null,
  client_profile_id?: string | null,
  use_default_hierarchy_settings?: boolean | null,
  vat_number_prefix?: string | null,
  entity_identifier_scheme?: string | null,
  entity_identifier_standard?: string | null,
  brand_id?: string | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_urls?: {
    external_customer_id?: string | null,
    referral_sharing_url?: string | null,
    created_at?: number | null,
    updated_at?: number | null,
    referral_campaign_id?: string | null,
    referral_account_id?: string | null,
    referral_external_campaign_id?: string | null,
    referral_system?: string | null
  }[] | null,
  contacts?: {
    id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    phone?: string | null,
    label?: string | null,
    enabled?: boolean | null,
    send_account_email?: boolean | null,
    send_billing_email?: boolean | null
  }[] | null,
  payment_method?: {
    type?: string | null,
    gateway?: string | null,
    gateway_account_id?: string | null,
    status?: string | null,
    reference_id?: string | null
  } | null,
  balances?: {
    promotional_credits?: number | null,
    excess_payments?: number | null,
    refundable_credits?: number | null,
    unbilled_charges?: number | null,
    currency_code?: string | null,
    business_entity_id?: string | null
  }[] | null,
  entity_identifiers?: {
    id?: string | null,
    value?: string | null,
    scheme?: string | null,
    standard?: string | null
  }[] | null,
  tax_providers_fields?: {
    provider_name?: string | null,
    field_id?: string | null,
    field_value?: string | null
  }[] | null,
  relationship?: {
    parent_id?: string | null,
    payment_owner_id?: string | null,
    invoice_owner_id?: string | null
  } | null,
  parent_account_access?: {
    portal_edit_child_subscriptions?: string | null,
    portal_download_child_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null,
  child_account_access?: {
    portal_edit_subscriptions?: string | null,
    portal_download_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null
} | null
```

```ts theme={null}
{
  payment_source_id?: string | null,
  status?: string | null,
  gateway?: string | null,
  gateway_account_id?: string | null,
  ref_tx_id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  iin?: string | null,
  last4?: string | null,
  card_type?: string | null,
  funding_type?: string | null,
  expiry_month?: number | null,
  expiry_year?: number | null,
  issuing_country?: string | null,
  billing_addr1?: string | null,
  billing_addr2?: string | null,
  billing_city?: string | null,
  billing_state_code?: string | null,
  billing_state?: string | null,
  billing_country?: string | null,
  billing_zip?: string | null,
  created_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  ip_address?: string | null,
  powered_by?: string | null,
  customer_id?: string | null,
  masked_number?: string | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  payment_owner?: string | null,
  subscription_id?: string | null,
  recurring?: boolean | null,
  status?: string | null,
  date?: number | null,
  due_date?: number | null,
  net_term_days?: number | null,
  po_number?: string | null,
  vat_number?: string | null,
  price_type?: string | null,
  exchange_rate?: number | null,
  local_currency_exchange_rate?: number | null,
  currency_code?: string | null,
  local_currency_code?: string | null,
  tax?: number | null,
  sub_total?: number | null,
  sub_total_in_local_currency?: number | null,
  total?: number | null,
  total_in_local_currency?: number | null,
  amount_due?: number | null,
  amount_adjusted?: number | null,
  amount_paid?: number | null,
  paid_at?: number | null,
  write_off_amount?: number | null,
  credits_applied?: number | null,
  dunning_status?: string | null,
  next_retry_at?: number | null,
  voided_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  line_items_next_offset?: string | null,
  first_invoice?: boolean | null,
  new_sales_amount?: number | null,
  has_advance_charges?: boolean | null,
  offline_payment_method?: string | null,
  term_finalized?: boolean | null,
  is_gifted?: boolean | null,
  generated_at?: number | null,
  expected_payment_date?: number | null,
  amount_to_collect?: number | null,
  round_off_amount?: number | null,
  retry_segment_id?: string | null,
  void_reason_code?: string | null,
  deleted?: boolean | null,
  tax_category?: string | null,
  vat_number_prefix?: string | null,
  channel?: string | null,
  business_entity_id?: string | null,
  brand_id?: string | null,
  exchange_rates?: {
    currency_code?: string | null,
    rate?: number | null
  }[] | null,
  line_items?: {
    id?: string | null,
    subscription_id?: string | null,
    date_from?: number | null,
    date_to?: number | null,
    unit_amount?: number | null,
    quantity?: number | null,
    amount?: number | null,
    pricing_model?: string | null,
    is_taxed?: boolean | null,
    tax_amount?: number | null,
    tax_rate?: number | null,
    unit_amount_in_decimal?: string | null,
    quantity_in_decimal?: string | null,
    amount_in_decimal?: string | null,
    discount_amount?: number | null,
    item_level_discount_amount?: number | null,
    metered?: boolean | null,
    is_percentage_pricing?: boolean | null,
    reference_line_item_id?: string | null,
    description?: string | null,
    entity_description?: string | null,
    entity_type?: string | null,
    tax_exempt_reason?: string | null,
    entity_id?: string | null,
    customer_id?: string | null,
    proration_mode?: string | null
  }[] | null,
  line_item_tiers?: {
    line_item_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    quantity_used?: number | null,
    unit_amount?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    quantity_used_in_decimal?: string | null,
    unit_amount_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null
  }[] | null,
  line_item_discounts?: {
    line_item_id?: string | null,
    discount_type?: string | null,
    coupon_id?: string | null,
    entity_id?: string | null,
    discount_amount?: number | null
  }[] | null,
  line_item_taxes?: {
    line_item_id?: string | null,
    tax_name?: string | null,
    tax_rate?: number | null,
    date_to?: number | null,
    date_from?: number | null,
    prorated_taxable_amount?: number | null,
    is_partial_tax_applied?: boolean | null,
    is_non_compliance_tax?: boolean | null,
    taxable_amount?: number | null,
    tax_amount?: number | null,
    tax_juris_type?: string | null,
    tax_juris_name?: string | null,
    tax_juris_code?: string | null,
    tax_amount_in_local_currency?: number | null,
    local_currency_code?: string | null
  }[] | null,
  line_item_credits?: {
    cn_id?: string | null,
    applied_amount?: number | null,
    line_item_id?: string | null
  }[] | null,
  line_item_addresses?: {
    line_item_id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  }[] | null,
  discounts?: {
    amount?: number | null,
    description?: string | null,
    line_item_id?: string | null,
    entity_type?: string | null,
    discount_type?: string | null,
    entity_id?: string | null,
    coupon_set_code?: string | null
  }[] | null,
  taxes?: {
    name?: string | null,
    amount?: number | null,
    description?: string | null
  }[] | null,
  tax_origin?: {
    country?: string | null,
    registration_number?: string | null
  } | null,
  linked_taxes_withheld?: {
    id?: string | null,
    amount?: number | null,
    description?: string | null,
    date?: number | null,
    reference_number?: string | null
  }[] | null,
  linked_payments?: {
    txn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null
  }[] | null,
  reference_transactions?: {
    applied_amount?: number | null,
    applied_at?: number | null,
    txn_id?: string | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null,
    txn_type?: string | null,
    amount_capturable?: number | null,
    authorization_reason?: string | null
  }[] | null,
  dunning_attempts?: {
    attempt?: number | null,
    transaction_id?: string | null,
    dunning_type?: string | null,
    created_at?: number | null,
    txn_status?: string | null,
    txn_amount?: number | null,
    retry_engine?: string | null
  }[] | null,
  applied_credits?: {
    cn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_status?: string | null,
    tax_application?: string | null
  }[] | null,
  adjustment_credit_notes?: {
    cn_id?: string | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_total?: number | null,
    cn_status?: string | null
  }[] | null,
  issued_credit_notes?: {
    cn_id?: string | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_total?: number | null,
    cn_status?: string | null
  }[] | null,
  linked_orders?: {
    id?: string | null,
    document_number?: string | null,
    status?: string | null,
    order_type?: string | null,
    reference_id?: string | null,
    fulfillment_status?: string | null,
    batch_id?: string | null,
    created_at?: number | null
  }[] | null,
  notes?: {
    note?: string | null,
    entity_id?: string | null,
    entity_type?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  statement_descriptor?: {
    id?: string | null,
    descriptor?: string | null
  } | null,
  einvoice?: {
    id?: string | null,
    reference_id?: string | null,
    reference_number?: string | null,
    status?: string | null,
    message?: string | null,
    provider_references?: any[] | null
  } | null,
  site_details_at_creation?: {
    timezone?: string | null,
    organization_address?: {
    } | null
  } | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  subscription_id?: string | null,
  date_from?: number | null,
  date_to?: number | null,
  unit_amount?: number | null,
  pricing_model?: string | null,
  quantity?: number | null,
  amount?: number | null,
  currency_code?: string | null,
  discount_amount?: number | null,
  description?: string | null,
  entity_type?: string | null,
  entity_id?: string | null,
  is_voided?: boolean | null,
  voided_at?: number | null,
  unit_amount_in_decimal?: string | null,
  quantity_in_decimal?: string | null,
  amount_in_decimal?: string | null,
  created_at?: number | null,
  updated_at?: number | null,
  is_advance_charge?: boolean | null,
  business_entity_id?: string | null,
  deleted?: boolean | null,
  tiers?: {
    starting_unit?: number | null,
    ending_unit?: number | null,
    quantity_used?: number | null,
    unit_amount?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    quantity_used_in_decimal?: string | null,
    unit_amount_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null
  }[] | null
}[] | null
```

***

### regenerateInvoice

`subscriptions.regenerateInvoice`

Regenerate an invoice. Use this API to regenerate the current-term invoice for a subscription. The new invoice will contain non-metered charges from the current term and metered charges from the previous term.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.subscriptions.regenerateInvoice({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `date_from` | `number` | No | The start date of the period being invoiced. The default value is [current\_term\_start](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#current_term_start) . |
| `date_to` | `number` | No | The end date of the period being invoiced. The default value is [current\_term\_end](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#current_term_end) . |
| `prorate` | `boolean` | No | Whether the charges should be prorated according to the term specified by `date_from` and `date_to`. Should not be passed without `date_from` and `date_to` . |
| `invoice_immediately` | `boolean` | No | Only applicable when [Consolidated Invoicing](https://www.chargebee.com/docs/consolidated-invoicing.html) is enabled for the customer. Set to `false` to leave the current term charge for the subscription as [unbilled](https://www.chargebee.com/docs/unbilled-charges.html). Once you have done this for all suitable subscriptions of the customer, call [Create an invoice for unbilled charges](https://docs.corsair.dev/docs/api/unbilled_charges/create-an-invoice-for-unbilled-charges) to invoice them. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |
| `unbilled_charges` | `object[] \| null` | No | Resource object representing unbilled\_charge |

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  payment_owner?: string | null,
  subscription_id?: string | null,
  recurring?: boolean | null,
  status?: string | null,
  date?: number | null,
  due_date?: number | null,
  net_term_days?: number | null,
  po_number?: string | null,
  vat_number?: string | null,
  price_type?: string | null,
  exchange_rate?: number | null,
  local_currency_exchange_rate?: number | null,
  currency_code?: string | null,
  local_currency_code?: string | null,
  tax?: number | null,
  sub_total?: number | null,
  sub_total_in_local_currency?: number | null,
  total?: number | null,
  total_in_local_currency?: number | null,
  amount_due?: number | null,
  amount_adjusted?: number | null,
  amount_paid?: number | null,
  paid_at?: number | null,
  write_off_amount?: number | null,
  credits_applied?: number | null,
  dunning_status?: string | null,
  next_retry_at?: number | null,
  voided_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  line_items_next_offset?: string | null,
  first_invoice?: boolean | null,
  new_sales_amount?: number | null,
  has_advance_charges?: boolean | null,
  offline_payment_method?: string | null,
  term_finalized?: boolean | null,
  is_gifted?: boolean | null,
  generated_at?: number | null,
  expected_payment_date?: number | null,
  amount_to_collect?: number | null,
  round_off_amount?: number | null,
  retry_segment_id?: string | null,
  void_reason_code?: string | null,
  deleted?: boolean | null,
  tax_category?: string | null,
  vat_number_prefix?: string | null,
  channel?: string | null,
  business_entity_id?: string | null,
  brand_id?: string | null,
  exchange_rates?: {
    currency_code?: string | null,
    rate?: number | null
  }[] | null,
  line_items?: {
    id?: string | null,
    subscription_id?: string | null,
    date_from?: number | null,
    date_to?: number | null,
    unit_amount?: number | null,
    quantity?: number | null,
    amount?: number | null,
    pricing_model?: string | null,
    is_taxed?: boolean | null,
    tax_amount?: number | null,
    tax_rate?: number | null,
    unit_amount_in_decimal?: string | null,
    quantity_in_decimal?: string | null,
    amount_in_decimal?: string | null,
    discount_amount?: number | null,
    item_level_discount_amount?: number | null,
    metered?: boolean | null,
    is_percentage_pricing?: boolean | null,
    reference_line_item_id?: string | null,
    description?: string | null,
    entity_description?: string | null,
    entity_type?: string | null,
    tax_exempt_reason?: string | null,
    entity_id?: string | null,
    customer_id?: string | null,
    proration_mode?: string | null
  }[] | null,
  line_item_tiers?: {
    line_item_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    quantity_used?: number | null,
    unit_amount?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    quantity_used_in_decimal?: string | null,
    unit_amount_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null
  }[] | null,
  line_item_discounts?: {
    line_item_id?: string | null,
    discount_type?: string | null,
    coupon_id?: string | null,
    entity_id?: string | null,
    discount_amount?: number | null
  }[] | null,
  line_item_taxes?: {
    line_item_id?: string | null,
    tax_name?: string | null,
    tax_rate?: number | null,
    date_to?: number | null,
    date_from?: number | null,
    prorated_taxable_amount?: number | null,
    is_partial_tax_applied?: boolean | null,
    is_non_compliance_tax?: boolean | null,
    taxable_amount?: number | null,
    tax_amount?: number | null,
    tax_juris_type?: string | null,
    tax_juris_name?: string | null,
    tax_juris_code?: string | null,
    tax_amount_in_local_currency?: number | null,
    local_currency_code?: string | null
  }[] | null,
  line_item_credits?: {
    cn_id?: string | null,
    applied_amount?: number | null,
    line_item_id?: string | null
  }[] | null,
  line_item_addresses?: {
    line_item_id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  }[] | null,
  discounts?: {
    amount?: number | null,
    description?: string | null,
    line_item_id?: string | null,
    entity_type?: string | null,
    discount_type?: string | null,
    entity_id?: string | null,
    coupon_set_code?: string | null
  }[] | null,
  taxes?: {
    name?: string | null,
    amount?: number | null,
    description?: string | null
  }[] | null,
  tax_origin?: {
    country?: string | null,
    registration_number?: string | null
  } | null,
  linked_taxes_withheld?: {
    id?: string | null,
    amount?: number | null,
    description?: string | null,
    date?: number | null,
    reference_number?: string | null
  }[] | null,
  linked_payments?: {
    txn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null
  }[] | null,
  reference_transactions?: {
    applied_amount?: number | null,
    applied_at?: number | null,
    txn_id?: string | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null,
    txn_type?: string | null,
    amount_capturable?: number | null,
    authorization_reason?: string | null
  }[] | null,
  dunning_attempts?: {
    attempt?: number | null,
    transaction_id?: string | null,
    dunning_type?: string | null,
    created_at?: number | null,
    txn_status?: string | null,
    txn_amount?: number | null,
    retry_engine?: string | null
  }[] | null,
  applied_credits?: {
    cn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_status?: string | null,
    tax_application?: string | null
  }[] | null,
  adjustment_credit_notes?: {
    cn_id?: string | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_total?: number | null,
    cn_status?: string | null
  }[] | null,
  issued_credit_notes?: {
    cn_id?: string | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_total?: number | null,
    cn_status?: string | null
  }[] | null,
  linked_orders?: {
    id?: string | null,
    document_number?: string | null,
    status?: string | null,
    order_type?: string | null,
    reference_id?: string | null,
    fulfillment_status?: string | null,
    batch_id?: string | null,
    created_at?: number | null
  }[] | null,
  notes?: {
    note?: string | null,
    entity_id?: string | null,
    entity_type?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  statement_descriptor?: {
    id?: string | null,
    descriptor?: string | null
  } | null,
  einvoice?: {
    id?: string | null,
    reference_id?: string | null,
    reference_number?: string | null,
    status?: string | null,
    message?: string | null,
    provider_references?: any[] | null
  } | null,
  site_details_at_creation?: {
    timezone?: string | null,
    organization_address?: {
    } | null
  } | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  subscription_id?: string | null,
  date_from?: number | null,
  date_to?: number | null,
  unit_amount?: number | null,
  pricing_model?: string | null,
  quantity?: number | null,
  amount?: number | null,
  currency_code?: string | null,
  discount_amount?: number | null,
  description?: string | null,
  entity_type?: string | null,
  entity_id?: string | null,
  is_voided?: boolean | null,
  voided_at?: number | null,
  unit_amount_in_decimal?: string | null,
  quantity_in_decimal?: string | null,
  amount_in_decimal?: string | null,
  created_at?: number | null,
  updated_at?: number | null,
  is_advance_charge?: boolean | null,
  business_entity_id?: string | null,
  deleted?: boolean | null,
  tiers?: {
    starting_unit?: number | null,
    ending_unit?: number | null,
    quantity_used?: number | null,
    unit_amount?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    quantity_used_in_decimal?: string | null,
    unit_amount_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null
  }[] | null
}[] | null
```

***

### regenerateInvoiceEstimate

`subscriptions.regenerateInvoiceEstimate`

Regenerate invoice estimate. Regenerates the invoice for the current term of the subscription. The subscription must have status as active or non\_renewing. This operation is not allowed when any of the following conditions hold true for the subscription: \* An invoice exists for the current term and its status is not voided.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.subscriptions.regenerateInvoiceEstimate({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `date_from` | `number` | No | The start date of the period being invoiced. The default value is [current\_term\_start](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#current_term_start) . |
| `date_to` | `number` | No | The end date of the period being invoiced. The default value is [current\_term\_end](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#current_term_end) . |
| `prorate` | `boolean` | No | Whether the charges should be prorated according to the term specified by `date_from` and `date_to`. Should not be passed without `date_from` and `date_to` . |
| `invoice_immediately` | `boolean` | No | Only applicable when [Consolidated Invoicing](https://www.chargebee.com/docs/consolidated-invoicing.html) is enabled for the customer. Set to `false` to leave the current term charge for the subscription as [unbilled](https://www.chargebee.com/docs/unbilled-charges.html). Once you have done this for all suitable subscriptions of the customer, call [Create an invoice for unbilled charges](https://docs.corsair.dev/docs/api/unbilled_charges/create-an-invoice-for-unbilled-charges) to invoice them. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `estimate` | `object \| null` | No | During the process of signing up customers to subscriptions, use the Estimates API to evaluate the details of the purchase before actually signing them up. The details returned by the API include the invoice amounts, next billing date and unbilled charges. For example, consider that you are creating a new subscription or update an existing one. Use the Estimates API before that to deduce the details such as the amount the customer would be charged, the state the subscription would be in after creation or updation, and so on. If you have configured the [Avalara integration](https://www.chargebee.com/docs/2.0/avalara.html), Chargebee retrieves the tax amount from Avalara for the invoice. This counts against your Avalara API limits. |

```ts theme={null}
{
  created_at?: number | null,
  subscription_estimate?: {
    id?: string | null,
    currency_code?: string | null,
    status?: string | null,
    trial_end_action?: string | null,
    next_billing_at?: number | null,
    pause_date?: number | null,
    resume_date?: number | null,
    shipping_address?: {
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    } | null,
    contract_term?: {
      id?: string | null,
      status?: string | null,
      contract_start?: number | null,
      contract_end?: number | null,
      billing_cycle?: number | null,
      action_at_term_end?: string | null,
      total_contract_value?: number | null,
      total_contract_value_before_tax?: number | null,
      cancellation_cutoff_period?: number | null,
      created_at?: number | null,
      subscription_id?: string | null,
      remaining_billing_cycles?: number | null
    } | null
  } | null,
  subscription_estimates?: {
    id?: string | null,
    currency_code?: string | null,
    status?: string | null,
    trial_end_action?: string | null,
    next_billing_at?: number | null,
    pause_date?: number | null,
    resume_date?: number | null,
    shipping_address?: {
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    } | null,
    contract_term?: {
      id?: string | null,
      status?: string | null,
      contract_start?: number | null,
      contract_end?: number | null,
      billing_cycle?: number | null,
      action_at_term_end?: string | null,
      total_contract_value?: number | null,
      total_contract_value_before_tax?: number | null,
      cancellation_cutoff_period?: number | null,
      created_at?: number | null,
      subscription_id?: string | null,
      remaining_billing_cycles?: number | null
    } | null
  }[] | null,
  invoice_estimate?: {
    recurring?: boolean | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    credits_applied?: number | null,
    amount_paid?: number | null,
    amount_due?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    line_item_credits?: {
      cn_id?: string | null,
      applied_amount?: number | null,
      line_item_id?: string | null
    }[] | null,
    line_item_addresses?: {
      line_item_id?: string | null,
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  } | null,
  invoice_estimates?: {
    recurring?: boolean | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    credits_applied?: number | null,
    amount_paid?: number | null,
    amount_due?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    line_item_credits?: {
      cn_id?: string | null,
      applied_amount?: number | null,
      line_item_id?: string | null
    }[] | null,
    line_item_addresses?: {
      line_item_id?: string | null,
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  }[] | null,
  payment_schedule_estimates?: {
    id?: string | null,
    scheme_id?: string | null,
    entity_type?: string | null,
    entity_id?: string | null,
    amount?: number | null,
    currency_code?: string | null,
    schedule_entries?: {
      id?: string | null,
      date?: number | null,
      amount?: number | null,
      scheduled_amount?: number | null,
      status?: string | null
    }[] | null
  }[] | null,
  next_invoice_estimate?: {
    recurring?: boolean | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    credits_applied?: number | null,
    amount_paid?: number | null,
    amount_due?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    line_item_credits?: {
      cn_id?: string | null,
      applied_amount?: number | null,
      line_item_id?: string | null
    }[] | null,
    line_item_addresses?: {
      line_item_id?: string | null,
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  } | null,
  credit_note_estimates?: {
    reference_invoice_id?: string | null,
    type?: string | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    amount_allocated?: number | null,
    amount_available?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  }[] | null,
  unbilled_charge_estimates?: {
    id?: string | null,
    customer_id?: string | null,
    subscription_id?: string | null,
    date_from?: number | null,
    date_to?: number | null,
    unit_amount?: number | null,
    pricing_model?: string | null,
    quantity?: number | null,
    amount?: number | null,
    currency_code?: string | null,
    discount_amount?: number | null,
    description?: string | null,
    entity_type?: string | null,
    entity_id?: string | null,
    is_voided?: boolean | null,
    voided_at?: number | null,
    unit_amount_in_decimal?: string | null,
    quantity_in_decimal?: string | null,
    amount_in_decimal?: string | null,
    created_at?: number | null,
    updated_at?: number | null,
    tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    is_advance_charge?: boolean | null,
    business_entity_id?: string | null,
    deleted?: boolean | null
  }[] | null
} | null
```

***

### removeAdvanceInvoiceSchedule

`subscriptions.removeAdvanceInvoiceSchedule`

Remove an advance invoice schedule. Caution \* This API will return an error when multi-frequency billing is enabled. Deletes an advance invoicing schedule. When *schedule\_type = specific\_dates*, you also have the option of deleting a part of the schedule.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.subscriptions.removeAdvanceInvoiceSchedule({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `specific_dates_schedule` | `object` | No | Parameters for specific\_dates\_schedule |

```ts theme={null}
{
  id?: string[]
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `subscription` | `object \| null` | No | A Chargebee subscription connects a customer record to products/services. It describes what the customer has signed up for and how often they're charged for it. The essential components of a subscription are: \* A [plan-item price](https://docs.corsair.dev/docs/api/item_prices). \* Any addon- and charge-item prices applied to the subscription. \* Any [coupons](https://docs.corsair.dev/docs/api/coupons) applied. \* Any [discounts](https://docs.corsair.dev/docs/api/discounts) applied. The charges in a subscription are billed via invoices. **Note:** The maximum number of subscriptions for any given [customer](https://docs.corsair.dev/docs/api/customers) ([active](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#status) or not) is 900. #### Subscription billing frequencies Chargebee offers two billing frequency options for subscriptions: \* **Plan-based billing** (`default`): Subscriptions are billed based on the billing period defined for the item price of the `item_type` `plan`. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/subscriptions#plan-based-billing). \* **Multi-frequency billing** : Subscriptions are billed according to the billing period of each recurring item price within the subscription. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing). **Important** [Limitations](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing#limitations) of Multi-frequency billing. The selection of the billing frequency preference is configured at the site level. #### Item price compatibility in a subscription When creating or updating a subscription, one of the item prices specified under subscription\_items must be a plan-item price. The remaining must be compatible addon- or charge-item prices. An item price is compatible with a plan-item price if their currencies are the same. Additionally, an addon-item price is compatible with a plan-item price only if their billing frequencies meet the following conditions: \| `period_unit` for plan-item price \| Compatible `period_unit` for addon-item price \| Compatible period for addon-item price \| \|-----------------------------------\|-----------------------------------------------\|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `day` \| `day` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `10`, then the period of the addon-item price can be `10`, `5`, `2`, or `1`. \| \| `week` \| `week` or `day` \| The `period` (in days) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the period of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `week`, `period` can be `2` or `1`. \* for `period_unit` as `day`, `period` can be `14`, `7`, `2`, or `1`. \| \| `month` \| `month` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `6`, then the `period` of the addon-item price can be `6`, `3`, `2`, or `1`. \| \| `year` \| `year` or `month` \| The `period` (in months) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the `period` of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `year`, `period` can be `2` or `1`. \* for `period_unit` as `month`, `period` can be `24`, `12`, `8`, `6`, `4`, `3`, `2`, or `1`. \| #### Tax provider fields **Avalara** : Merchants using **Avalara Sales Tax** can optionally associate each item price with a locationCode (from their Avalara company locations), so tax can be resolved correctly at the line item level. \| Field ID \| Field Value \| APIs \| \|--------------------------------------------------------------------------------\|----------------------------------------------------------------------\|--------------------------------------------------------------------------------\| \| `locationCode` \| Merchant to configure it on Avalara Platform under company locations \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| **Anrok**: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation \| Field ID \| Field Value \| APIs \| \|---------------------------------------------------------------------------------------------------------------------------------------\|---------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------\| \| `additionalTaxRegistrationNumber` \| Canadian tax registration numbers in comma separated fashion. \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| **Vertex**: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration **Note:** Field Id like `customerCode` , `customerClass` , and`taxExempted` belong to the customer object. Field Id like `productCode` , `productClass` , `productTaxCode` , and `productClass` belong to the product object. \| Field ID \| Field Value \| APIs \| \|-----------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productCode` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `customerCode` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `customerClass` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **Taxamo:** Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration \| Field Id \| Field Value \| APIs \| \|------------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productTaxCode` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `taxExempted` \| Merchant to configure it on Taxamo Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **cbtaxes**: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India. \| Field ID \| Field Value \| APIs \| \|---------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `indiaSez` \| `SEZ_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaSez` \| `SEZ_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **All**: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level \| Field ID \| Field Value \| APIs \| \|-------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `priceType` \| `TAX_INCLUSIVE` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| \| `TAX_EXCLUSIVE` \| \| \| \| `SITE_DEFAULT` or blank \| Removes price type override, and allows site level configuration to be used for tax calculation. \| #### Ramps API compatibility mode If you want to schedule changes on a subscription, use the [Ramps API](https://docs.corsair.dev/docs/api/ramps). If you are currently scheduling changes through the [Update subscription API](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items), migrate to the Ramps API. To get started, [request access for Subscription Ramps](https://app.chargebee.com/login?forward=https://app.chargebee.com/request_access/subscription-ramps\&ref=feature). Chargebee will enable Ramps compatibility mode for your site. Once enabled, you can test the Ramps API without impacting your existing integrations. The following parts of the Billing API have subtle differences in behavior when the Ramps feature is disabled versus when it is enabled with compatibility mode. (Follow the links to learn more.) \* The value of the [`subscription.has_scheduled_changes`](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#has_scheduled_changes) attribute. \* [Update subscription](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#impact-scheduled-changes) \* [Create Checkout for updating a subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription#impact-scheduled-changes) \* [Remove scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/remove-scheduled-changes) \* [Retrieve with scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/retrieve-with-scheduled-changes) \* [Create a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/create-a-quote-for-update-subscription-items) \* [Edit a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/edit-update-subscription-quote-for-items) \* [Portal sessions](https://docs.corsair.dev/docs/api/portal_sessions#scheduled-subscription-changes) |
| `advance_invoice_schedules` | `object[] \| null` | No | Resource object representing advance\_invoice\_schedule |

```ts theme={null}
{
  id?: string | null,
  currency_code?: string | null,
  billing_period?: number | null,
  billing_period_unit?: string | null,
  start_date?: number | null,
  trial_end?: number | null,
  remaining_billing_cycles?: number | null,
  po_number?: string | null,
  auto_collection?: string | null,
  plan_quantity_in_decimal?: string | null,
  plan_unit_price_in_decimal?: string | null,
  customer_id?: string | null,
  status?: string | null,
  trial_start?: number | null,
  trial_end_action?: string | null,
  current_term_start?: number | null,
  current_term_end?: number | null,
  next_billing_at?: number | null,
  created_at?: number | null,
  started_at?: number | null,
  activated_at?: number | null,
  contract_term_billing_cycle_on_renewal?: number | null,
  override_relationship?: boolean | null,
  pause_date?: number | null,
  resume_date?: number | null,
  cancelled_at?: number | null,
  cancel_reason?: string | null,
  created_from_ip?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  has_scheduled_advance_invoices?: boolean | null,
  has_scheduled_changes?: boolean | null,
  payment_source_id?: string | null,
  plan_free_quantity_in_decimal?: string | null,
  plan_amount_in_decimal?: string | null,
  cancel_schedule_created_at?: number | null,
  offline_payment_method?: string | null,
  channel?: string | null,
  net_term_days?: number | null,
  active_id?: string | null,
  due_invoices_count?: number | null,
  due_since?: number | null,
  total_dues?: number | null,
  mrr?: number | null,
  exchange_rate?: number | null,
  base_currency_code?: string | null,
  invoice_notes?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  changes_scheduled_at?: number | null,
  cancel_reason_code?: string | null,
  free_period?: number | null,
  free_period_unit?: string | null,
  create_pending_invoices?: boolean | null,
  auto_close_invoices?: boolean | null,
  business_entity_id?: string | null,
  decommissioned?: boolean | null,
  brand_id?: string | null,
  subscription_items?: {
    item_price_id?: string | null,
    item_type?: string | null,
    quantity?: number | null,
    quantity_in_decimal?: string | null,
    unit_price?: number | null,
    unit_price_in_decimal?: string | null,
    amount?: number | null,
    current_term_start?: number | null,
    current_term_end?: number | null,
    next_billing_at?: number | null,
    amount_in_decimal?: string | null,
    billing_period?: number | null,
    billing_period_unit?: string | null,
    free_quantity?: number | null,
    free_quantity_in_decimal?: string | null,
    trial_end?: number | null,
    billing_cycles?: number | null,
    service_period_days?: number | null,
    charge_on_event?: string | null,
    charge_once?: boolean | null,
    charge_on_option?: string | null,
    proration_type?: string | null,
    usage_accumulation_reset_frequency?: string | null,
    description?: string | null
  }[] | null,
  item_tiers?: {
    item_price_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    price?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    price_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null,
    index?: number | null
  }[] | null,
  charged_items?: {
    item_price_id?: string | null,
    last_charged_at?: number | null
  }[] | null,
  coupons?: {
    coupon_id?: string | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_code?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_info?: {
    referral_code?: string | null,
    coupon_code?: string | null,
    referrer_id?: string | null,
    external_reference_id?: string | null,
    reward_status?: string | null,
    referral_system?: string | null,
    account_id?: string | null,
    campaign_id?: string | null,
    external_campaign_id?: string | null,
    friend_offer_type?: string | null,
    referrer_reward_type?: string | null,
    notify_referral_system?: string | null,
    destination_url?: string | null,
    post_purchase_widget_enabled?: boolean | null
  } | null,
  billing_override?: {
    max_excess_payment_usage?: number | null,
    max_refundable_credits_usage?: number | null
  } | null,
  contract_term?: {
    id?: string | null,
    status?: string | null,
    contract_start?: number | null,
    contract_end?: number | null,
    billing_cycle?: number | null,
    action_at_term_end?: string | null,
    total_contract_value?: number | null,
    total_contract_value_before_tax?: number | null,
    cancellation_cutoff_period?: number | null,
    created_at?: number | null,
    subscription_id?: string | null,
    remaining_billing_cycles?: number | null
  } | null,
  discounts?: {
    id?: string | null,
    invoice_name?: string | null,
    description?: string | null,
    type?: string | null,
    percentage?: number | null,
    amount?: number | null,
    quantity?: number | null,
    currency_code?: string | null,
    duration_type?: string | null,
    period?: number | null,
    period_unit?: string | null,
    included_in_mrr?: boolean | null,
    apply_on?: string | null,
    item_price_id?: string | null,
    created_at?: number | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_id?: string | null,
    index?: number | null
  }[] | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  schedule_type?: string | null,
  fixed_interval_schedule?: {
    end_schedule_on?: string | null,
    number_of_occurrences?: number | null,
    days_before_renewal?: number | null,
    end_date?: number | null,
    created_at?: number | null,
    terms_to_charge?: number | null
  } | null,
  specific_dates_schedule?: {
    terms_to_charge?: number | null,
    date?: number | null,
    created_at?: number | null
  } | null
}[] | null
```

***

### removeCoupons

`subscriptions.removeCoupons`

Remove coupons. Caution If there are scheduled ramps for the subscription, this operation can move the ramps to the draft status when it conflicts with any upcoming ramps. Removes coupons associated with the subscription.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.subscriptions.removeCoupons({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `coupon_ids` | `string[]` | No | List of coupons to be removed from the subscription. You can provide only [coupon\_id](https://docs.corsair.dev/docs/api/coupons/coupon-object#id) and not [coupon\_code](https://docs.corsair.dev/docs/api/coupon_codes/coupon_code-object#code) . |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `subscription` | `object \| null` | No | A Chargebee subscription connects a customer record to products/services. It describes what the customer has signed up for and how often they're charged for it. The essential components of a subscription are: \* A [plan-item price](https://docs.corsair.dev/docs/api/item_prices). \* Any addon- and charge-item prices applied to the subscription. \* Any [coupons](https://docs.corsair.dev/docs/api/coupons) applied. \* Any [discounts](https://docs.corsair.dev/docs/api/discounts) applied. The charges in a subscription are billed via invoices. **Note:** The maximum number of subscriptions for any given [customer](https://docs.corsair.dev/docs/api/customers) ([active](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#status) or not) is 900. #### Subscription billing frequencies Chargebee offers two billing frequency options for subscriptions: \* **Plan-based billing** (`default`): Subscriptions are billed based on the billing period defined for the item price of the `item_type` `plan`. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/subscriptions#plan-based-billing). \* **Multi-frequency billing** : Subscriptions are billed according to the billing period of each recurring item price within the subscription. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing). **Important** [Limitations](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing#limitations) of Multi-frequency billing. The selection of the billing frequency preference is configured at the site level. #### Item price compatibility in a subscription When creating or updating a subscription, one of the item prices specified under subscription\_items must be a plan-item price. The remaining must be compatible addon- or charge-item prices. An item price is compatible with a plan-item price if their currencies are the same. Additionally, an addon-item price is compatible with a plan-item price only if their billing frequencies meet the following conditions: \| `period_unit` for plan-item price \| Compatible `period_unit` for addon-item price \| Compatible period for addon-item price \| \|-----------------------------------\|-----------------------------------------------\|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `day` \| `day` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `10`, then the period of the addon-item price can be `10`, `5`, `2`, or `1`. \| \| `week` \| `week` or `day` \| The `period` (in days) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the period of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `week`, `period` can be `2` or `1`. \* for `period_unit` as `day`, `period` can be `14`, `7`, `2`, or `1`. \| \| `month` \| `month` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `6`, then the `period` of the addon-item price can be `6`, `3`, `2`, or `1`. \| \| `year` \| `year` or `month` \| The `period` (in months) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the `period` of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `year`, `period` can be `2` or `1`. \* for `period_unit` as `month`, `period` can be `24`, `12`, `8`, `6`, `4`, `3`, `2`, or `1`. \| #### Tax provider fields **Avalara** : Merchants using **Avalara Sales Tax** can optionally associate each item price with a locationCode (from their Avalara company locations), so tax can be resolved correctly at the line item level. \| Field ID \| Field Value \| APIs \| \|--------------------------------------------------------------------------------\|----------------------------------------------------------------------\|--------------------------------------------------------------------------------\| \| `locationCode` \| Merchant to configure it on Avalara Platform under company locations \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| **Anrok**: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation \| Field ID \| Field Value \| APIs \| \|---------------------------------------------------------------------------------------------------------------------------------------\|---------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------\| \| `additionalTaxRegistrationNumber` \| Canadian tax registration numbers in comma separated fashion. \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| **Vertex**: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration **Note:** Field Id like `customerCode` , `customerClass` , and`taxExempted` belong to the customer object. Field Id like `productCode` , `productClass` , `productTaxCode` , and `productClass` belong to the product object. \| Field ID \| Field Value \| APIs \| \|-----------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productCode` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `customerCode` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `customerClass` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **Taxamo:** Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration \| Field Id \| Field Value \| APIs \| \|------------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productTaxCode` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `taxExempted` \| Merchant to configure it on Taxamo Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **cbtaxes**: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India. \| Field ID \| Field Value \| APIs \| \|---------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `indiaSez` \| `SEZ_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaSez` \| `SEZ_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **All**: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level \| Field ID \| Field Value \| APIs \| \|-------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `priceType` \| `TAX_INCLUSIVE` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| \| `TAX_EXCLUSIVE` \| \| \| \| `SITE_DEFAULT` or blank \| Removes price type override, and allows site level configuration to be used for tax calculation. \| #### Ramps API compatibility mode If you want to schedule changes on a subscription, use the [Ramps API](https://docs.corsair.dev/docs/api/ramps). If you are currently scheduling changes through the [Update subscription API](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items), migrate to the Ramps API. To get started, [request access for Subscription Ramps](https://app.chargebee.com/login?forward=https://app.chargebee.com/request_access/subscription-ramps\&ref=feature). Chargebee will enable Ramps compatibility mode for your site. Once enabled, you can test the Ramps API without impacting your existing integrations. The following parts of the Billing API have subtle differences in behavior when the Ramps feature is disabled versus when it is enabled with compatibility mode. (Follow the links to learn more.) \* The value of the [`subscription.has_scheduled_changes`](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#has_scheduled_changes) attribute. \* [Update subscription](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#impact-scheduled-changes) \* [Create Checkout for updating a subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription#impact-scheduled-changes) \* [Remove scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/remove-scheduled-changes) \* [Retrieve with scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/retrieve-with-scheduled-changes) \* [Create a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/create-a-quote-for-update-subscription-items) \* [Edit a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/edit-update-subscription-quote-for-items) \* [Portal sessions](https://docs.corsair.dev/docs/api/portal_sessions#scheduled-subscription-changes) |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |

```ts theme={null}
{
  id?: string | null,
  currency_code?: string | null,
  billing_period?: number | null,
  billing_period_unit?: string | null,
  start_date?: number | null,
  trial_end?: number | null,
  remaining_billing_cycles?: number | null,
  po_number?: string | null,
  auto_collection?: string | null,
  plan_quantity_in_decimal?: string | null,
  plan_unit_price_in_decimal?: string | null,
  customer_id?: string | null,
  status?: string | null,
  trial_start?: number | null,
  trial_end_action?: string | null,
  current_term_start?: number | null,
  current_term_end?: number | null,
  next_billing_at?: number | null,
  created_at?: number | null,
  started_at?: number | null,
  activated_at?: number | null,
  contract_term_billing_cycle_on_renewal?: number | null,
  override_relationship?: boolean | null,
  pause_date?: number | null,
  resume_date?: number | null,
  cancelled_at?: number | null,
  cancel_reason?: string | null,
  created_from_ip?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  has_scheduled_advance_invoices?: boolean | null,
  has_scheduled_changes?: boolean | null,
  payment_source_id?: string | null,
  plan_free_quantity_in_decimal?: string | null,
  plan_amount_in_decimal?: string | null,
  cancel_schedule_created_at?: number | null,
  offline_payment_method?: string | null,
  channel?: string | null,
  net_term_days?: number | null,
  active_id?: string | null,
  due_invoices_count?: number | null,
  due_since?: number | null,
  total_dues?: number | null,
  mrr?: number | null,
  exchange_rate?: number | null,
  base_currency_code?: string | null,
  invoice_notes?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  changes_scheduled_at?: number | null,
  cancel_reason_code?: string | null,
  free_period?: number | null,
  free_period_unit?: string | null,
  create_pending_invoices?: boolean | null,
  auto_close_invoices?: boolean | null,
  business_entity_id?: string | null,
  decommissioned?: boolean | null,
  brand_id?: string | null,
  subscription_items?: {
    item_price_id?: string | null,
    item_type?: string | null,
    quantity?: number | null,
    quantity_in_decimal?: string | null,
    unit_price?: number | null,
    unit_price_in_decimal?: string | null,
    amount?: number | null,
    current_term_start?: number | null,
    current_term_end?: number | null,
    next_billing_at?: number | null,
    amount_in_decimal?: string | null,
    billing_period?: number | null,
    billing_period_unit?: string | null,
    free_quantity?: number | null,
    free_quantity_in_decimal?: string | null,
    trial_end?: number | null,
    billing_cycles?: number | null,
    service_period_days?: number | null,
    charge_on_event?: string | null,
    charge_once?: boolean | null,
    charge_on_option?: string | null,
    proration_type?: string | null,
    usage_accumulation_reset_frequency?: string | null,
    description?: string | null
  }[] | null,
  item_tiers?: {
    item_price_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    price?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    price_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null,
    index?: number | null
  }[] | null,
  charged_items?: {
    item_price_id?: string | null,
    last_charged_at?: number | null
  }[] | null,
  coupons?: {
    coupon_id?: string | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_code?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_info?: {
    referral_code?: string | null,
    coupon_code?: string | null,
    referrer_id?: string | null,
    external_reference_id?: string | null,
    reward_status?: string | null,
    referral_system?: string | null,
    account_id?: string | null,
    campaign_id?: string | null,
    external_campaign_id?: string | null,
    friend_offer_type?: string | null,
    referrer_reward_type?: string | null,
    notify_referral_system?: string | null,
    destination_url?: string | null,
    post_purchase_widget_enabled?: boolean | null
  } | null,
  billing_override?: {
    max_excess_payment_usage?: number | null,
    max_refundable_credits_usage?: number | null
  } | null,
  contract_term?: {
    id?: string | null,
    status?: string | null,
    contract_start?: number | null,
    contract_end?: number | null,
    billing_cycle?: number | null,
    action_at_term_end?: string | null,
    total_contract_value?: number | null,
    total_contract_value_before_tax?: number | null,
    cancellation_cutoff_period?: number | null,
    created_at?: number | null,
    subscription_id?: string | null,
    remaining_billing_cycles?: number | null
  } | null,
  discounts?: {
    id?: string | null,
    invoice_name?: string | null,
    description?: string | null,
    type?: string | null,
    percentage?: number | null,
    amount?: number | null,
    quantity?: number | null,
    currency_code?: string | null,
    duration_type?: string | null,
    period?: number | null,
    period_unit?: string | null,
    included_in_mrr?: boolean | null,
    apply_on?: string | null,
    item_price_id?: string | null,
    created_at?: number | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_id?: string | null,
    index?: number | null
  }[] | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  email?: string | null,
  phone?: string | null,
  company?: string | null,
  vat_number?: string | null,
  auto_collection?: string | null,
  offline_payment_method?: string | null,
  net_term_days?: number | null,
  vat_number_validated_time?: number | null,
  vat_number_status?: string | null,
  allow_direct_debit?: boolean | null,
  is_location_valid?: boolean | null,
  created_at?: number | null,
  created_from_ip?: string | null,
  exemption_details?: any[] | null,
  taxability?: string | null,
  entity_code?: string | null,
  exempt_number?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  locale?: string | null,
  billing_date?: number | null,
  billing_month?: number | null,
  billing_date_mode?: string | null,
  billing_day_of_week?: string | null,
  billing_day_of_week_mode?: string | null,
  pii_cleared?: string | null,
  auto_close_invoices?: boolean | null,
  channel?: string | null,
  active_id?: string | null,
  fraud_flag?: string | null,
  primary_payment_source_id?: string | null,
  backup_payment_source_id?: string | null,
  invoice_notes?: string | null,
  business_entity_id?: string | null,
  preferred_currency_code?: string | null,
  promotional_credits?: number | null,
  unbilled_charges?: number | null,
  refundable_credits?: number | null,
  excess_payments?: number | null,
  is_einvoice_enabled?: boolean | null,
  einvoicing_method?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  registered_for_gst?: boolean | null,
  consolidated_invoicing?: boolean | null,
  customer_type?: string | null,
  business_customer_without_vat_number?: boolean | null,
  client_profile_id?: string | null,
  use_default_hierarchy_settings?: boolean | null,
  vat_number_prefix?: string | null,
  entity_identifier_scheme?: string | null,
  entity_identifier_standard?: string | null,
  brand_id?: string | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_urls?: {
    external_customer_id?: string | null,
    referral_sharing_url?: string | null,
    created_at?: number | null,
    updated_at?: number | null,
    referral_campaign_id?: string | null,
    referral_account_id?: string | null,
    referral_external_campaign_id?: string | null,
    referral_system?: string | null
  }[] | null,
  contacts?: {
    id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    phone?: string | null,
    label?: string | null,
    enabled?: boolean | null,
    send_account_email?: boolean | null,
    send_billing_email?: boolean | null
  }[] | null,
  payment_method?: {
    type?: string | null,
    gateway?: string | null,
    gateway_account_id?: string | null,
    status?: string | null,
    reference_id?: string | null
  } | null,
  balances?: {
    promotional_credits?: number | null,
    excess_payments?: number | null,
    refundable_credits?: number | null,
    unbilled_charges?: number | null,
    currency_code?: string | null,
    business_entity_id?: string | null
  }[] | null,
  entity_identifiers?: {
    id?: string | null,
    value?: string | null,
    scheme?: string | null,
    standard?: string | null
  }[] | null,
  tax_providers_fields?: {
    provider_name?: string | null,
    field_id?: string | null,
    field_value?: string | null
  }[] | null,
  relationship?: {
    parent_id?: string | null,
    payment_owner_id?: string | null,
    invoice_owner_id?: string | null
  } | null,
  parent_account_access?: {
    portal_edit_child_subscriptions?: string | null,
    portal_download_child_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null,
  child_account_access?: {
    portal_edit_subscriptions?: string | null,
    portal_download_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null
} | null
```

```ts theme={null}
{
  payment_source_id?: string | null,
  status?: string | null,
  gateway?: string | null,
  gateway_account_id?: string | null,
  ref_tx_id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  iin?: string | null,
  last4?: string | null,
  card_type?: string | null,
  funding_type?: string | null,
  expiry_month?: number | null,
  expiry_year?: number | null,
  issuing_country?: string | null,
  billing_addr1?: string | null,
  billing_addr2?: string | null,
  billing_city?: string | null,
  billing_state_code?: string | null,
  billing_state?: string | null,
  billing_country?: string | null,
  billing_zip?: string | null,
  created_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  ip_address?: string | null,
  powered_by?: string | null,
  customer_id?: string | null,
  masked_number?: string | null
} | null
```

***

### removeScheduledCancellation

`subscriptions.removeScheduledCancellation`

Remove scheduled cancellation. Removes a scheduled cancellation from a subscription so that it continues billing for the specified number of billing cycles. Use this operation when a customer changes their mind about canceling their subscription.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.subscriptions.removeScheduledCancellation({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `billing_cycles` | `number` | No | The number of billing cycles the subscription should remain active for after the current billing cycle. The [`remaining_billing_cycles`](https://docs.corsair.dev/docs/api/subscriptions#remaining_billing_cycles) attribute of the subscription is updated to this value. **Constraints** \* The value must be greater than 0. **Default Value** \* If not specified, the value set for [`billing_cycles`](https://docs.corsair.dev/docs/api/item_prices#billing_cycles) on the subscription's plan item price is used. |
| `contract_term_billing_cycle_on_renewal` | `number` | No | 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) . |
| `contract_term` | `object` | No | Parameters for contract\_term |

```ts theme={null}
{
  action_at_term_end?: renew | evergreen | cancel,
  cancellation_cutoff_period?: number
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `subscription` | `object \| null` | No | A Chargebee subscription connects a customer record to products/services. It describes what the customer has signed up for and how often they're charged for it. The essential components of a subscription are: \* A [plan-item price](https://docs.corsair.dev/docs/api/item_prices). \* Any addon- and charge-item prices applied to the subscription. \* Any [coupons](https://docs.corsair.dev/docs/api/coupons) applied. \* Any [discounts](https://docs.corsair.dev/docs/api/discounts) applied. The charges in a subscription are billed via invoices. **Note:** The maximum number of subscriptions for any given [customer](https://docs.corsair.dev/docs/api/customers) ([active](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#status) or not) is 900. #### Subscription billing frequencies Chargebee offers two billing frequency options for subscriptions: \* **Plan-based billing** (`default`): Subscriptions are billed based on the billing period defined for the item price of the `item_type` `plan`. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/subscriptions#plan-based-billing). \* **Multi-frequency billing** : Subscriptions are billed according to the billing period of each recurring item price within the subscription. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing). **Important** [Limitations](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing#limitations) of Multi-frequency billing. The selection of the billing frequency preference is configured at the site level. #### Item price compatibility in a subscription When creating or updating a subscription, one of the item prices specified under subscription\_items must be a plan-item price. The remaining must be compatible addon- or charge-item prices. An item price is compatible with a plan-item price if their currencies are the same. Additionally, an addon-item price is compatible with a plan-item price only if their billing frequencies meet the following conditions: \| `period_unit` for plan-item price \| Compatible `period_unit` for addon-item price \| Compatible period for addon-item price \| \|-----------------------------------\|-----------------------------------------------\|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `day` \| `day` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `10`, then the period of the addon-item price can be `10`, `5`, `2`, or `1`. \| \| `week` \| `week` or `day` \| The `period` (in days) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the period of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `week`, `period` can be `2` or `1`. \* for `period_unit` as `day`, `period` can be `14`, `7`, `2`, or `1`. \| \| `month` \| `month` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `6`, then the `period` of the addon-item price can be `6`, `3`, `2`, or `1`. \| \| `year` \| `year` or `month` \| The `period` (in months) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the `period` of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `year`, `period` can be `2` or `1`. \* for `period_unit` as `month`, `period` can be `24`, `12`, `8`, `6`, `4`, `3`, `2`, or `1`. \| #### Tax provider fields **Avalara** : Merchants using **Avalara Sales Tax** can optionally associate each item price with a locationCode (from their Avalara company locations), so tax can be resolved correctly at the line item level. \| Field ID \| Field Value \| APIs \| \|--------------------------------------------------------------------------------\|----------------------------------------------------------------------\|--------------------------------------------------------------------------------\| \| `locationCode` \| Merchant to configure it on Avalara Platform under company locations \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| **Anrok**: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation \| Field ID \| Field Value \| APIs \| \|---------------------------------------------------------------------------------------------------------------------------------------\|---------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------\| \| `additionalTaxRegistrationNumber` \| Canadian tax registration numbers in comma separated fashion. \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| **Vertex**: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration **Note:** Field Id like `customerCode` , `customerClass` , and`taxExempted` belong to the customer object. Field Id like `productCode` , `productClass` , `productTaxCode` , and `productClass` belong to the product object. \| Field ID \| Field Value \| APIs \| \|-----------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productCode` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `customerCode` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `customerClass` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **Taxamo:** Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration \| Field Id \| Field Value \| APIs \| \|------------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productTaxCode` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `taxExempted` \| Merchant to configure it on Taxamo Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **cbtaxes**: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India. \| Field ID \| Field Value \| APIs \| \|---------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `indiaSez` \| `SEZ_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaSez` \| `SEZ_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **All**: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level \| Field ID \| Field Value \| APIs \| \|-------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `priceType` \| `TAX_INCLUSIVE` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| \| `TAX_EXCLUSIVE` \| \| \| \| `SITE_DEFAULT` or blank \| Removes price type override, and allows site level configuration to be used for tax calculation. \| #### Ramps API compatibility mode If you want to schedule changes on a subscription, use the [Ramps API](https://docs.corsair.dev/docs/api/ramps). If you are currently scheduling changes through the [Update subscription API](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items), migrate to the Ramps API. To get started, [request access for Subscription Ramps](https://app.chargebee.com/login?forward=https://app.chargebee.com/request_access/subscription-ramps\&ref=feature). Chargebee will enable Ramps compatibility mode for your site. Once enabled, you can test the Ramps API without impacting your existing integrations. The following parts of the Billing API have subtle differences in behavior when the Ramps feature is disabled versus when it is enabled with compatibility mode. (Follow the links to learn more.) \* The value of the [`subscription.has_scheduled_changes`](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#has_scheduled_changes) attribute. \* [Update subscription](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#impact-scheduled-changes) \* [Create Checkout for updating a subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription#impact-scheduled-changes) \* [Remove scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/remove-scheduled-changes) \* [Retrieve with scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/retrieve-with-scheduled-changes) \* [Create a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/create-a-quote-for-update-subscription-items) \* [Edit a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/edit-update-subscription-quote-for-items) \* [Portal sessions](https://docs.corsair.dev/docs/api/portal_sessions#scheduled-subscription-changes) |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |

```ts theme={null}
{
  id?: string | null,
  currency_code?: string | null,
  billing_period?: number | null,
  billing_period_unit?: string | null,
  start_date?: number | null,
  trial_end?: number | null,
  remaining_billing_cycles?: number | null,
  po_number?: string | null,
  auto_collection?: string | null,
  plan_quantity_in_decimal?: string | null,
  plan_unit_price_in_decimal?: string | null,
  customer_id?: string | null,
  status?: string | null,
  trial_start?: number | null,
  trial_end_action?: string | null,
  current_term_start?: number | null,
  current_term_end?: number | null,
  next_billing_at?: number | null,
  created_at?: number | null,
  started_at?: number | null,
  activated_at?: number | null,
  contract_term_billing_cycle_on_renewal?: number | null,
  override_relationship?: boolean | null,
  pause_date?: number | null,
  resume_date?: number | null,
  cancelled_at?: number | null,
  cancel_reason?: string | null,
  created_from_ip?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  has_scheduled_advance_invoices?: boolean | null,
  has_scheduled_changes?: boolean | null,
  payment_source_id?: string | null,
  plan_free_quantity_in_decimal?: string | null,
  plan_amount_in_decimal?: string | null,
  cancel_schedule_created_at?: number | null,
  offline_payment_method?: string | null,
  channel?: string | null,
  net_term_days?: number | null,
  active_id?: string | null,
  due_invoices_count?: number | null,
  due_since?: number | null,
  total_dues?: number | null,
  mrr?: number | null,
  exchange_rate?: number | null,
  base_currency_code?: string | null,
  invoice_notes?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  changes_scheduled_at?: number | null,
  cancel_reason_code?: string | null,
  free_period?: number | null,
  free_period_unit?: string | null,
  create_pending_invoices?: boolean | null,
  auto_close_invoices?: boolean | null,
  business_entity_id?: string | null,
  decommissioned?: boolean | null,
  brand_id?: string | null,
  subscription_items?: {
    item_price_id?: string | null,
    item_type?: string | null,
    quantity?: number | null,
    quantity_in_decimal?: string | null,
    unit_price?: number | null,
    unit_price_in_decimal?: string | null,
    amount?: number | null,
    current_term_start?: number | null,
    current_term_end?: number | null,
    next_billing_at?: number | null,
    amount_in_decimal?: string | null,
    billing_period?: number | null,
    billing_period_unit?: string | null,
    free_quantity?: number | null,
    free_quantity_in_decimal?: string | null,
    trial_end?: number | null,
    billing_cycles?: number | null,
    service_period_days?: number | null,
    charge_on_event?: string | null,
    charge_once?: boolean | null,
    charge_on_option?: string | null,
    proration_type?: string | null,
    usage_accumulation_reset_frequency?: string | null,
    description?: string | null
  }[] | null,
  item_tiers?: {
    item_price_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    price?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    price_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null,
    index?: number | null
  }[] | null,
  charged_items?: {
    item_price_id?: string | null,
    last_charged_at?: number | null
  }[] | null,
  coupons?: {
    coupon_id?: string | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_code?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_info?: {
    referral_code?: string | null,
    coupon_code?: string | null,
    referrer_id?: string | null,
    external_reference_id?: string | null,
    reward_status?: string | null,
    referral_system?: string | null,
    account_id?: string | null,
    campaign_id?: string | null,
    external_campaign_id?: string | null,
    friend_offer_type?: string | null,
    referrer_reward_type?: string | null,
    notify_referral_system?: string | null,
    destination_url?: string | null,
    post_purchase_widget_enabled?: boolean | null
  } | null,
  billing_override?: {
    max_excess_payment_usage?: number | null,
    max_refundable_credits_usage?: number | null
  } | null,
  contract_term?: {
    id?: string | null,
    status?: string | null,
    contract_start?: number | null,
    contract_end?: number | null,
    billing_cycle?: number | null,
    action_at_term_end?: string | null,
    total_contract_value?: number | null,
    total_contract_value_before_tax?: number | null,
    cancellation_cutoff_period?: number | null,
    created_at?: number | null,
    subscription_id?: string | null,
    remaining_billing_cycles?: number | null
  } | null,
  discounts?: {
    id?: string | null,
    invoice_name?: string | null,
    description?: string | null,
    type?: string | null,
    percentage?: number | null,
    amount?: number | null,
    quantity?: number | null,
    currency_code?: string | null,
    duration_type?: string | null,
    period?: number | null,
    period_unit?: string | null,
    included_in_mrr?: boolean | null,
    apply_on?: string | null,
    item_price_id?: string | null,
    created_at?: number | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_id?: string | null,
    index?: number | null
  }[] | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  email?: string | null,
  phone?: string | null,
  company?: string | null,
  vat_number?: string | null,
  auto_collection?: string | null,
  offline_payment_method?: string | null,
  net_term_days?: number | null,
  vat_number_validated_time?: number | null,
  vat_number_status?: string | null,
  allow_direct_debit?: boolean | null,
  is_location_valid?: boolean | null,
  created_at?: number | null,
  created_from_ip?: string | null,
  exemption_details?: any[] | null,
  taxability?: string | null,
  entity_code?: string | null,
  exempt_number?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  locale?: string | null,
  billing_date?: number | null,
  billing_month?: number | null,
  billing_date_mode?: string | null,
  billing_day_of_week?: string | null,
  billing_day_of_week_mode?: string | null,
  pii_cleared?: string | null,
  auto_close_invoices?: boolean | null,
  channel?: string | null,
  active_id?: string | null,
  fraud_flag?: string | null,
  primary_payment_source_id?: string | null,
  backup_payment_source_id?: string | null,
  invoice_notes?: string | null,
  business_entity_id?: string | null,
  preferred_currency_code?: string | null,
  promotional_credits?: number | null,
  unbilled_charges?: number | null,
  refundable_credits?: number | null,
  excess_payments?: number | null,
  is_einvoice_enabled?: boolean | null,
  einvoicing_method?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  registered_for_gst?: boolean | null,
  consolidated_invoicing?: boolean | null,
  customer_type?: string | null,
  business_customer_without_vat_number?: boolean | null,
  client_profile_id?: string | null,
  use_default_hierarchy_settings?: boolean | null,
  vat_number_prefix?: string | null,
  entity_identifier_scheme?: string | null,
  entity_identifier_standard?: string | null,
  brand_id?: string | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_urls?: {
    external_customer_id?: string | null,
    referral_sharing_url?: string | null,
    created_at?: number | null,
    updated_at?: number | null,
    referral_campaign_id?: string | null,
    referral_account_id?: string | null,
    referral_external_campaign_id?: string | null,
    referral_system?: string | null
  }[] | null,
  contacts?: {
    id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    phone?: string | null,
    label?: string | null,
    enabled?: boolean | null,
    send_account_email?: boolean | null,
    send_billing_email?: boolean | null
  }[] | null,
  payment_method?: {
    type?: string | null,
    gateway?: string | null,
    gateway_account_id?: string | null,
    status?: string | null,
    reference_id?: string | null
  } | null,
  balances?: {
    promotional_credits?: number | null,
    excess_payments?: number | null,
    refundable_credits?: number | null,
    unbilled_charges?: number | null,
    currency_code?: string | null,
    business_entity_id?: string | null
  }[] | null,
  entity_identifiers?: {
    id?: string | null,
    value?: string | null,
    scheme?: string | null,
    standard?: string | null
  }[] | null,
  tax_providers_fields?: {
    provider_name?: string | null,
    field_id?: string | null,
    field_value?: string | null
  }[] | null,
  relationship?: {
    parent_id?: string | null,
    payment_owner_id?: string | null,
    invoice_owner_id?: string | null
  } | null,
  parent_account_access?: {
    portal_edit_child_subscriptions?: string | null,
    portal_download_child_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null,
  child_account_access?: {
    portal_edit_subscriptions?: string | null,
    portal_download_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null
} | null
```

```ts theme={null}
{
  payment_source_id?: string | null,
  status?: string | null,
  gateway?: string | null,
  gateway_account_id?: string | null,
  ref_tx_id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  iin?: string | null,
  last4?: string | null,
  card_type?: string | null,
  funding_type?: string | null,
  expiry_month?: number | null,
  expiry_year?: number | null,
  issuing_country?: string | null,
  billing_addr1?: string | null,
  billing_addr2?: string | null,
  billing_city?: string | null,
  billing_state_code?: string | null,
  billing_state?: string | null,
  billing_country?: string | null,
  billing_zip?: string | null,
  created_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  ip_address?: string | null,
  powered_by?: string | null,
  customer_id?: string | null,
  masked_number?: string | null
} | null
```

***

### removeScheduledChanges

`subscriptions.removeScheduledChanges`

Remove scheduled changes from a subscription. Removes a scheduled change from a subscription. ##### Review the changes before removing them To review the scheduled subscription change before removing it, call Retrieve with scheduled changes before calling this API to retrieve the subscription resource with the scheduled change applied.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.subscriptions.removeScheduledChanges({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `subscription` | `object \| null` | No | A Chargebee subscription connects a customer record to products/services. It describes what the customer has signed up for and how often they're charged for it. The essential components of a subscription are: \* A [plan-item price](https://docs.corsair.dev/docs/api/item_prices). \* Any addon- and charge-item prices applied to the subscription. \* Any [coupons](https://docs.corsair.dev/docs/api/coupons) applied. \* Any [discounts](https://docs.corsair.dev/docs/api/discounts) applied. The charges in a subscription are billed via invoices. **Note:** The maximum number of subscriptions for any given [customer](https://docs.corsair.dev/docs/api/customers) ([active](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#status) or not) is 900. #### Subscription billing frequencies Chargebee offers two billing frequency options for subscriptions: \* **Plan-based billing** (`default`): Subscriptions are billed based on the billing period defined for the item price of the `item_type` `plan`. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/subscriptions#plan-based-billing). \* **Multi-frequency billing** : Subscriptions are billed according to the billing period of each recurring item price within the subscription. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing). **Important** [Limitations](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing#limitations) of Multi-frequency billing. The selection of the billing frequency preference is configured at the site level. #### Item price compatibility in a subscription When creating or updating a subscription, one of the item prices specified under subscription\_items must be a plan-item price. The remaining must be compatible addon- or charge-item prices. An item price is compatible with a plan-item price if their currencies are the same. Additionally, an addon-item price is compatible with a plan-item price only if their billing frequencies meet the following conditions: \| `period_unit` for plan-item price \| Compatible `period_unit` for addon-item price \| Compatible period for addon-item price \| \|-----------------------------------\|-----------------------------------------------\|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `day` \| `day` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `10`, then the period of the addon-item price can be `10`, `5`, `2`, or `1`. \| \| `week` \| `week` or `day` \| The `period` (in days) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the period of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `week`, `period` can be `2` or `1`. \* for `period_unit` as `day`, `period` can be `14`, `7`, `2`, or `1`. \| \| `month` \| `month` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `6`, then the `period` of the addon-item price can be `6`, `3`, `2`, or `1`. \| \| `year` \| `year` or `month` \| The `period` (in months) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the `period` of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `year`, `period` can be `2` or `1`. \* for `period_unit` as `month`, `period` can be `24`, `12`, `8`, `6`, `4`, `3`, `2`, or `1`. \| #### Tax provider fields **Avalara** : Merchants using **Avalara Sales Tax** can optionally associate each item price with a locationCode (from their Avalara company locations), so tax can be resolved correctly at the line item level. \| Field ID \| Field Value \| APIs \| \|--------------------------------------------------------------------------------\|----------------------------------------------------------------------\|--------------------------------------------------------------------------------\| \| `locationCode` \| Merchant to configure it on Avalara Platform under company locations \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| **Anrok**: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation \| Field ID \| Field Value \| APIs \| \|---------------------------------------------------------------------------------------------------------------------------------------\|---------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------\| \| `additionalTaxRegistrationNumber` \| Canadian tax registration numbers in comma separated fashion. \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| **Vertex**: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration **Note:** Field Id like `customerCode` , `customerClass` , and`taxExempted` belong to the customer object. Field Id like `productCode` , `productClass` , `productTaxCode` , and `productClass` belong to the product object. \| Field ID \| Field Value \| APIs \| \|-----------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productCode` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `customerCode` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `customerClass` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **Taxamo:** Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration \| Field Id \| Field Value \| APIs \| \|------------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productTaxCode` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `taxExempted` \| Merchant to configure it on Taxamo Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **cbtaxes**: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India. \| Field ID \| Field Value \| APIs \| \|---------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `indiaSez` \| `SEZ_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaSez` \| `SEZ_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **All**: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level \| Field ID \| Field Value \| APIs \| \|-------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `priceType` \| `TAX_INCLUSIVE` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| \| `TAX_EXCLUSIVE` \| \| \| \| `SITE_DEFAULT` or blank \| Removes price type override, and allows site level configuration to be used for tax calculation. \| #### Ramps API compatibility mode If you want to schedule changes on a subscription, use the [Ramps API](https://docs.corsair.dev/docs/api/ramps). If you are currently scheduling changes through the [Update subscription API](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items), migrate to the Ramps API. To get started, [request access for Subscription Ramps](https://app.chargebee.com/login?forward=https://app.chargebee.com/request_access/subscription-ramps\&ref=feature). Chargebee will enable Ramps compatibility mode for your site. Once enabled, you can test the Ramps API without impacting your existing integrations. The following parts of the Billing API have subtle differences in behavior when the Ramps feature is disabled versus when it is enabled with compatibility mode. (Follow the links to learn more.) \* The value of the [`subscription.has_scheduled_changes`](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#has_scheduled_changes) attribute. \* [Update subscription](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#impact-scheduled-changes) \* [Create Checkout for updating a subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription#impact-scheduled-changes) \* [Remove scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/remove-scheduled-changes) \* [Retrieve with scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/retrieve-with-scheduled-changes) \* [Create a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/create-a-quote-for-update-subscription-items) \* [Edit a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/edit-update-subscription-quote-for-items) \* [Portal sessions](https://docs.corsair.dev/docs/api/portal_sessions#scheduled-subscription-changes) |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |
| `credit_notes` | `object[] \| null` | No | Resource object representing credit\_note |

```ts theme={null}
{
  id?: string | null,
  currency_code?: string | null,
  billing_period?: number | null,
  billing_period_unit?: string | null,
  start_date?: number | null,
  trial_end?: number | null,
  remaining_billing_cycles?: number | null,
  po_number?: string | null,
  auto_collection?: string | null,
  plan_quantity_in_decimal?: string | null,
  plan_unit_price_in_decimal?: string | null,
  customer_id?: string | null,
  status?: string | null,
  trial_start?: number | null,
  trial_end_action?: string | null,
  current_term_start?: number | null,
  current_term_end?: number | null,
  next_billing_at?: number | null,
  created_at?: number | null,
  started_at?: number | null,
  activated_at?: number | null,
  contract_term_billing_cycle_on_renewal?: number | null,
  override_relationship?: boolean | null,
  pause_date?: number | null,
  resume_date?: number | null,
  cancelled_at?: number | null,
  cancel_reason?: string | null,
  created_from_ip?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  has_scheduled_advance_invoices?: boolean | null,
  has_scheduled_changes?: boolean | null,
  payment_source_id?: string | null,
  plan_free_quantity_in_decimal?: string | null,
  plan_amount_in_decimal?: string | null,
  cancel_schedule_created_at?: number | null,
  offline_payment_method?: string | null,
  channel?: string | null,
  net_term_days?: number | null,
  active_id?: string | null,
  due_invoices_count?: number | null,
  due_since?: number | null,
  total_dues?: number | null,
  mrr?: number | null,
  exchange_rate?: number | null,
  base_currency_code?: string | null,
  invoice_notes?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  changes_scheduled_at?: number | null,
  cancel_reason_code?: string | null,
  free_period?: number | null,
  free_period_unit?: string | null,
  create_pending_invoices?: boolean | null,
  auto_close_invoices?: boolean | null,
  business_entity_id?: string | null,
  decommissioned?: boolean | null,
  brand_id?: string | null,
  subscription_items?: {
    item_price_id?: string | null,
    item_type?: string | null,
    quantity?: number | null,
    quantity_in_decimal?: string | null,
    unit_price?: number | null,
    unit_price_in_decimal?: string | null,
    amount?: number | null,
    current_term_start?: number | null,
    current_term_end?: number | null,
    next_billing_at?: number | null,
    amount_in_decimal?: string | null,
    billing_period?: number | null,
    billing_period_unit?: string | null,
    free_quantity?: number | null,
    free_quantity_in_decimal?: string | null,
    trial_end?: number | null,
    billing_cycles?: number | null,
    service_period_days?: number | null,
    charge_on_event?: string | null,
    charge_once?: boolean | null,
    charge_on_option?: string | null,
    proration_type?: string | null,
    usage_accumulation_reset_frequency?: string | null,
    description?: string | null
  }[] | null,
  item_tiers?: {
    item_price_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    price?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    price_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null,
    index?: number | null
  }[] | null,
  charged_items?: {
    item_price_id?: string | null,
    last_charged_at?: number | null
  }[] | null,
  coupons?: {
    coupon_id?: string | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_code?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_info?: {
    referral_code?: string | null,
    coupon_code?: string | null,
    referrer_id?: string | null,
    external_reference_id?: string | null,
    reward_status?: string | null,
    referral_system?: string | null,
    account_id?: string | null,
    campaign_id?: string | null,
    external_campaign_id?: string | null,
    friend_offer_type?: string | null,
    referrer_reward_type?: string | null,
    notify_referral_system?: string | null,
    destination_url?: string | null,
    post_purchase_widget_enabled?: boolean | null
  } | null,
  billing_override?: {
    max_excess_payment_usage?: number | null,
    max_refundable_credits_usage?: number | null
  } | null,
  contract_term?: {
    id?: string | null,
    status?: string | null,
    contract_start?: number | null,
    contract_end?: number | null,
    billing_cycle?: number | null,
    action_at_term_end?: string | null,
    total_contract_value?: number | null,
    total_contract_value_before_tax?: number | null,
    cancellation_cutoff_period?: number | null,
    created_at?: number | null,
    subscription_id?: string | null,
    remaining_billing_cycles?: number | null
  } | null,
  discounts?: {
    id?: string | null,
    invoice_name?: string | null,
    description?: string | null,
    type?: string | null,
    percentage?: number | null,
    amount?: number | null,
    quantity?: number | null,
    currency_code?: string | null,
    duration_type?: string | null,
    period?: number | null,
    period_unit?: string | null,
    included_in_mrr?: boolean | null,
    apply_on?: string | null,
    item_price_id?: string | null,
    created_at?: number | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_id?: string | null,
    index?: number | null
  }[] | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  email?: string | null,
  phone?: string | null,
  company?: string | null,
  vat_number?: string | null,
  auto_collection?: string | null,
  offline_payment_method?: string | null,
  net_term_days?: number | null,
  vat_number_validated_time?: number | null,
  vat_number_status?: string | null,
  allow_direct_debit?: boolean | null,
  is_location_valid?: boolean | null,
  created_at?: number | null,
  created_from_ip?: string | null,
  exemption_details?: any[] | null,
  taxability?: string | null,
  entity_code?: string | null,
  exempt_number?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  locale?: string | null,
  billing_date?: number | null,
  billing_month?: number | null,
  billing_date_mode?: string | null,
  billing_day_of_week?: string | null,
  billing_day_of_week_mode?: string | null,
  pii_cleared?: string | null,
  auto_close_invoices?: boolean | null,
  channel?: string | null,
  active_id?: string | null,
  fraud_flag?: string | null,
  primary_payment_source_id?: string | null,
  backup_payment_source_id?: string | null,
  invoice_notes?: string | null,
  business_entity_id?: string | null,
  preferred_currency_code?: string | null,
  promotional_credits?: number | null,
  unbilled_charges?: number | null,
  refundable_credits?: number | null,
  excess_payments?: number | null,
  is_einvoice_enabled?: boolean | null,
  einvoicing_method?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  registered_for_gst?: boolean | null,
  consolidated_invoicing?: boolean | null,
  customer_type?: string | null,
  business_customer_without_vat_number?: boolean | null,
  client_profile_id?: string | null,
  use_default_hierarchy_settings?: boolean | null,
  vat_number_prefix?: string | null,
  entity_identifier_scheme?: string | null,
  entity_identifier_standard?: string | null,
  brand_id?: string | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_urls?: {
    external_customer_id?: string | null,
    referral_sharing_url?: string | null,
    created_at?: number | null,
    updated_at?: number | null,
    referral_campaign_id?: string | null,
    referral_account_id?: string | null,
    referral_external_campaign_id?: string | null,
    referral_system?: string | null
  }[] | null,
  contacts?: {
    id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    phone?: string | null,
    label?: string | null,
    enabled?: boolean | null,
    send_account_email?: boolean | null,
    send_billing_email?: boolean | null
  }[] | null,
  payment_method?: {
    type?: string | null,
    gateway?: string | null,
    gateway_account_id?: string | null,
    status?: string | null,
    reference_id?: string | null
  } | null,
  balances?: {
    promotional_credits?: number | null,
    excess_payments?: number | null,
    refundable_credits?: number | null,
    unbilled_charges?: number | null,
    currency_code?: string | null,
    business_entity_id?: string | null
  }[] | null,
  entity_identifiers?: {
    id?: string | null,
    value?: string | null,
    scheme?: string | null,
    standard?: string | null
  }[] | null,
  tax_providers_fields?: {
    provider_name?: string | null,
    field_id?: string | null,
    field_value?: string | null
  }[] | null,
  relationship?: {
    parent_id?: string | null,
    payment_owner_id?: string | null,
    invoice_owner_id?: string | null
  } | null,
  parent_account_access?: {
    portal_edit_child_subscriptions?: string | null,
    portal_download_child_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null,
  child_account_access?: {
    portal_edit_subscriptions?: string | null,
    portal_download_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null
} | null
```

```ts theme={null}
{
  payment_source_id?: string | null,
  status?: string | null,
  gateway?: string | null,
  gateway_account_id?: string | null,
  ref_tx_id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  iin?: string | null,
  last4?: string | null,
  card_type?: string | null,
  funding_type?: string | null,
  expiry_month?: number | null,
  expiry_year?: number | null,
  issuing_country?: string | null,
  billing_addr1?: string | null,
  billing_addr2?: string | null,
  billing_city?: string | null,
  billing_state_code?: string | null,
  billing_state?: string | null,
  billing_country?: string | null,
  billing_zip?: string | null,
  created_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  ip_address?: string | null,
  powered_by?: string | null,
  customer_id?: string | null,
  masked_number?: string | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  subscription_id?: string | null,
  reference_invoice_id?: string | null,
  type?: string | null,
  reason_code?: string | null,
  status?: string | null,
  vat_number?: string | null,
  date?: number | null,
  price_type?: string | null,
  currency_code?: string | null,
  total?: number | null,
  amount_allocated?: number | null,
  amount_refunded?: number | null,
  amount_available?: number | null,
  refunded_at?: number | null,
  voided_at?: number | null,
  generated_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  channel?: string | null,
  line_items_next_offset?: string | null,
  sub_total?: number | null,
  sub_total_in_local_currency?: number | null,
  total_in_local_currency?: number | null,
  local_currency_code?: string | null,
  round_off_amount?: number | null,
  fractional_correction?: number | null,
  notes?: string[] | null,
  deleted?: boolean | null,
  tax_category?: string | null,
  local_currency_exchange_rate?: number | null,
  create_reason_code?: string | null,
  vat_number_prefix?: string | null,
  business_entity_id?: string | null,
  brand_id?: string | null,
  line_items?: {
    id?: string | null,
    subscription_id?: string | null,
    date_from?: number | null,
    date_to?: number | null,
    unit_amount?: number | null,
    quantity?: number | null,
    amount?: number | null,
    pricing_model?: string | null,
    is_taxed?: boolean | null,
    tax_amount?: number | null,
    tax_rate?: number | null,
    unit_amount_in_decimal?: string | null,
    quantity_in_decimal?: string | null,
    amount_in_decimal?: string | null,
    discount_amount?: number | null,
    item_level_discount_amount?: number | null,
    metered?: boolean | null,
    is_percentage_pricing?: boolean | null,
    reference_line_item_id?: string | null,
    description?: string | null,
    entity_description?: string | null,
    entity_type?: string | null,
    tax_exempt_reason?: string | null,
    entity_id?: string | null,
    customer_id?: string | null,
    proration_mode?: string | null
  }[] | null,
  line_item_tiers?: {
    line_item_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    quantity_used?: number | null,
    unit_amount?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    quantity_used_in_decimal?: string | null,
    unit_amount_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null
  }[] | null,
  line_item_discounts?: {
    line_item_id?: string | null,
    discount_type?: string | null,
    coupon_id?: string | null,
    entity_id?: string | null,
    discount_amount?: number | null
  }[] | null,
  line_item_taxes?: {
    line_item_id?: string | null,
    tax_name?: string | null,
    tax_rate?: number | null,
    date_to?: number | null,
    date_from?: number | null,
    prorated_taxable_amount?: number | null,
    is_partial_tax_applied?: boolean | null,
    is_non_compliance_tax?: boolean | null,
    taxable_amount?: number | null,
    tax_amount?: number | null,
    tax_juris_type?: string | null,
    tax_juris_name?: string | null,
    tax_juris_code?: string | null,
    tax_amount_in_local_currency?: number | null,
    local_currency_code?: string | null
  }[] | null,
  line_item_addresses?: {
    line_item_id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  }[] | null,
  discounts?: {
    amount?: number | null,
    description?: string | null,
    line_item_id?: string | null,
    entity_type?: string | null,
    discount_type?: string | null,
    entity_id?: string | null,
    coupon_set_code?: string | null
  }[] | null,
  taxes?: {
    name?: string | null,
    amount?: number | null,
    description?: string | null
  }[] | null,
  tax_origin?: {
    country?: string | null,
    registration_number?: string | null
  } | null,
  linked_refunds?: {
    txn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null,
    refund_reason_code?: string | null
  }[] | null,
  linked_tax_withheld_refunds?: {
    id?: string | null,
    amount?: number | null,
    description?: string | null,
    date?: number | null,
    reference_number?: string | null
  }[] | null,
  allocations?: {
    invoice_id?: string | null,
    allocated_amount?: number | null,
    allocated_at?: number | null,
    invoice_date?: number | null,
    invoice_status?: string | null,
    tax_application?: string | null
  }[] | null,
  exchange_rates?: {
    currency_code?: string | null,
    rate?: number | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  einvoice?: {
    id?: string | null,
    reference_id?: string | null,
    reference_number?: string | null,
    status?: string | null,
    message?: string | null,
    provider_references?: any[] | null
  } | null,
  site_details_at_creation?: {
    timezone?: string | null,
    organization_address?: {
    } | null
  } | null
}[] | null
```

***

### removeScheduledPause

`subscriptions.removeScheduledPause`

Remove scheduled pause. If the subscription is in Active or Non Renewing state and is also scheduled to pause at the end\_of\_term/specific\_date, this API can be used to remove the scheduled pause. Warning This API will return an error when multi-frequency billing is enabled.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.subscriptions.removeScheduledPause({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `subscription` | `object \| null` | No | A Chargebee subscription connects a customer record to products/services. It describes what the customer has signed up for and how often they're charged for it. The essential components of a subscription are: \* A [plan-item price](https://docs.corsair.dev/docs/api/item_prices). \* Any addon- and charge-item prices applied to the subscription. \* Any [coupons](https://docs.corsair.dev/docs/api/coupons) applied. \* Any [discounts](https://docs.corsair.dev/docs/api/discounts) applied. The charges in a subscription are billed via invoices. **Note:** The maximum number of subscriptions for any given [customer](https://docs.corsair.dev/docs/api/customers) ([active](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#status) or not) is 900. #### Subscription billing frequencies Chargebee offers two billing frequency options for subscriptions: \* **Plan-based billing** (`default`): Subscriptions are billed based on the billing period defined for the item price of the `item_type` `plan`. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/subscriptions#plan-based-billing). \* **Multi-frequency billing** : Subscriptions are billed according to the billing period of each recurring item price within the subscription. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing). **Important** [Limitations](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing#limitations) of Multi-frequency billing. The selection of the billing frequency preference is configured at the site level. #### Item price compatibility in a subscription When creating or updating a subscription, one of the item prices specified under subscription\_items must be a plan-item price. The remaining must be compatible addon- or charge-item prices. An item price is compatible with a plan-item price if their currencies are the same. Additionally, an addon-item price is compatible with a plan-item price only if their billing frequencies meet the following conditions: \| `period_unit` for plan-item price \| Compatible `period_unit` for addon-item price \| Compatible period for addon-item price \| \|-----------------------------------\|-----------------------------------------------\|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `day` \| `day` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `10`, then the period of the addon-item price can be `10`, `5`, `2`, or `1`. \| \| `week` \| `week` or `day` \| The `period` (in days) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the period of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `week`, `period` can be `2` or `1`. \* for `period_unit` as `day`, `period` can be `14`, `7`, `2`, or `1`. \| \| `month` \| `month` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `6`, then the `period` of the addon-item price can be `6`, `3`, `2`, or `1`. \| \| `year` \| `year` or `month` \| The `period` (in months) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the `period` of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `year`, `period` can be `2` or `1`. \* for `period_unit` as `month`, `period` can be `24`, `12`, `8`, `6`, `4`, `3`, `2`, or `1`. \| #### Tax provider fields **Avalara** : Merchants using **Avalara Sales Tax** can optionally associate each item price with a locationCode (from their Avalara company locations), so tax can be resolved correctly at the line item level. \| Field ID \| Field Value \| APIs \| \|--------------------------------------------------------------------------------\|----------------------------------------------------------------------\|--------------------------------------------------------------------------------\| \| `locationCode` \| Merchant to configure it on Avalara Platform under company locations \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| **Anrok**: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation \| Field ID \| Field Value \| APIs \| \|---------------------------------------------------------------------------------------------------------------------------------------\|---------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------\| \| `additionalTaxRegistrationNumber` \| Canadian tax registration numbers in comma separated fashion. \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| **Vertex**: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration **Note:** Field Id like `customerCode` , `customerClass` , and`taxExempted` belong to the customer object. Field Id like `productCode` , `productClass` , `productTaxCode` , and `productClass` belong to the product object. \| Field ID \| Field Value \| APIs \| \|-----------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productCode` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `customerCode` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `customerClass` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **Taxamo:** Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration \| Field Id \| Field Value \| APIs \| \|------------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productTaxCode` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `taxExempted` \| Merchant to configure it on Taxamo Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **cbtaxes**: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India. \| Field ID \| Field Value \| APIs \| \|---------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `indiaSez` \| `SEZ_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaSez` \| `SEZ_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **All**: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level \| Field ID \| Field Value \| APIs \| \|-------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `priceType` \| `TAX_INCLUSIVE` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| \| `TAX_EXCLUSIVE` \| \| \| \| `SITE_DEFAULT` or blank \| Removes price type override, and allows site level configuration to be used for tax calculation. \| #### Ramps API compatibility mode If you want to schedule changes on a subscription, use the [Ramps API](https://docs.corsair.dev/docs/api/ramps). If you are currently scheduling changes through the [Update subscription API](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items), migrate to the Ramps API. To get started, [request access for Subscription Ramps](https://app.chargebee.com/login?forward=https://app.chargebee.com/request_access/subscription-ramps\&ref=feature). Chargebee will enable Ramps compatibility mode for your site. Once enabled, you can test the Ramps API without impacting your existing integrations. The following parts of the Billing API have subtle differences in behavior when the Ramps feature is disabled versus when it is enabled with compatibility mode. (Follow the links to learn more.) \* The value of the [`subscription.has_scheduled_changes`](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#has_scheduled_changes) attribute. \* [Update subscription](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#impact-scheduled-changes) \* [Create Checkout for updating a subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription#impact-scheduled-changes) \* [Remove scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/remove-scheduled-changes) \* [Retrieve with scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/retrieve-with-scheduled-changes) \* [Create a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/create-a-quote-for-update-subscription-items) \* [Edit a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/edit-update-subscription-quote-for-items) \* [Portal sessions](https://docs.corsair.dev/docs/api/portal_sessions#scheduled-subscription-changes) |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |

```ts theme={null}
{
  id?: string | null,
  currency_code?: string | null,
  billing_period?: number | null,
  billing_period_unit?: string | null,
  start_date?: number | null,
  trial_end?: number | null,
  remaining_billing_cycles?: number | null,
  po_number?: string | null,
  auto_collection?: string | null,
  plan_quantity_in_decimal?: string | null,
  plan_unit_price_in_decimal?: string | null,
  customer_id?: string | null,
  status?: string | null,
  trial_start?: number | null,
  trial_end_action?: string | null,
  current_term_start?: number | null,
  current_term_end?: number | null,
  next_billing_at?: number | null,
  created_at?: number | null,
  started_at?: number | null,
  activated_at?: number | null,
  contract_term_billing_cycle_on_renewal?: number | null,
  override_relationship?: boolean | null,
  pause_date?: number | null,
  resume_date?: number | null,
  cancelled_at?: number | null,
  cancel_reason?: string | null,
  created_from_ip?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  has_scheduled_advance_invoices?: boolean | null,
  has_scheduled_changes?: boolean | null,
  payment_source_id?: string | null,
  plan_free_quantity_in_decimal?: string | null,
  plan_amount_in_decimal?: string | null,
  cancel_schedule_created_at?: number | null,
  offline_payment_method?: string | null,
  channel?: string | null,
  net_term_days?: number | null,
  active_id?: string | null,
  due_invoices_count?: number | null,
  due_since?: number | null,
  total_dues?: number | null,
  mrr?: number | null,
  exchange_rate?: number | null,
  base_currency_code?: string | null,
  invoice_notes?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  changes_scheduled_at?: number | null,
  cancel_reason_code?: string | null,
  free_period?: number | null,
  free_period_unit?: string | null,
  create_pending_invoices?: boolean | null,
  auto_close_invoices?: boolean | null,
  business_entity_id?: string | null,
  decommissioned?: boolean | null,
  brand_id?: string | null,
  subscription_items?: {
    item_price_id?: string | null,
    item_type?: string | null,
    quantity?: number | null,
    quantity_in_decimal?: string | null,
    unit_price?: number | null,
    unit_price_in_decimal?: string | null,
    amount?: number | null,
    current_term_start?: number | null,
    current_term_end?: number | null,
    next_billing_at?: number | null,
    amount_in_decimal?: string | null,
    billing_period?: number | null,
    billing_period_unit?: string | null,
    free_quantity?: number | null,
    free_quantity_in_decimal?: string | null,
    trial_end?: number | null,
    billing_cycles?: number | null,
    service_period_days?: number | null,
    charge_on_event?: string | null,
    charge_once?: boolean | null,
    charge_on_option?: string | null,
    proration_type?: string | null,
    usage_accumulation_reset_frequency?: string | null,
    description?: string | null
  }[] | null,
  item_tiers?: {
    item_price_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    price?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    price_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null,
    index?: number | null
  }[] | null,
  charged_items?: {
    item_price_id?: string | null,
    last_charged_at?: number | null
  }[] | null,
  coupons?: {
    coupon_id?: string | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_code?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_info?: {
    referral_code?: string | null,
    coupon_code?: string | null,
    referrer_id?: string | null,
    external_reference_id?: string | null,
    reward_status?: string | null,
    referral_system?: string | null,
    account_id?: string | null,
    campaign_id?: string | null,
    external_campaign_id?: string | null,
    friend_offer_type?: string | null,
    referrer_reward_type?: string | null,
    notify_referral_system?: string | null,
    destination_url?: string | null,
    post_purchase_widget_enabled?: boolean | null
  } | null,
  billing_override?: {
    max_excess_payment_usage?: number | null,
    max_refundable_credits_usage?: number | null
  } | null,
  contract_term?: {
    id?: string | null,
    status?: string | null,
    contract_start?: number | null,
    contract_end?: number | null,
    billing_cycle?: number | null,
    action_at_term_end?: string | null,
    total_contract_value?: number | null,
    total_contract_value_before_tax?: number | null,
    cancellation_cutoff_period?: number | null,
    created_at?: number | null,
    subscription_id?: string | null,
    remaining_billing_cycles?: number | null
  } | null,
  discounts?: {
    id?: string | null,
    invoice_name?: string | null,
    description?: string | null,
    type?: string | null,
    percentage?: number | null,
    amount?: number | null,
    quantity?: number | null,
    currency_code?: string | null,
    duration_type?: string | null,
    period?: number | null,
    period_unit?: string | null,
    included_in_mrr?: boolean | null,
    apply_on?: string | null,
    item_price_id?: string | null,
    created_at?: number | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_id?: string | null,
    index?: number | null
  }[] | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  email?: string | null,
  phone?: string | null,
  company?: string | null,
  vat_number?: string | null,
  auto_collection?: string | null,
  offline_payment_method?: string | null,
  net_term_days?: number | null,
  vat_number_validated_time?: number | null,
  vat_number_status?: string | null,
  allow_direct_debit?: boolean | null,
  is_location_valid?: boolean | null,
  created_at?: number | null,
  created_from_ip?: string | null,
  exemption_details?: any[] | null,
  taxability?: string | null,
  entity_code?: string | null,
  exempt_number?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  locale?: string | null,
  billing_date?: number | null,
  billing_month?: number | null,
  billing_date_mode?: string | null,
  billing_day_of_week?: string | null,
  billing_day_of_week_mode?: string | null,
  pii_cleared?: string | null,
  auto_close_invoices?: boolean | null,
  channel?: string | null,
  active_id?: string | null,
  fraud_flag?: string | null,
  primary_payment_source_id?: string | null,
  backup_payment_source_id?: string | null,
  invoice_notes?: string | null,
  business_entity_id?: string | null,
  preferred_currency_code?: string | null,
  promotional_credits?: number | null,
  unbilled_charges?: number | null,
  refundable_credits?: number | null,
  excess_payments?: number | null,
  is_einvoice_enabled?: boolean | null,
  einvoicing_method?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  registered_for_gst?: boolean | null,
  consolidated_invoicing?: boolean | null,
  customer_type?: string | null,
  business_customer_without_vat_number?: boolean | null,
  client_profile_id?: string | null,
  use_default_hierarchy_settings?: boolean | null,
  vat_number_prefix?: string | null,
  entity_identifier_scheme?: string | null,
  entity_identifier_standard?: string | null,
  brand_id?: string | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_urls?: {
    external_customer_id?: string | null,
    referral_sharing_url?: string | null,
    created_at?: number | null,
    updated_at?: number | null,
    referral_campaign_id?: string | null,
    referral_account_id?: string | null,
    referral_external_campaign_id?: string | null,
    referral_system?: string | null
  }[] | null,
  contacts?: {
    id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    phone?: string | null,
    label?: string | null,
    enabled?: boolean | null,
    send_account_email?: boolean | null,
    send_billing_email?: boolean | null
  }[] | null,
  payment_method?: {
    type?: string | null,
    gateway?: string | null,
    gateway_account_id?: string | null,
    status?: string | null,
    reference_id?: string | null
  } | null,
  balances?: {
    promotional_credits?: number | null,
    excess_payments?: number | null,
    refundable_credits?: number | null,
    unbilled_charges?: number | null,
    currency_code?: string | null,
    business_entity_id?: string | null
  }[] | null,
  entity_identifiers?: {
    id?: string | null,
    value?: string | null,
    scheme?: string | null,
    standard?: string | null
  }[] | null,
  tax_providers_fields?: {
    provider_name?: string | null,
    field_id?: string | null,
    field_value?: string | null
  }[] | null,
  relationship?: {
    parent_id?: string | null,
    payment_owner_id?: string | null,
    invoice_owner_id?: string | null
  } | null,
  parent_account_access?: {
    portal_edit_child_subscriptions?: string | null,
    portal_download_child_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null,
  child_account_access?: {
    portal_edit_subscriptions?: string | null,
    portal_download_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null
} | null
```

```ts theme={null}
{
  payment_source_id?: string | null,
  status?: string | null,
  gateway?: string | null,
  gateway_account_id?: string | null,
  ref_tx_id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  iin?: string | null,
  last4?: string | null,
  card_type?: string | null,
  funding_type?: string | null,
  expiry_month?: number | null,
  expiry_year?: number | null,
  issuing_country?: string | null,
  billing_addr1?: string | null,
  billing_addr2?: string | null,
  billing_city?: string | null,
  billing_state_code?: string | null,
  billing_state?: string | null,
  billing_country?: string | null,
  billing_zip?: string | null,
  created_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  ip_address?: string | null,
  powered_by?: string | null,
  customer_id?: string | null,
  masked_number?: string | null
} | null
```

***

### removeScheduledResumption

`subscriptions.removeScheduledResumption`

Remove scheduled resumption. If the subscription is in Paused state and is scheduled to resume on a specific\_date, this API can be used to remove the scheduled resumption. When the scheduled resumption is removed, the subscription will remain Paused. Warning This API will return an error when multi-frequency billing is enabled.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.subscriptions.removeScheduledResumption({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `subscription` | `object \| null` | No | A Chargebee subscription connects a customer record to products/services. It describes what the customer has signed up for and how often they're charged for it. The essential components of a subscription are: \* A [plan-item price](https://docs.corsair.dev/docs/api/item_prices). \* Any addon- and charge-item prices applied to the subscription. \* Any [coupons](https://docs.corsair.dev/docs/api/coupons) applied. \* Any [discounts](https://docs.corsair.dev/docs/api/discounts) applied. The charges in a subscription are billed via invoices. **Note:** The maximum number of subscriptions for any given [customer](https://docs.corsair.dev/docs/api/customers) ([active](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#status) or not) is 900. #### Subscription billing frequencies Chargebee offers two billing frequency options for subscriptions: \* **Plan-based billing** (`default`): Subscriptions are billed based on the billing period defined for the item price of the `item_type` `plan`. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/subscriptions#plan-based-billing). \* **Multi-frequency billing** : Subscriptions are billed according to the billing period of each recurring item price within the subscription. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing). **Important** [Limitations](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing#limitations) of Multi-frequency billing. The selection of the billing frequency preference is configured at the site level. #### Item price compatibility in a subscription When creating or updating a subscription, one of the item prices specified under subscription\_items must be a plan-item price. The remaining must be compatible addon- or charge-item prices. An item price is compatible with a plan-item price if their currencies are the same. Additionally, an addon-item price is compatible with a plan-item price only if their billing frequencies meet the following conditions: \| `period_unit` for plan-item price \| Compatible `period_unit` for addon-item price \| Compatible period for addon-item price \| \|-----------------------------------\|-----------------------------------------------\|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `day` \| `day` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `10`, then the period of the addon-item price can be `10`, `5`, `2`, or `1`. \| \| `week` \| `week` or `day` \| The `period` (in days) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the period of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `week`, `period` can be `2` or `1`. \* for `period_unit` as `day`, `period` can be `14`, `7`, `2`, or `1`. \| \| `month` \| `month` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `6`, then the `period` of the addon-item price can be `6`, `3`, `2`, or `1`. \| \| `year` \| `year` or `month` \| The `period` (in months) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the `period` of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `year`, `period` can be `2` or `1`. \* for `period_unit` as `month`, `period` can be `24`, `12`, `8`, `6`, `4`, `3`, `2`, or `1`. \| #### Tax provider fields **Avalara** : Merchants using **Avalara Sales Tax** can optionally associate each item price with a locationCode (from their Avalara company locations), so tax can be resolved correctly at the line item level. \| Field ID \| Field Value \| APIs \| \|--------------------------------------------------------------------------------\|----------------------------------------------------------------------\|--------------------------------------------------------------------------------\| \| `locationCode` \| Merchant to configure it on Avalara Platform under company locations \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| **Anrok**: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation \| Field ID \| Field Value \| APIs \| \|---------------------------------------------------------------------------------------------------------------------------------------\|---------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------\| \| `additionalTaxRegistrationNumber` \| Canadian tax registration numbers in comma separated fashion. \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| **Vertex**: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration **Note:** Field Id like `customerCode` , `customerClass` , and`taxExempted` belong to the customer object. Field Id like `productCode` , `productClass` , `productTaxCode` , and `productClass` belong to the product object. \| Field ID \| Field Value \| APIs \| \|-----------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productCode` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `customerCode` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `customerClass` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **Taxamo:** Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration \| Field Id \| Field Value \| APIs \| \|------------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productTaxCode` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `taxExempted` \| Merchant to configure it on Taxamo Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **cbtaxes**: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India. \| Field ID \| Field Value \| APIs \| \|---------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `indiaSez` \| `SEZ_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaSez` \| `SEZ_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **All**: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level \| Field ID \| Field Value \| APIs \| \|-------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `priceType` \| `TAX_INCLUSIVE` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| \| `TAX_EXCLUSIVE` \| \| \| \| `SITE_DEFAULT` or blank \| Removes price type override, and allows site level configuration to be used for tax calculation. \| #### Ramps API compatibility mode If you want to schedule changes on a subscription, use the [Ramps API](https://docs.corsair.dev/docs/api/ramps). If you are currently scheduling changes through the [Update subscription API](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items), migrate to the Ramps API. To get started, [request access for Subscription Ramps](https://app.chargebee.com/login?forward=https://app.chargebee.com/request_access/subscription-ramps\&ref=feature). Chargebee will enable Ramps compatibility mode for your site. Once enabled, you can test the Ramps API without impacting your existing integrations. The following parts of the Billing API have subtle differences in behavior when the Ramps feature is disabled versus when it is enabled with compatibility mode. (Follow the links to learn more.) \* The value of the [`subscription.has_scheduled_changes`](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#has_scheduled_changes) attribute. \* [Update subscription](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#impact-scheduled-changes) \* [Create Checkout for updating a subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription#impact-scheduled-changes) \* [Remove scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/remove-scheduled-changes) \* [Retrieve with scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/retrieve-with-scheduled-changes) \* [Create a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/create-a-quote-for-update-subscription-items) \* [Edit a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/edit-update-subscription-quote-for-items) \* [Portal sessions](https://docs.corsair.dev/docs/api/portal_sessions#scheduled-subscription-changes) |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |

```ts theme={null}
{
  id?: string | null,
  currency_code?: string | null,
  billing_period?: number | null,
  billing_period_unit?: string | null,
  start_date?: number | null,
  trial_end?: number | null,
  remaining_billing_cycles?: number | null,
  po_number?: string | null,
  auto_collection?: string | null,
  plan_quantity_in_decimal?: string | null,
  plan_unit_price_in_decimal?: string | null,
  customer_id?: string | null,
  status?: string | null,
  trial_start?: number | null,
  trial_end_action?: string | null,
  current_term_start?: number | null,
  current_term_end?: number | null,
  next_billing_at?: number | null,
  created_at?: number | null,
  started_at?: number | null,
  activated_at?: number | null,
  contract_term_billing_cycle_on_renewal?: number | null,
  override_relationship?: boolean | null,
  pause_date?: number | null,
  resume_date?: number | null,
  cancelled_at?: number | null,
  cancel_reason?: string | null,
  created_from_ip?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  has_scheduled_advance_invoices?: boolean | null,
  has_scheduled_changes?: boolean | null,
  payment_source_id?: string | null,
  plan_free_quantity_in_decimal?: string | null,
  plan_amount_in_decimal?: string | null,
  cancel_schedule_created_at?: number | null,
  offline_payment_method?: string | null,
  channel?: string | null,
  net_term_days?: number | null,
  active_id?: string | null,
  due_invoices_count?: number | null,
  due_since?: number | null,
  total_dues?: number | null,
  mrr?: number | null,
  exchange_rate?: number | null,
  base_currency_code?: string | null,
  invoice_notes?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  changes_scheduled_at?: number | null,
  cancel_reason_code?: string | null,
  free_period?: number | null,
  free_period_unit?: string | null,
  create_pending_invoices?: boolean | null,
  auto_close_invoices?: boolean | null,
  business_entity_id?: string | null,
  decommissioned?: boolean | null,
  brand_id?: string | null,
  subscription_items?: {
    item_price_id?: string | null,
    item_type?: string | null,
    quantity?: number | null,
    quantity_in_decimal?: string | null,
    unit_price?: number | null,
    unit_price_in_decimal?: string | null,
    amount?: number | null,
    current_term_start?: number | null,
    current_term_end?: number | null,
    next_billing_at?: number | null,
    amount_in_decimal?: string | null,
    billing_period?: number | null,
    billing_period_unit?: string | null,
    free_quantity?: number | null,
    free_quantity_in_decimal?: string | null,
    trial_end?: number | null,
    billing_cycles?: number | null,
    service_period_days?: number | null,
    charge_on_event?: string | null,
    charge_once?: boolean | null,
    charge_on_option?: string | null,
    proration_type?: string | null,
    usage_accumulation_reset_frequency?: string | null,
    description?: string | null
  }[] | null,
  item_tiers?: {
    item_price_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    price?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    price_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null,
    index?: number | null
  }[] | null,
  charged_items?: {
    item_price_id?: string | null,
    last_charged_at?: number | null
  }[] | null,
  coupons?: {
    coupon_id?: string | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_code?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_info?: {
    referral_code?: string | null,
    coupon_code?: string | null,
    referrer_id?: string | null,
    external_reference_id?: string | null,
    reward_status?: string | null,
    referral_system?: string | null,
    account_id?: string | null,
    campaign_id?: string | null,
    external_campaign_id?: string | null,
    friend_offer_type?: string | null,
    referrer_reward_type?: string | null,
    notify_referral_system?: string | null,
    destination_url?: string | null,
    post_purchase_widget_enabled?: boolean | null
  } | null,
  billing_override?: {
    max_excess_payment_usage?: number | null,
    max_refundable_credits_usage?: number | null
  } | null,
  contract_term?: {
    id?: string | null,
    status?: string | null,
    contract_start?: number | null,
    contract_end?: number | null,
    billing_cycle?: number | null,
    action_at_term_end?: string | null,
    total_contract_value?: number | null,
    total_contract_value_before_tax?: number | null,
    cancellation_cutoff_period?: number | null,
    created_at?: number | null,
    subscription_id?: string | null,
    remaining_billing_cycles?: number | null
  } | null,
  discounts?: {
    id?: string | null,
    invoice_name?: string | null,
    description?: string | null,
    type?: string | null,
    percentage?: number | null,
    amount?: number | null,
    quantity?: number | null,
    currency_code?: string | null,
    duration_type?: string | null,
    period?: number | null,
    period_unit?: string | null,
    included_in_mrr?: boolean | null,
    apply_on?: string | null,
    item_price_id?: string | null,
    created_at?: number | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_id?: string | null,
    index?: number | null
  }[] | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  email?: string | null,
  phone?: string | null,
  company?: string | null,
  vat_number?: string | null,
  auto_collection?: string | null,
  offline_payment_method?: string | null,
  net_term_days?: number | null,
  vat_number_validated_time?: number | null,
  vat_number_status?: string | null,
  allow_direct_debit?: boolean | null,
  is_location_valid?: boolean | null,
  created_at?: number | null,
  created_from_ip?: string | null,
  exemption_details?: any[] | null,
  taxability?: string | null,
  entity_code?: string | null,
  exempt_number?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  locale?: string | null,
  billing_date?: number | null,
  billing_month?: number | null,
  billing_date_mode?: string | null,
  billing_day_of_week?: string | null,
  billing_day_of_week_mode?: string | null,
  pii_cleared?: string | null,
  auto_close_invoices?: boolean | null,
  channel?: string | null,
  active_id?: string | null,
  fraud_flag?: string | null,
  primary_payment_source_id?: string | null,
  backup_payment_source_id?: string | null,
  invoice_notes?: string | null,
  business_entity_id?: string | null,
  preferred_currency_code?: string | null,
  promotional_credits?: number | null,
  unbilled_charges?: number | null,
  refundable_credits?: number | null,
  excess_payments?: number | null,
  is_einvoice_enabled?: boolean | null,
  einvoicing_method?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  registered_for_gst?: boolean | null,
  consolidated_invoicing?: boolean | null,
  customer_type?: string | null,
  business_customer_without_vat_number?: boolean | null,
  client_profile_id?: string | null,
  use_default_hierarchy_settings?: boolean | null,
  vat_number_prefix?: string | null,
  entity_identifier_scheme?: string | null,
  entity_identifier_standard?: string | null,
  brand_id?: string | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_urls?: {
    external_customer_id?: string | null,
    referral_sharing_url?: string | null,
    created_at?: number | null,
    updated_at?: number | null,
    referral_campaign_id?: string | null,
    referral_account_id?: string | null,
    referral_external_campaign_id?: string | null,
    referral_system?: string | null
  }[] | null,
  contacts?: {
    id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    phone?: string | null,
    label?: string | null,
    enabled?: boolean | null,
    send_account_email?: boolean | null,
    send_billing_email?: boolean | null
  }[] | null,
  payment_method?: {
    type?: string | null,
    gateway?: string | null,
    gateway_account_id?: string | null,
    status?: string | null,
    reference_id?: string | null
  } | null,
  balances?: {
    promotional_credits?: number | null,
    excess_payments?: number | null,
    refundable_credits?: number | null,
    unbilled_charges?: number | null,
    currency_code?: string | null,
    business_entity_id?: string | null
  }[] | null,
  entity_identifiers?: {
    id?: string | null,
    value?: string | null,
    scheme?: string | null,
    standard?: string | null
  }[] | null,
  tax_providers_fields?: {
    provider_name?: string | null,
    field_id?: string | null,
    field_value?: string | null
  }[] | null,
  relationship?: {
    parent_id?: string | null,
    payment_owner_id?: string | null,
    invoice_owner_id?: string | null
  } | null,
  parent_account_access?: {
    portal_edit_child_subscriptions?: string | null,
    portal_download_child_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null,
  child_account_access?: {
    portal_edit_subscriptions?: string | null,
    portal_download_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null
} | null
```

```ts theme={null}
{
  payment_source_id?: string | null,
  status?: string | null,
  gateway?: string | null,
  gateway_account_id?: string | null,
  ref_tx_id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  iin?: string | null,
  last4?: string | null,
  card_type?: string | null,
  funding_type?: string | null,
  expiry_month?: number | null,
  expiry_year?: number | null,
  issuing_country?: string | null,
  billing_addr1?: string | null,
  billing_addr2?: string | null,
  billing_city?: string | null,
  billing_state_code?: string | null,
  billing_state?: string | null,
  billing_country?: string | null,
  billing_zip?: string | null,
  created_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  ip_address?: string | null,
  powered_by?: string | null,
  customer_id?: string | null,
  masked_number?: string | null
} | null
```

***

### renewalEstimate

`subscriptions.renewalEstimate`

Subscription renewal estimate. This returns an estimate of the amount that will be charged when the subscription is billed next. The estimate is calculated based on the current recurring items of the subscription - plan, addons, and coupons.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.subscriptions.renewalEstimate({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `include_delayed_charges` | `boolean` | No | If true, all the unbilled charges will be included for the invoice estimate. |
| `use_existing_balances` | `boolean` | No | 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`. |
| `ignore_scheduled_cancellation` | `boolean` | No | if true, ignores scheduled cancellation for non renewing subscription. |
| `ignore_scheduled_changes` | `boolean` | No | If true, ignores all recurring charges scheduled during renewal. |
| `exclude_tax_type` | `exclusive \| none` | No | Indicates whether tax calculation should be excluded for the operation. This attribute is applicable only when a third-party tax provider is configured. If no such provider is set up, this parameter will be ignored. \* exclusive - Excludes only **exclusive** tax calculations, and only when exclusive taxes are applicable. \* none - No exclusions are applied. All applicable taxes are calculated based on the standard tax configuration. |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `estimate` | `object \| null` | No | During the process of signing up customers to subscriptions, use the Estimates API to evaluate the details of the purchase before actually signing them up. The details returned by the API include the invoice amounts, next billing date and unbilled charges. For example, consider that you are creating a new subscription or update an existing one. Use the Estimates API before that to deduce the details such as the amount the customer would be charged, the state the subscription would be in after creation or updation, and so on. If you have configured the [Avalara integration](https://www.chargebee.com/docs/2.0/avalara.html), Chargebee retrieves the tax amount from Avalara for the invoice. This counts against your Avalara API limits. |

```ts theme={null}
{
  created_at?: number | null,
  subscription_estimate?: {
    id?: string | null,
    currency_code?: string | null,
    status?: string | null,
    trial_end_action?: string | null,
    next_billing_at?: number | null,
    pause_date?: number | null,
    resume_date?: number | null,
    shipping_address?: {
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    } | null,
    contract_term?: {
      id?: string | null,
      status?: string | null,
      contract_start?: number | null,
      contract_end?: number | null,
      billing_cycle?: number | null,
      action_at_term_end?: string | null,
      total_contract_value?: number | null,
      total_contract_value_before_tax?: number | null,
      cancellation_cutoff_period?: number | null,
      created_at?: number | null,
      subscription_id?: string | null,
      remaining_billing_cycles?: number | null
    } | null
  } | null,
  subscription_estimates?: {
    id?: string | null,
    currency_code?: string | null,
    status?: string | null,
    trial_end_action?: string | null,
    next_billing_at?: number | null,
    pause_date?: number | null,
    resume_date?: number | null,
    shipping_address?: {
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    } | null,
    contract_term?: {
      id?: string | null,
      status?: string | null,
      contract_start?: number | null,
      contract_end?: number | null,
      billing_cycle?: number | null,
      action_at_term_end?: string | null,
      total_contract_value?: number | null,
      total_contract_value_before_tax?: number | null,
      cancellation_cutoff_period?: number | null,
      created_at?: number | null,
      subscription_id?: string | null,
      remaining_billing_cycles?: number | null
    } | null
  }[] | null,
  invoice_estimate?: {
    recurring?: boolean | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    credits_applied?: number | null,
    amount_paid?: number | null,
    amount_due?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    line_item_credits?: {
      cn_id?: string | null,
      applied_amount?: number | null,
      line_item_id?: string | null
    }[] | null,
    line_item_addresses?: {
      line_item_id?: string | null,
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  } | null,
  invoice_estimates?: {
    recurring?: boolean | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    credits_applied?: number | null,
    amount_paid?: number | null,
    amount_due?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    line_item_credits?: {
      cn_id?: string | null,
      applied_amount?: number | null,
      line_item_id?: string | null
    }[] | null,
    line_item_addresses?: {
      line_item_id?: string | null,
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  }[] | null,
  payment_schedule_estimates?: {
    id?: string | null,
    scheme_id?: string | null,
    entity_type?: string | null,
    entity_id?: string | null,
    amount?: number | null,
    currency_code?: string | null,
    schedule_entries?: {
      id?: string | null,
      date?: number | null,
      amount?: number | null,
      scheduled_amount?: number | null,
      status?: string | null
    }[] | null
  }[] | null,
  next_invoice_estimate?: {
    recurring?: boolean | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    credits_applied?: number | null,
    amount_paid?: number | null,
    amount_due?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    line_item_credits?: {
      cn_id?: string | null,
      applied_amount?: number | null,
      line_item_id?: string | null
    }[] | null,
    line_item_addresses?: {
      line_item_id?: string | null,
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  } | null,
  credit_note_estimates?: {
    reference_invoice_id?: string | null,
    type?: string | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    amount_allocated?: number | null,
    amount_available?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  }[] | null,
  unbilled_charge_estimates?: {
    id?: string | null,
    customer_id?: string | null,
    subscription_id?: string | null,
    date_from?: number | null,
    date_to?: number | null,
    unit_amount?: number | null,
    pricing_model?: string | null,
    quantity?: number | null,
    amount?: number | null,
    currency_code?: string | null,
    discount_amount?: number | null,
    description?: string | null,
    entity_type?: string | null,
    entity_id?: string | null,
    is_voided?: boolean | null,
    voided_at?: number | null,
    unit_amount_in_decimal?: string | null,
    quantity_in_decimal?: string | null,
    amount_in_decimal?: string | null,
    created_at?: number | null,
    updated_at?: number | null,
    tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    is_advance_charge?: boolean | null,
    business_entity_id?: string | null,
    deleted?: boolean | null
  }[] | null
} | null
```

***

### resume

`subscriptions.resume`

Resume a subscription. Note: This operation optionally supports 3DS verification flow. To achieve the same, create the Payment Intent and pass it as input parameter to this API. This API is used to resume a paused subscription. On resumption the subscription will be activated and any applicable charges will be initiated.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.subscriptions.resume({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `resume_option` | `immediately \| specific_date` | No | List of options to resume the subscription. \* immediately - Resume immediately \* specific\_date - Resume on a specific date |
| `resume_date` | `number` | No | Date on which the subscription will be resumed. Applicable when **resume\_option** is set as 'specific\_date'. |
| `charges_handling` | `invoice_immediately \| add_to_unbilled_charges` | No | Applicable when charges get added during this operation and **resume\_option** is set as 'immediately'. Allows to raise invoice immediately or add them to unbilled charges. \* add\_to\_unbilled\_charges - Add to unbilled charges \* invoice\_immediately - Invoice immediately |
| `unpaid_invoices_handling` | `no_action \| schedule_payment_collection` | No | Applicable when the subscription has past due invoices and **resume\_option** is set as 'immediately'. Allows to collect past due invoices or retain them as unpaid. If 'schedule\_payment\_collection' option is chosen in this field, remaining refundable credits and excess payments are applied. **Note:** The payment collection attempt will be asynchronous. \* no\_action - Retain as unpaid \* schedule\_payment\_collection - Collect payment |
| `payment_initiator` | `customer \| merchant` | No | The type of initiator to be used for the payment request triggered by this operation. \* customer - Pass this value to indicate that the request is initiated by the customer \* merchant - Pass this value to indicate that the request is initiated by the merchant |
| `payment_intent` | `object` | No | Parameters for payment\_intent |

```ts theme={null}
{
  id?: string,
  gateway_account_id?: string,
  gw_token?: string,
  payment_method_type?: card | ideal | sofort | bancontact | google_pay | dotpay | giropay | apple_pay | upi | netbanking_emandates | paypal_express_checkout | direct_debit | boleto | venmo | amazon_payments | pay_to | faster_payments | sepa_instant_transfer | klarna_pay_now | online_banking_poland | payconiq_by_bancontact | electronic_payment_standard | kbc_payment_button | pay_by_bank | trustly | stablecoin | kakao_pay | naver_pay | revolut_pay | cash_app_pay | wechat_pay | alipay | twint | go_pay | grab_pay | pay_co | after_pay | swish | payme | pix | klarna | alipay_hk | paypay | gcash | south_korean_cards | paynow | bizum | promptpay | dana | touch_n_go | tamara | qpay | ovo | momo | mercado_pago | nequi | nupay | picpay | thai_qr | blik | fpx | wero | p24 | affirm_pay | rakuten_pay,
  reference_id?: string,
  additional_information?: {
  }
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `subscription` | `object \| null` | No | A Chargebee subscription connects a customer record to products/services. It describes what the customer has signed up for and how often they're charged for it. The essential components of a subscription are: \* A [plan-item price](https://docs.corsair.dev/docs/api/item_prices). \* Any addon- and charge-item prices applied to the subscription. \* Any [coupons](https://docs.corsair.dev/docs/api/coupons) applied. \* Any [discounts](https://docs.corsair.dev/docs/api/discounts) applied. The charges in a subscription are billed via invoices. **Note:** The maximum number of subscriptions for any given [customer](https://docs.corsair.dev/docs/api/customers) ([active](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#status) or not) is 900. #### Subscription billing frequencies Chargebee offers two billing frequency options for subscriptions: \* **Plan-based billing** (`default`): Subscriptions are billed based on the billing period defined for the item price of the `item_type` `plan`. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/subscriptions#plan-based-billing). \* **Multi-frequency billing** : Subscriptions are billed according to the billing period of each recurring item price within the subscription. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing). **Important** [Limitations](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing#limitations) of Multi-frequency billing. The selection of the billing frequency preference is configured at the site level. #### Item price compatibility in a subscription When creating or updating a subscription, one of the item prices specified under subscription\_items must be a plan-item price. The remaining must be compatible addon- or charge-item prices. An item price is compatible with a plan-item price if their currencies are the same. Additionally, an addon-item price is compatible with a plan-item price only if their billing frequencies meet the following conditions: \| `period_unit` for plan-item price \| Compatible `period_unit` for addon-item price \| Compatible period for addon-item price \| \|-----------------------------------\|-----------------------------------------------\|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `day` \| `day` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `10`, then the period of the addon-item price can be `10`, `5`, `2`, or `1`. \| \| `week` \| `week` or `day` \| The `period` (in days) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the period of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `week`, `period` can be `2` or `1`. \* for `period_unit` as `day`, `period` can be `14`, `7`, `2`, or `1`. \| \| `month` \| `month` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `6`, then the `period` of the addon-item price can be `6`, `3`, `2`, or `1`. \| \| `year` \| `year` or `month` \| The `period` (in months) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the `period` of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `year`, `period` can be `2` or `1`. \* for `period_unit` as `month`, `period` can be `24`, `12`, `8`, `6`, `4`, `3`, `2`, or `1`. \| #### Tax provider fields **Avalara** : Merchants using **Avalara Sales Tax** can optionally associate each item price with a locationCode (from their Avalara company locations), so tax can be resolved correctly at the line item level. \| Field ID \| Field Value \| APIs \| \|--------------------------------------------------------------------------------\|----------------------------------------------------------------------\|--------------------------------------------------------------------------------\| \| `locationCode` \| Merchant to configure it on Avalara Platform under company locations \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| **Anrok**: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation \| Field ID \| Field Value \| APIs \| \|---------------------------------------------------------------------------------------------------------------------------------------\|---------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------\| \| `additionalTaxRegistrationNumber` \| Canadian tax registration numbers in comma separated fashion. \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| **Vertex**: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration **Note:** Field Id like `customerCode` , `customerClass` , and`taxExempted` belong to the customer object. Field Id like `productCode` , `productClass` , `productTaxCode` , and `productClass` belong to the product object. \| Field ID \| Field Value \| APIs \| \|-----------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productCode` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `customerCode` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `customerClass` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **Taxamo:** Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration \| Field Id \| Field Value \| APIs \| \|------------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productTaxCode` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `taxExempted` \| Merchant to configure it on Taxamo Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **cbtaxes**: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India. \| Field ID \| Field Value \| APIs \| \|---------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `indiaSez` \| `SEZ_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaSez` \| `SEZ_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **All**: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level \| Field ID \| Field Value \| APIs \| \|-------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `priceType` \| `TAX_INCLUSIVE` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| \| `TAX_EXCLUSIVE` \| \| \| \| `SITE_DEFAULT` or blank \| Removes price type override, and allows site level configuration to be used for tax calculation. \| #### Ramps API compatibility mode If you want to schedule changes on a subscription, use the [Ramps API](https://docs.corsair.dev/docs/api/ramps). If you are currently scheduling changes through the [Update subscription API](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items), migrate to the Ramps API. To get started, [request access for Subscription Ramps](https://app.chargebee.com/login?forward=https://app.chargebee.com/request_access/subscription-ramps\&ref=feature). Chargebee will enable Ramps compatibility mode for your site. Once enabled, you can test the Ramps API without impacting your existing integrations. The following parts of the Billing API have subtle differences in behavior when the Ramps feature is disabled versus when it is enabled with compatibility mode. (Follow the links to learn more.) \* The value of the [`subscription.has_scheduled_changes`](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#has_scheduled_changes) attribute. \* [Update subscription](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#impact-scheduled-changes) \* [Create Checkout for updating a subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription#impact-scheduled-changes) \* [Remove scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/remove-scheduled-changes) \* [Retrieve with scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/retrieve-with-scheduled-changes) \* [Create a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/create-a-quote-for-update-subscription-items) \* [Edit a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/edit-update-subscription-quote-for-items) \* [Portal sessions](https://docs.corsair.dev/docs/api/portal_sessions#scheduled-subscription-changes) |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |
| `unbilled_charges` | `object[] \| null` | No | Resource object representing unbilled\_charge |

```ts theme={null}
{
  id?: string | null,
  currency_code?: string | null,
  billing_period?: number | null,
  billing_period_unit?: string | null,
  start_date?: number | null,
  trial_end?: number | null,
  remaining_billing_cycles?: number | null,
  po_number?: string | null,
  auto_collection?: string | null,
  plan_quantity_in_decimal?: string | null,
  plan_unit_price_in_decimal?: string | null,
  customer_id?: string | null,
  status?: string | null,
  trial_start?: number | null,
  trial_end_action?: string | null,
  current_term_start?: number | null,
  current_term_end?: number | null,
  next_billing_at?: number | null,
  created_at?: number | null,
  started_at?: number | null,
  activated_at?: number | null,
  contract_term_billing_cycle_on_renewal?: number | null,
  override_relationship?: boolean | null,
  pause_date?: number | null,
  resume_date?: number | null,
  cancelled_at?: number | null,
  cancel_reason?: string | null,
  created_from_ip?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  has_scheduled_advance_invoices?: boolean | null,
  has_scheduled_changes?: boolean | null,
  payment_source_id?: string | null,
  plan_free_quantity_in_decimal?: string | null,
  plan_amount_in_decimal?: string | null,
  cancel_schedule_created_at?: number | null,
  offline_payment_method?: string | null,
  channel?: string | null,
  net_term_days?: number | null,
  active_id?: string | null,
  due_invoices_count?: number | null,
  due_since?: number | null,
  total_dues?: number | null,
  mrr?: number | null,
  exchange_rate?: number | null,
  base_currency_code?: string | null,
  invoice_notes?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  changes_scheduled_at?: number | null,
  cancel_reason_code?: string | null,
  free_period?: number | null,
  free_period_unit?: string | null,
  create_pending_invoices?: boolean | null,
  auto_close_invoices?: boolean | null,
  business_entity_id?: string | null,
  decommissioned?: boolean | null,
  brand_id?: string | null,
  subscription_items?: {
    item_price_id?: string | null,
    item_type?: string | null,
    quantity?: number | null,
    quantity_in_decimal?: string | null,
    unit_price?: number | null,
    unit_price_in_decimal?: string | null,
    amount?: number | null,
    current_term_start?: number | null,
    current_term_end?: number | null,
    next_billing_at?: number | null,
    amount_in_decimal?: string | null,
    billing_period?: number | null,
    billing_period_unit?: string | null,
    free_quantity?: number | null,
    free_quantity_in_decimal?: string | null,
    trial_end?: number | null,
    billing_cycles?: number | null,
    service_period_days?: number | null,
    charge_on_event?: string | null,
    charge_once?: boolean | null,
    charge_on_option?: string | null,
    proration_type?: string | null,
    usage_accumulation_reset_frequency?: string | null,
    description?: string | null
  }[] | null,
  item_tiers?: {
    item_price_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    price?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    price_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null,
    index?: number | null
  }[] | null,
  charged_items?: {
    item_price_id?: string | null,
    last_charged_at?: number | null
  }[] | null,
  coupons?: {
    coupon_id?: string | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_code?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_info?: {
    referral_code?: string | null,
    coupon_code?: string | null,
    referrer_id?: string | null,
    external_reference_id?: string | null,
    reward_status?: string | null,
    referral_system?: string | null,
    account_id?: string | null,
    campaign_id?: string | null,
    external_campaign_id?: string | null,
    friend_offer_type?: string | null,
    referrer_reward_type?: string | null,
    notify_referral_system?: string | null,
    destination_url?: string | null,
    post_purchase_widget_enabled?: boolean | null
  } | null,
  billing_override?: {
    max_excess_payment_usage?: number | null,
    max_refundable_credits_usage?: number | null
  } | null,
  contract_term?: {
    id?: string | null,
    status?: string | null,
    contract_start?: number | null,
    contract_end?: number | null,
    billing_cycle?: number | null,
    action_at_term_end?: string | null,
    total_contract_value?: number | null,
    total_contract_value_before_tax?: number | null,
    cancellation_cutoff_period?: number | null,
    created_at?: number | null,
    subscription_id?: string | null,
    remaining_billing_cycles?: number | null
  } | null,
  discounts?: {
    id?: string | null,
    invoice_name?: string | null,
    description?: string | null,
    type?: string | null,
    percentage?: number | null,
    amount?: number | null,
    quantity?: number | null,
    currency_code?: string | null,
    duration_type?: string | null,
    period?: number | null,
    period_unit?: string | null,
    included_in_mrr?: boolean | null,
    apply_on?: string | null,
    item_price_id?: string | null,
    created_at?: number | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_id?: string | null,
    index?: number | null
  }[] | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  email?: string | null,
  phone?: string | null,
  company?: string | null,
  vat_number?: string | null,
  auto_collection?: string | null,
  offline_payment_method?: string | null,
  net_term_days?: number | null,
  vat_number_validated_time?: number | null,
  vat_number_status?: string | null,
  allow_direct_debit?: boolean | null,
  is_location_valid?: boolean | null,
  created_at?: number | null,
  created_from_ip?: string | null,
  exemption_details?: any[] | null,
  taxability?: string | null,
  entity_code?: string | null,
  exempt_number?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  locale?: string | null,
  billing_date?: number | null,
  billing_month?: number | null,
  billing_date_mode?: string | null,
  billing_day_of_week?: string | null,
  billing_day_of_week_mode?: string | null,
  pii_cleared?: string | null,
  auto_close_invoices?: boolean | null,
  channel?: string | null,
  active_id?: string | null,
  fraud_flag?: string | null,
  primary_payment_source_id?: string | null,
  backup_payment_source_id?: string | null,
  invoice_notes?: string | null,
  business_entity_id?: string | null,
  preferred_currency_code?: string | null,
  promotional_credits?: number | null,
  unbilled_charges?: number | null,
  refundable_credits?: number | null,
  excess_payments?: number | null,
  is_einvoice_enabled?: boolean | null,
  einvoicing_method?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  registered_for_gst?: boolean | null,
  consolidated_invoicing?: boolean | null,
  customer_type?: string | null,
  business_customer_without_vat_number?: boolean | null,
  client_profile_id?: string | null,
  use_default_hierarchy_settings?: boolean | null,
  vat_number_prefix?: string | null,
  entity_identifier_scheme?: string | null,
  entity_identifier_standard?: string | null,
  brand_id?: string | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_urls?: {
    external_customer_id?: string | null,
    referral_sharing_url?: string | null,
    created_at?: number | null,
    updated_at?: number | null,
    referral_campaign_id?: string | null,
    referral_account_id?: string | null,
    referral_external_campaign_id?: string | null,
    referral_system?: string | null
  }[] | null,
  contacts?: {
    id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    phone?: string | null,
    label?: string | null,
    enabled?: boolean | null,
    send_account_email?: boolean | null,
    send_billing_email?: boolean | null
  }[] | null,
  payment_method?: {
    type?: string | null,
    gateway?: string | null,
    gateway_account_id?: string | null,
    status?: string | null,
    reference_id?: string | null
  } | null,
  balances?: {
    promotional_credits?: number | null,
    excess_payments?: number | null,
    refundable_credits?: number | null,
    unbilled_charges?: number | null,
    currency_code?: string | null,
    business_entity_id?: string | null
  }[] | null,
  entity_identifiers?: {
    id?: string | null,
    value?: string | null,
    scheme?: string | null,
    standard?: string | null
  }[] | null,
  tax_providers_fields?: {
    provider_name?: string | null,
    field_id?: string | null,
    field_value?: string | null
  }[] | null,
  relationship?: {
    parent_id?: string | null,
    payment_owner_id?: string | null,
    invoice_owner_id?: string | null
  } | null,
  parent_account_access?: {
    portal_edit_child_subscriptions?: string | null,
    portal_download_child_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null,
  child_account_access?: {
    portal_edit_subscriptions?: string | null,
    portal_download_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null
} | null
```

```ts theme={null}
{
  payment_source_id?: string | null,
  status?: string | null,
  gateway?: string | null,
  gateway_account_id?: string | null,
  ref_tx_id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  iin?: string | null,
  last4?: string | null,
  card_type?: string | null,
  funding_type?: string | null,
  expiry_month?: number | null,
  expiry_year?: number | null,
  issuing_country?: string | null,
  billing_addr1?: string | null,
  billing_addr2?: string | null,
  billing_city?: string | null,
  billing_state_code?: string | null,
  billing_state?: string | null,
  billing_country?: string | null,
  billing_zip?: string | null,
  created_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  ip_address?: string | null,
  powered_by?: string | null,
  customer_id?: string | null,
  masked_number?: string | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  payment_owner?: string | null,
  subscription_id?: string | null,
  recurring?: boolean | null,
  status?: string | null,
  date?: number | null,
  due_date?: number | null,
  net_term_days?: number | null,
  po_number?: string | null,
  vat_number?: string | null,
  price_type?: string | null,
  exchange_rate?: number | null,
  local_currency_exchange_rate?: number | null,
  currency_code?: string | null,
  local_currency_code?: string | null,
  tax?: number | null,
  sub_total?: number | null,
  sub_total_in_local_currency?: number | null,
  total?: number | null,
  total_in_local_currency?: number | null,
  amount_due?: number | null,
  amount_adjusted?: number | null,
  amount_paid?: number | null,
  paid_at?: number | null,
  write_off_amount?: number | null,
  credits_applied?: number | null,
  dunning_status?: string | null,
  next_retry_at?: number | null,
  voided_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  line_items_next_offset?: string | null,
  first_invoice?: boolean | null,
  new_sales_amount?: number | null,
  has_advance_charges?: boolean | null,
  offline_payment_method?: string | null,
  term_finalized?: boolean | null,
  is_gifted?: boolean | null,
  generated_at?: number | null,
  expected_payment_date?: number | null,
  amount_to_collect?: number | null,
  round_off_amount?: number | null,
  retry_segment_id?: string | null,
  void_reason_code?: string | null,
  deleted?: boolean | null,
  tax_category?: string | null,
  vat_number_prefix?: string | null,
  channel?: string | null,
  business_entity_id?: string | null,
  brand_id?: string | null,
  exchange_rates?: {
    currency_code?: string | null,
    rate?: number | null
  }[] | null,
  line_items?: {
    id?: string | null,
    subscription_id?: string | null,
    date_from?: number | null,
    date_to?: number | null,
    unit_amount?: number | null,
    quantity?: number | null,
    amount?: number | null,
    pricing_model?: string | null,
    is_taxed?: boolean | null,
    tax_amount?: number | null,
    tax_rate?: number | null,
    unit_amount_in_decimal?: string | null,
    quantity_in_decimal?: string | null,
    amount_in_decimal?: string | null,
    discount_amount?: number | null,
    item_level_discount_amount?: number | null,
    metered?: boolean | null,
    is_percentage_pricing?: boolean | null,
    reference_line_item_id?: string | null,
    description?: string | null,
    entity_description?: string | null,
    entity_type?: string | null,
    tax_exempt_reason?: string | null,
    entity_id?: string | null,
    customer_id?: string | null,
    proration_mode?: string | null
  }[] | null,
  line_item_tiers?: {
    line_item_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    quantity_used?: number | null,
    unit_amount?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    quantity_used_in_decimal?: string | null,
    unit_amount_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null
  }[] | null,
  line_item_discounts?: {
    line_item_id?: string | null,
    discount_type?: string | null,
    coupon_id?: string | null,
    entity_id?: string | null,
    discount_amount?: number | null
  }[] | null,
  line_item_taxes?: {
    line_item_id?: string | null,
    tax_name?: string | null,
    tax_rate?: number | null,
    date_to?: number | null,
    date_from?: number | null,
    prorated_taxable_amount?: number | null,
    is_partial_tax_applied?: boolean | null,
    is_non_compliance_tax?: boolean | null,
    taxable_amount?: number | null,
    tax_amount?: number | null,
    tax_juris_type?: string | null,
    tax_juris_name?: string | null,
    tax_juris_code?: string | null,
    tax_amount_in_local_currency?: number | null,
    local_currency_code?: string | null
  }[] | null,
  line_item_credits?: {
    cn_id?: string | null,
    applied_amount?: number | null,
    line_item_id?: string | null
  }[] | null,
  line_item_addresses?: {
    line_item_id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  }[] | null,
  discounts?: {
    amount?: number | null,
    description?: string | null,
    line_item_id?: string | null,
    entity_type?: string | null,
    discount_type?: string | null,
    entity_id?: string | null,
    coupon_set_code?: string | null
  }[] | null,
  taxes?: {
    name?: string | null,
    amount?: number | null,
    description?: string | null
  }[] | null,
  tax_origin?: {
    country?: string | null,
    registration_number?: string | null
  } | null,
  linked_taxes_withheld?: {
    id?: string | null,
    amount?: number | null,
    description?: string | null,
    date?: number | null,
    reference_number?: string | null
  }[] | null,
  linked_payments?: {
    txn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null
  }[] | null,
  reference_transactions?: {
    applied_amount?: number | null,
    applied_at?: number | null,
    txn_id?: string | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null,
    txn_type?: string | null,
    amount_capturable?: number | null,
    authorization_reason?: string | null
  }[] | null,
  dunning_attempts?: {
    attempt?: number | null,
    transaction_id?: string | null,
    dunning_type?: string | null,
    created_at?: number | null,
    txn_status?: string | null,
    txn_amount?: number | null,
    retry_engine?: string | null
  }[] | null,
  applied_credits?: {
    cn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_status?: string | null,
    tax_application?: string | null
  }[] | null,
  adjustment_credit_notes?: {
    cn_id?: string | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_total?: number | null,
    cn_status?: string | null
  }[] | null,
  issued_credit_notes?: {
    cn_id?: string | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_total?: number | null,
    cn_status?: string | null
  }[] | null,
  linked_orders?: {
    id?: string | null,
    document_number?: string | null,
    status?: string | null,
    order_type?: string | null,
    reference_id?: string | null,
    fulfillment_status?: string | null,
    batch_id?: string | null,
    created_at?: number | null
  }[] | null,
  notes?: {
    note?: string | null,
    entity_id?: string | null,
    entity_type?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  statement_descriptor?: {
    id?: string | null,
    descriptor?: string | null
  } | null,
  einvoice?: {
    id?: string | null,
    reference_id?: string | null,
    reference_number?: string | null,
    status?: string | null,
    message?: string | null,
    provider_references?: any[] | null
  } | null,
  site_details_at_creation?: {
    timezone?: string | null,
    organization_address?: {
    } | null
  } | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  subscription_id?: string | null,
  date_from?: number | null,
  date_to?: number | null,
  unit_amount?: number | null,
  pricing_model?: string | null,
  quantity?: number | null,
  amount?: number | null,
  currency_code?: string | null,
  discount_amount?: number | null,
  description?: string | null,
  entity_type?: string | null,
  entity_id?: string | null,
  is_voided?: boolean | null,
  voided_at?: number | null,
  unit_amount_in_decimal?: string | null,
  quantity_in_decimal?: string | null,
  amount_in_decimal?: string | null,
  created_at?: number | null,
  updated_at?: number | null,
  is_advance_charge?: boolean | null,
  business_entity_id?: string | null,
  deleted?: boolean | null,
  tiers?: {
    starting_unit?: number | null,
    ending_unit?: number | null,
    quantity_used?: number | null,
    unit_amount?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    quantity_used_in_decimal?: string | null,
    unit_amount_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null
  }[] | null
}[] | null
```

***

### resumeSubscriptionEstimate

`subscriptions.resumeSubscriptionEstimate`

Resume subscription estimate. Generates an estimate for the 'resume subscription' operation. This is similar to the Resume a subscription API, but the subscription will not be resumed. Only an estimate for this operation is created. In the response, \* estimate.subscription\_estimate has the subscription details.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.subscriptions.resumeSubscriptionEstimate({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `resume_option` | `immediately \| specific_date` | No | List of options to resume the subscription. \* immediately - Resume immediately \* specific\_date - Resume on a specific date |
| `charges_handling` | `invoice_immediately \| add_to_unbilled_charges` | No | Applicable when charges get added during this operation and **resume\_option** is set as 'immediately'. Allows to raise invoice immediately or add them to unbilled charges. \* add\_to\_unbilled\_charges - Add to unbilled charges \* invoice\_immediately - Invoice immediately |
| `subscription` | `object` | No | Parameters for subscription |

```ts theme={null}
{
  resume_date?: number
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `estimate` | `object \| null` | No | During the process of signing up customers to subscriptions, use the Estimates API to evaluate the details of the purchase before actually signing them up. The details returned by the API include the invoice amounts, next billing date and unbilled charges. For example, consider that you are creating a new subscription or update an existing one. Use the Estimates API before that to deduce the details such as the amount the customer would be charged, the state the subscription would be in after creation or updation, and so on. If you have configured the [Avalara integration](https://www.chargebee.com/docs/2.0/avalara.html), Chargebee retrieves the tax amount from Avalara for the invoice. This counts against your Avalara API limits. |

```ts theme={null}
{
  created_at?: number | null,
  subscription_estimate?: {
    id?: string | null,
    currency_code?: string | null,
    status?: string | null,
    trial_end_action?: string | null,
    next_billing_at?: number | null,
    pause_date?: number | null,
    resume_date?: number | null,
    shipping_address?: {
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    } | null,
    contract_term?: {
      id?: string | null,
      status?: string | null,
      contract_start?: number | null,
      contract_end?: number | null,
      billing_cycle?: number | null,
      action_at_term_end?: string | null,
      total_contract_value?: number | null,
      total_contract_value_before_tax?: number | null,
      cancellation_cutoff_period?: number | null,
      created_at?: number | null,
      subscription_id?: string | null,
      remaining_billing_cycles?: number | null
    } | null
  } | null,
  subscription_estimates?: {
    id?: string | null,
    currency_code?: string | null,
    status?: string | null,
    trial_end_action?: string | null,
    next_billing_at?: number | null,
    pause_date?: number | null,
    resume_date?: number | null,
    shipping_address?: {
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    } | null,
    contract_term?: {
      id?: string | null,
      status?: string | null,
      contract_start?: number | null,
      contract_end?: number | null,
      billing_cycle?: number | null,
      action_at_term_end?: string | null,
      total_contract_value?: number | null,
      total_contract_value_before_tax?: number | null,
      cancellation_cutoff_period?: number | null,
      created_at?: number | null,
      subscription_id?: string | null,
      remaining_billing_cycles?: number | null
    } | null
  }[] | null,
  invoice_estimate?: {
    recurring?: boolean | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    credits_applied?: number | null,
    amount_paid?: number | null,
    amount_due?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    line_item_credits?: {
      cn_id?: string | null,
      applied_amount?: number | null,
      line_item_id?: string | null
    }[] | null,
    line_item_addresses?: {
      line_item_id?: string | null,
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  } | null,
  invoice_estimates?: {
    recurring?: boolean | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    credits_applied?: number | null,
    amount_paid?: number | null,
    amount_due?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    line_item_credits?: {
      cn_id?: string | null,
      applied_amount?: number | null,
      line_item_id?: string | null
    }[] | null,
    line_item_addresses?: {
      line_item_id?: string | null,
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  }[] | null,
  payment_schedule_estimates?: {
    id?: string | null,
    scheme_id?: string | null,
    entity_type?: string | null,
    entity_id?: string | null,
    amount?: number | null,
    currency_code?: string | null,
    schedule_entries?: {
      id?: string | null,
      date?: number | null,
      amount?: number | null,
      scheduled_amount?: number | null,
      status?: string | null
    }[] | null
  }[] | null,
  next_invoice_estimate?: {
    recurring?: boolean | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    credits_applied?: number | null,
    amount_paid?: number | null,
    amount_due?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    line_item_credits?: {
      cn_id?: string | null,
      applied_amount?: number | null,
      line_item_id?: string | null
    }[] | null,
    line_item_addresses?: {
      line_item_id?: string | null,
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  } | null,
  credit_note_estimates?: {
    reference_invoice_id?: string | null,
    type?: string | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    amount_allocated?: number | null,
    amount_available?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  }[] | null,
  unbilled_charge_estimates?: {
    id?: string | null,
    customer_id?: string | null,
    subscription_id?: string | null,
    date_from?: number | null,
    date_to?: number | null,
    unit_amount?: number | null,
    pricing_model?: string | null,
    quantity?: number | null,
    amount?: number | null,
    currency_code?: string | null,
    discount_amount?: number | null,
    description?: string | null,
    entity_type?: string | null,
    entity_id?: string | null,
    is_voided?: boolean | null,
    voided_at?: number | null,
    unit_amount_in_decimal?: string | null,
    quantity_in_decimal?: string | null,
    amount_in_decimal?: string | null,
    created_at?: number | null,
    updated_at?: number | null,
    tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    is_advance_charge?: boolean | null,
    business_entity_id?: string | null,
    deleted?: boolean | null
  }[] | null
} | null
```

***

### setAvailability

`subscriptions.setAvailability`

Enable or disable subscription entitlements. Enables or disables specific subscription\_entitlements for a subscription.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.subscriptions.setAvailability({ subscriptionId: 'sub_8gsnbYfsMLds', is_enabled: true });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `is_enabled` | `boolean` | Yes | Specifies whether the `subscription_entitlements` are to be enabled or disabled. |
| `subscription_entitlements` | `object` | No | Parameters for subscription\_entitlements |

```ts theme={null}
{
  feature_id: string[]
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |

```ts theme={null}
{
  subscription_entitlement?: {
    subscription_id?: string | null,
    feature_id?: string | null,
    feature_name?: string | null,
    feature_unit?: string | null,
    feature_type?: string | null,
    value?: string | null,
    name?: string | null,
    is_overridden?: boolean | null,
    is_enabled?: boolean | null,
    expires_at?: number | null,
    components?: {
      entitlement_overrides?: {
        value?: string | null,
        name?: string | null
      } | null
    } | null
  } | null
}[] | null
```

***

### update

`subscriptions.update`

Update a subscription. Note: \* This operation optionally supports 3DS verification flow. To achieve the same, create the Payment Intent and pass it as input parameter to this API. Product Catalog 1.0 sites only.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.subscriptions.update({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `subscriptionId` | `string` | Yes | — |
| `plan_id` | `string` | No | Identifier of the plan for this subscription. |
| `plan_quantity` | `number` | No | Represents the plan quantity for this subscription. |
| `plan_unit_price` | `number` | No | Amount that will override the plan's default price. The unit depends on the [type of currency](https://docs.corsair.dev/docs/api/getting-started). If `changes_scheduled_at` is in the past and a `plan_unit_price` is not passed, then the plan's current unit price is considered even if the plan did not exist on the date as of when the change is scheduled. |
| `setup_fee` | `number` | No | Amount that will override the default setup fee. The unit depends on the [type of currency](https://docs.corsair.dev/docs/api/getting-started) . |
| `replace_addon_list` | `boolean` | No | Should be true if the existing addons should be replaced with the ones that are being passed. |
| `mandatory_addons_to_remove` | `string[]` | No | A list of IDs representing the [mandatorily attached addons](https://docs.corsair.dev/docs/api/attached_items) associated with the plan to which the subscription is being updated. These addons will be removed from the subscription during the subscription update process. |
| `plan_quantity_in_decimal` | `string` | No | The decimal representation of the quantity of the plan purchased. Can be provided for quantity-based plans and only when [multi-decimal pricing](https://docs.corsair.dev/docs/api/v2/pcv-1/currencies) is enabled. |
| `plan_unit_price_in_decimal` | `string` | No | When [price overriding](https://www.chargebee.com/docs/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](https://docs.corsair.dev/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](https://docs.corsair.dev/docs/api/getting-started) is enabled. If `changes_scheduled_at` is in the past and a `unit_price_in_decimal` 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. |
| `invoice_date` | `number` | No | 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`. . |
| `start_date` | `number` | No | The new start date of a `future` subscription. Applicable only for `future` subscriptions. |
| `trial_end` | `number` | No | The time at which the trial has ended or will end for the subscription. Set it to `0` to have no trial period. **Note** \* This is only allowed when the subscription `status` is `future`, `in_trial`, or `cancelled`. \* The value must not be earlier than `changes_scheduled_at` or `start_date`. \* 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. |
| `billing_cycles` | `number` | No | 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` | `number` | No | 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` | `number` | No | 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` | `immediate \| delayed` | No | 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. \* 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. |
| `auto_collection` | `on \| off` | No | Defines whether payments need to be collected automatically for this subscription. Overrides customer's auto-collection property. \* 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` | `no_preference \| cash \| check \| bank_transfer \| ach_credit \| sepa_credit \| boleto \| us_automated_bank_transfer \| eu_automated_bank_transfer \| uk_automated_bank_transfer \| jp_automated_bank_transfer \| mx_automated_bank_transfer \| custom` | No | The preferred offline payment method for the subscription. \* sepa\_credit - SEPA Credit \* cash - Cash \* no\_preference - No Preference \* bank\_transfer - Bank Transfer \* check - Check \* eu\_automated\_bank\_transfer - EU Automated Bank Transfer \* jp\_automated\_bank\_transfer - JP Automated Bank Transfer \* uk\_automated\_bank\_transfer - UK Automated Bank Transfer \* custom - Custom \* boleto - Boleto \* mx\_automated\_bank\_transfer - MX Automated Bank Transfer \* us\_automated\_bank\_transfer - US Automated Bank Transfer \* ach\_credit - ACH Credit |
| `po_number` | `string` | No | Purchase order number for this subscription. |
| `coupon_ids` | `string[]` | No | List of coupons to be applied to this subscription. You can provide coupon ids or [coupon codes](https://docs.corsair.dev/docs/api/coupon_codes). If `changes_scheduled_at` is in the past, then the currently available coupons can be used even if they were not available as of the date for when the change is scheduled. |
| `replace_coupon_list` | `boolean` | No | 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` | `boolean` | No | \* 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` | `boolean` | No | Set this to true if you want the update to be applied at the end of the current subscription billing cycle. |
| `force_term_reset` | `boolean` | No | 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` | `boolean` | No | When the `status` of the subscription is `cancelled` , this parameter determines whether the subscription is reactivated upon making this API request. Unless passed explicitly as `false` , this parameter is implied as `true` when you provide `plan_id` or `addons[id]` |
| `token_id` | `string` | No | The Chargebee payment token generated by [Chargebee.js](https://www.chargebee.com/docs/payments/2.0/card-components-and-helpers/3ds-helper#using-the-gateways-hosted-fields). **Note** : The payment token created via Chargebee.js uses the gateway selected through [Smart Routing](https://www.chargebee.com/docs/payments/1.0/payment-gateways-and-configuration/gateway_settings#smart-routing). Explicitly passing a `gateway_id` in this API call will not override the gateway associated with the token. |
| `invoice_notes` | `string` | No | A customer-facing note added to all invoices associated with this subscription. This note is one among [all the notes](https://docs.corsair.dev/docs/api/invoices/invoice-object#notes) displayed on the invoice PDF. |
| `meta_data` | `object` | No | A collection of key-value pairs that provides extra information about the subscription. **Note:** There's a character limit of 65,535. [Learn more](https://docs.corsair.dev/docs/api/v2/pcv-1/advanced-features) . |
| `invoice_immediately` | `boolean` | No | 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. . |
| `override_relationship` | `boolean` | No | If `true` , ignores the [hierarchy relationship](https://docs.corsair.dev/docs/api/customers/customer-object#relationship) and uses customer as payment and invoice owner. |
| `changes_scheduled_at` | `number` | No | 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.. **Note:** The `changes_scheduled_at` parameter does not apply to `auto_collection` , `shipping_address` , and `po_number` ; these parameters take effect **immediately** when scheduling a subscription update. |
| `change_option` | `immediately \| end_of_term \| specific_date` | No | When the quote is converted, this attribute determines the date/time as of when the subscription change is to be carried out. **Constraints** \* When `change_option` is `end_of_term` or `specific_date`, you cannot reduce `quantity` (or `quantity_in_decimal`) and change `unit_price` (or `unit_price_in_decimal`) for the same per-unit addon in one request. Split the changes into separate API calls. If both are included in one scheduled update, Chargebee returns an `invalid_request` error when the scheduled change is applied. \* 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` . \* immediately - The change is carried out immediately. |
| `contract_term_billing_cycle_on_renewal` | `number` | No | 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) . |
| `free_period` | `number` | No | 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` | `day \| week \| month \| year` | No | 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](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/create-a-plan#period_unit) attribute of the [plan](https://docs.corsair.dev/docs/api/v2/pcv-1/subscriptions/create-a-subscription#plan_id) chosen. \* week - Charge based on week(s) \* month - Charge based on month(s) \* day - Charge based on day(s) \* year - Charge based on year(s) |
| `trial_end_action` | `site_default \| plan_default \| activate_subscription \| cancel_subscription` | No | 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. \* activate\_subscription - The subscription activates and charges are raised for non-metered items. \* cancel\_subscription - The subscription cancels. \* 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. \* 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. |
| `card` | `object` | No | Parameters for card |
| `payment_method` | `object` | No | Parameters for payment\_method |
| `payment_intent` | `object` | No | Parameters for payment\_intent |
| `billing_address` | `object` | No | Parameters for billing\_address |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `statement_descriptor` | `object` | No | Parameters for statement\_descriptor |
| `customer` | `object` | No | Parameters for customer |
| `contract_term` | `object` | No | Parameters for contract\_term |
| `addons` | `object` | No | Parameters for addons |
| `event_based_addons` | `object` | No | Parameters for event\_based\_addons |

```ts theme={null}
{
}
```

```ts theme={null}
{
  gateway_account_id?: string,
  first_name?: string,
  last_name?: string,
  number?: string,
  expiry_month?: number,
  expiry_year?: number,
  cvv?: string,
  preferred_scheme?: cartes_bancaires | mastercard | visa | dankort,
  billing_addr1?: string,
  billing_addr2?: string,
  billing_city?: string,
  billing_state_code?: string,
  billing_state?: string,
  billing_zip?: string,
  billing_country?: string,
  additional_information?: {
  }
}
```

```ts theme={null}
{
  type?: card | paypal_express_checkout | amazon_payments | direct_debit | generic | alipay | unionpay | apple_pay | wechat_pay | ideal | google_pay | sofort | bancontact | giropay | dotpay | upi | netbanking_emandates | venmo | pay_to | faster_payments | sepa_instant_transfer | automated_bank_transfer | klarna_pay_now | online_banking_poland | payconiq_by_bancontact | electronic_payment_standard | kbc_payment_button | pay_by_bank | trustly | stablecoin | kakao_pay | naver_pay | revolut_pay | cash_app_pay | twint | go_pay | grab_pay | pay_co | after_pay | swish | payme | pix | klarna | alipay_hk | paypay | gcash | south_korean_cards | paynow | bizum | promptpay | dana | touch_n_go | tamara | qpay | ovo | momo | mercado_pago | nequi | nupay | picpay | thai_qr | blik | fpx | wero | p24 | affirm_pay | rakuten_pay,
  gateway_account_id?: string,
  reference_id?: string,
  tmp_token?: string,
  issuing_country?: string,
  additional_information?: {
  }
}
```

```ts theme={null}
{
  id?: string,
  gateway_account_id?: string,
  gw_token?: string,
  payment_method_type?: card | ideal | sofort | bancontact | google_pay | dotpay | giropay | apple_pay | upi | netbanking_emandates | paypal_express_checkout | direct_debit | boleto | venmo | amazon_payments | pay_to | faster_payments | sepa_instant_transfer | klarna_pay_now | online_banking_poland | payconiq_by_bancontact | electronic_payment_standard | kbc_payment_button | pay_by_bank | trustly | stablecoin | kakao_pay | naver_pay | revolut_pay | cash_app_pay | wechat_pay | alipay | twint | go_pay | grab_pay | pay_co | after_pay | swish | payme | pix | klarna | alipay_hk | paypay | gcash | south_korean_cards | paynow | bizum | promptpay | dana | touch_n_go | tamara | qpay | ovo | momo | mercado_pago | nequi | nupay | picpay | thai_qr | blik | fpx | wero | p24 | affirm_pay | rakuten_pay,
  reference_id?: string,
  additional_information?: {
  }
}
```

```ts theme={null}
{
  first_name?: string,
  last_name?: string,
  email?: string,
  company?: string,
  phone?: string,
  line1?: string,
  line2?: string,
  line3?: string,
  city?: string,
  state_code?: string,
  state?: string,
  zip?: string,
  country?: string,
  validation_status?: not_validated | valid | partially_valid | invalid
}
```

```ts theme={null}
{
  first_name?: string,
  last_name?: string,
  email?: string,
  company?: string,
  phone?: string,
  line1?: string,
  line2?: string,
  line3?: string,
  city?: string,
  state_code?: string,
  state?: string,
  zip?: string,
  country?: string,
  validation_status?: not_validated | valid | partially_valid | invalid
}
```

```ts theme={null}
{
  descriptor?: string
}
```

```ts theme={null}
{
  vat_number?: string,
  vat_number_prefix?: string,
  entity_identifier_scheme?: string,
  is_einvoice_enabled?: boolean,
  einvoicing_method?: automatic | manual | site_default,
  entity_identifier_standard?: string,
  business_customer_without_vat_number?: boolean,
  registered_for_gst?: boolean
}
```

```ts theme={null}
{
  action_at_term_end?: renew | evergreen | cancel | renew_once,
  cancellation_cutoff_period?: number
}
```

```ts theme={null}
{
  id?: string[],
  quantity?: number[],
  unit_price?: number[],
  billing_cycles?: number[],
  quantity_in_decimal?: string[],
  unit_price_in_decimal?: string[],
  trial_end?: number[],
  proration_type?: (full_term | partial_term | none)[]
}
```

```ts theme={null}
{
  id?: string[],
  quantity?: number[],
  unit_price?: number[],
  service_period_in_days?: number[],
  charge_on?: (immediately | on_event)[],
  on_event?: (subscription_creation | subscription_trial_start | plan_activation | subscription_activation | contract_termination)[],
  charge_once?: boolean[],
  quantity_in_decimal?: string[],
  unit_price_in_decimal?: string[]
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `subscription` | `object \| null` | No | Subscription represents the recurring items a customer has subscribed to. The recurring items can be - plan, addons. It may also contain the discount items like coupons. Subscriptions are invoiced at the start of every term based on the recurring items and charged immediately against the customer's credit card if 'auto\_collection' is turned 'on', otherwise the resulting invoice will be created as 'Payment Due'. **Note:** The maximum number of subscriptions for any given [customer](https://docs.corsair.dev/docs/api/customers) ([active](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#status) or not) is 900. Tax provider fields **Avalara** : Merchants using **Avalara Sales Tax** can optionally associate each item price with a locationCode (from their Avalara company locations), so tax can be resolved correctly at the line item level. \| Field ID \| Field Value \| APIs \| \|--------------------------------------------------------------------------------\|----------------------------------------------------------------------\|--------------------------------------------------------------------------------\| \| `locationCode` \| Merchant to configure it on Avalara Platform under company locations \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| **Anrok**: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation \| Field ID \| Field Value \| APIs \| \|---------------------------------------------------------------------------------------------------------------------------------------\|---------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------\| \| `additionalTaxRegistrationNumber` \| Canadian tax registration numbers in comma separated fashion. \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| **Vertex**: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration **Note:** Field Id like `customerCode` , `customerClass` , and`taxExempted` belong to the customer object. Field Id like `productCode` , `productClass` , `productTaxCode` , and `productClass` belong to the product object. \| Field ID \| Field Value \| APIs \| \|-----------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productCode` \| Merchant to configure it on Vertex Platform \| APIs having [Plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object)(PC1), [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object)(PC1) and [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object)(PC2) attributes. \| \| `productClass` \| Merchant to configure it on Vertex Platform \| APIs having [Plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object)(PC1), [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object)(PC1) and [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object)(PC2) attributes. \| \| `customerCode` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `customerClass` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **Taxamo:** Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration \| Field Id \| Field Value \| APIs \| \|------------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productTaxCode` \| Merchant to configure it on Taxamo Platform \| APIs having [Plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object)(PC1), [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object)(PC1) and Item Prices (PC2) attributes. \| \| `productClass` \| Merchant to configure it on Taxamo Platform \| APIs having [Plan](https://docs.corsair.dev/docs/api/v2/pcv-1/plans/plan-object)(PC1), [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons/addon-object)(PC1) and Item Prices (PC2) attributes. \| \| `taxExempted` \| Merchant to configure it on Taxamo Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **cbtaxes**: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India. \| Field ID \| Field Value \| APIs \| \|---------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `indiaSez` \| `SEZ_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaSez` \| `SEZ_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **All**: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level \| Field ID \| Field Value \| APIs \| \|-------------\|-----------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `priceType` \| `TAX_INCLUSIVE` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| \| `TAX_EXCLUSIVE` \| \| \| \| `SITE_DEFAULT` \| Removes price type override, and allows site level configuration to be used for tax calculation. \| **Note:** Make sure you choose the correct **Field ID** and **Available APIs** combination from the table above. All Product Catalog APIs include [Plans](https://docs.corsair.dev/docs/api/v2/pcv-1/plans) , [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons) , [Coupons](https://docs.corsair.dev/docs/api/v2/pcv-1/coupons) , [Coupon Sets](https://docs.corsair.dev/docs/api/v2/pcv-1/coupon_sets) , [Coupon Codes](https://docs.corsair.dev/docs/api/v2/pcv-1/coupon_codes) . |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/v2/pcv-1/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/v2/pcv-1/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any custom attributes you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/1.0/sites-intro.html)\\*\\* created before March 1, 2014\\*\\*: [updating the card](https://docs.corsair.dev/docs/api/v2/pcv-1/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/v2/pcv-1/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |
| `invoice` | `object \| null` | No | Invoices are statements containing charges, adjustments and any discounts for a subscription specific to a term. For every subscription a draft invoice (upcoming invoice) is used to track all the charges, credits and adjustments for the current term. Generally, an invoice is closed at start of the next term. However, cancellation and other such operations on subscription may trigger premature closing. While closing the invoice, in addition to recurring charges, credits and coupons are applied to calculate the final amount that is due. When invoice is closed, an attempt to charge the credit card is made. If the payment succeeds, it is marked as **paid** . If the payment fails, the invoice is marked as **payment\_due** and retry settings are taken into account. If no retry attempts are configured, the invoice is marked as **not\_paid** . If the amount due is zero or negative, the invoice is immediately marked as **paid** and the balance if any is carried forward to the next term of the invoice. **Note:** If *consolidated invoicing* is enabled, the attribute *invoice.subscription\_id* should **not** be used (as it will not be present if the invoice has lines from multiple subscriptions). Instead to know the related subscriptions, their [line\_items](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) *subscription\_id* attribute should be referred. |
| `unbilled_charges` | `object[] \| null` | No | Resource object representing unbilled\_charge |
| `credit_notes` | `object[] \| null` | No | Resource object representing credit\_note |

```ts theme={null}
{
  id?: string | null,
  currency_code?: string | null,
  plan_id?: string | null,
  plan_quantity?: number | null,
  plan_unit_price?: number | null,
  setup_fee?: number | null,
  billing_period?: number | null,
  billing_period_unit?: string | null,
  start_date?: number | null,
  trial_end?: number | null,
  remaining_billing_cycles?: number | null,
  po_number?: string | null,
  auto_collection?: string | null,
  plan_quantity_in_decimal?: string | null,
  plan_unit_price_in_decimal?: string | null,
  customer_id?: string | null,
  plan_amount?: number | null,
  plan_free_quantity?: number | null,
  status?: string | null,
  trial_start?: number | null,
  trial_end_action?: string | null,
  current_term_start?: number | null,
  current_term_end?: number | null,
  next_billing_at?: number | null,
  created_at?: number | null,
  started_at?: number | null,
  activated_at?: number | null,
  gift_id?: string | null,
  contract_term_billing_cycle_on_renewal?: number | null,
  override_relationship?: boolean | null,
  pause_date?: number | null,
  resume_date?: number | null,
  cancelled_at?: number | null,
  cancel_reason?: string | null,
  affiliate_token?: string | null,
  created_from_ip?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  has_scheduled_advance_invoices?: boolean | null,
  has_scheduled_changes?: boolean | null,
  payment_source_id?: string | null,
  plan_free_quantity_in_decimal?: string | null,
  plan_amount_in_decimal?: string | null,
  cancel_schedule_created_at?: number | null,
  offline_payment_method?: string | null,
  channel?: string | null,
  active_id?: string | null,
  due_invoices_count?: number | null,
  due_since?: number | null,
  total_dues?: number | null,
  mrr?: number | null,
  exchange_rate?: number | null,
  base_currency_code?: string | null,
  invoice_notes?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  changes_scheduled_at?: number | null,
  cancel_reason_code?: string | null,
  free_period?: number | null,
  free_period_unit?: string | null,
  create_pending_invoices?: boolean | null,
  auto_close_invoices?: boolean | null,
  business_entity_id?: string | null,
  decommissioned?: boolean | null,
  brand_id?: string | null,
  addons?: {
    id?: string | null,
    quantity?: number | null,
    unit_price?: number | null,
    amount?: number | null,
    trial_end?: number | null,
    remaining_billing_cycles?: number | null,
    quantity_in_decimal?: string | null,
    unit_price_in_decimal?: string | null,
    amount_in_decimal?: string | null,
    proration_type?: string | null
  }[] | null,
  event_based_addons?: {
    id?: string | null,
    quantity?: number | null,
    unit_price?: number | null,
    on_event?: string | null,
    charge_once?: boolean | null,
    quantity_in_decimal?: string | null,
    unit_price_in_decimal?: string | null
  }[] | null,
  charged_event_based_addons?: {
    id?: string | null,
    last_charged_at?: number | null
  }[] | null,
  coupons?: {
    coupon_id?: string | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_code?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_info?: {
    referral_code?: string | null,
    coupon_code?: string | null,
    referrer_id?: string | null,
    external_reference_id?: string | null,
    reward_status?: string | null,
    referral_system?: string | null,
    account_id?: string | null,
    campaign_id?: string | null,
    external_campaign_id?: string | null,
    friend_offer_type?: string | null,
    referrer_reward_type?: string | null,
    notify_referral_system?: string | null,
    destination_url?: string | null,
    post_purchase_widget_enabled?: boolean | null
  } | null,
  contract_term?: {
    id?: string | null,
    status?: string | null,
    contract_start?: number | null,
    contract_end?: number | null,
    billing_cycle?: number | null,
    action_at_term_end?: string | null,
    total_contract_value?: number | null,
    total_contract_value_before_tax?: number | null,
    cancellation_cutoff_period?: number | null,
    created_at?: number | null,
    subscription_id?: string | null,
    remaining_billing_cycles?: number | null
  } | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  email?: string | null,
  phone?: string | null,
  company?: string | null,
  vat_number?: string | null,
  auto_collection?: string | null,
  offline_payment_method?: string | null,
  net_term_days?: number | null,
  vat_number_validated_time?: number | null,
  vat_number_status?: string | null,
  allow_direct_debit?: boolean | null,
  is_location_valid?: boolean | null,
  created_at?: number | null,
  created_from_ip?: string | null,
  exemption_details?: any[] | null,
  taxability?: string | null,
  entity_code?: string | null,
  exempt_number?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  locale?: string | null,
  billing_date?: number | null,
  billing_month?: number | null,
  billing_date_mode?: string | null,
  billing_day_of_week?: string | null,
  billing_day_of_week_mode?: string | null,
  pii_cleared?: string | null,
  auto_close_invoices?: boolean | null,
  channel?: string | null,
  active_id?: string | null,
  fraud_flag?: string | null,
  primary_payment_source_id?: string | null,
  backup_payment_source_id?: string | null,
  invoice_notes?: string | null,
  business_entity_id?: string | null,
  preferred_currency_code?: string | null,
  promotional_credits?: number | null,
  unbilled_charges?: number | null,
  refundable_credits?: number | null,
  excess_payments?: number | null,
  is_einvoice_enabled?: boolean | null,
  einvoicing_method?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  registered_for_gst?: boolean | null,
  consolidated_invoicing?: boolean | null,
  customer_type?: string | null,
  business_customer_without_vat_number?: boolean | null,
  client_profile_id?: string | null,
  use_default_hierarchy_settings?: boolean | null,
  vat_number_prefix?: string | null,
  entity_identifier_scheme?: string | null,
  entity_identifier_standard?: string | null,
  brand_id?: string | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_urls?: {
    external_customer_id?: string | null,
    referral_sharing_url?: string | null,
    created_at?: number | null,
    updated_at?: number | null,
    referral_campaign_id?: string | null,
    referral_account_id?: string | null,
    referral_external_campaign_id?: string | null,
    referral_system?: string | null
  }[] | null,
  contacts?: {
    id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    phone?: string | null,
    label?: string | null,
    enabled?: boolean | null,
    send_account_email?: boolean | null,
    send_billing_email?: boolean | null
  }[] | null,
  payment_method?: {
    type?: string | null,
    gateway?: string | null,
    gateway_account_id?: string | null,
    status?: string | null,
    reference_id?: string | null
  } | null,
  balances?: {
    promotional_credits?: number | null,
    excess_payments?: number | null,
    refundable_credits?: number | null,
    unbilled_charges?: number | null,
    currency_code?: string | null,
    business_entity_id?: string | null
  }[] | null,
  entity_identifiers?: {
    id?: string | null,
    value?: string | null,
    scheme?: string | null,
    standard?: string | null
  }[] | null,
  tax_providers_fields?: {
    provider_name?: string | null,
    field_id?: string | null,
    field_value?: string | null
  }[] | null,
  relationship?: {
    parent_id?: string | null,
    payment_owner_id?: string | null,
    invoice_owner_id?: string | null
  } | null,
  parent_account_access?: {
    portal_edit_child_subscriptions?: string | null,
    portal_download_child_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null,
  child_account_access?: {
    portal_edit_subscriptions?: string | null,
    portal_download_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null
} | null
```

```ts theme={null}
{
  payment_source_id?: string | null,
  status?: string | null,
  gateway?: string | null,
  gateway_account_id?: string | null,
  ref_tx_id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  iin?: string | null,
  last4?: string | null,
  card_type?: string | null,
  funding_type?: string | null,
  expiry_month?: number | null,
  expiry_year?: number | null,
  issuing_country?: string | null,
  billing_addr1?: string | null,
  billing_addr2?: string | null,
  billing_city?: string | null,
  billing_state_code?: string | null,
  billing_state?: string | null,
  billing_country?: string | null,
  billing_zip?: string | null,
  created_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  ip_address?: string | null,
  powered_by?: string | null,
  customer_id?: string | null,
  masked_number?: string | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  payment_owner?: string | null,
  subscription_id?: string | null,
  recurring?: boolean | null,
  status?: string | null,
  date?: number | null,
  due_date?: number | null,
  net_term_days?: number | null,
  po_number?: string | null,
  vat_number?: string | null,
  price_type?: string | null,
  exchange_rate?: number | null,
  local_currency_exchange_rate?: number | null,
  currency_code?: string | null,
  local_currency_code?: string | null,
  tax?: number | null,
  sub_total?: number | null,
  sub_total_in_local_currency?: number | null,
  total?: number | null,
  total_in_local_currency?: number | null,
  amount_due?: number | null,
  amount_adjusted?: number | null,
  amount_paid?: number | null,
  paid_at?: number | null,
  write_off_amount?: number | null,
  credits_applied?: number | null,
  dunning_status?: string | null,
  next_retry_at?: number | null,
  voided_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  line_items_next_offset?: string | null,
  first_invoice?: boolean | null,
  new_sales_amount?: number | null,
  has_advance_charges?: boolean | null,
  offline_payment_method?: string | null,
  term_finalized?: boolean | null,
  is_gifted?: boolean | null,
  generated_at?: number | null,
  expected_payment_date?: number | null,
  amount_to_collect?: number | null,
  round_off_amount?: number | null,
  retry_segment_id?: string | null,
  void_reason_code?: string | null,
  deleted?: boolean | null,
  tax_category?: string | null,
  vat_number_prefix?: string | null,
  channel?: string | null,
  business_entity_id?: string | null,
  brand_id?: string | null,
  exchange_rates?: {
    currency_code?: string | null,
    rate?: number | null
  }[] | null,
  line_items?: {
    id?: string | null,
    subscription_id?: string | null,
    date_from?: number | null,
    date_to?: number | null,
    unit_amount?: number | null,
    quantity?: number | null,
    amount?: number | null,
    pricing_model?: string | null,
    is_taxed?: boolean | null,
    tax_amount?: number | null,
    tax_rate?: number | null,
    unit_amount_in_decimal?: string | null,
    quantity_in_decimal?: string | null,
    amount_in_decimal?: string | null,
    discount_amount?: number | null,
    item_level_discount_amount?: number | null,
    metered?: boolean | null,
    is_percentage_pricing?: boolean | null,
    reference_line_item_id?: string | null,
    description?: string | null,
    entity_description?: string | null,
    entity_type?: string | null,
    tax_exempt_reason?: string | null,
    entity_id?: string | null,
    customer_id?: string | null,
    proration_mode?: string | null
  }[] | null,
  line_item_tiers?: {
    line_item_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    quantity_used?: number | null,
    unit_amount?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    quantity_used_in_decimal?: string | null,
    unit_amount_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null
  }[] | null,
  line_item_discounts?: {
    line_item_id?: string | null,
    discount_type?: string | null,
    coupon_id?: string | null,
    entity_id?: string | null,
    discount_amount?: number | null
  }[] | null,
  line_item_taxes?: {
    line_item_id?: string | null,
    tax_name?: string | null,
    tax_rate?: number | null,
    date_to?: number | null,
    date_from?: number | null,
    prorated_taxable_amount?: number | null,
    is_partial_tax_applied?: boolean | null,
    is_non_compliance_tax?: boolean | null,
    taxable_amount?: number | null,
    tax_amount?: number | null,
    tax_juris_type?: string | null,
    tax_juris_name?: string | null,
    tax_juris_code?: string | null,
    tax_amount_in_local_currency?: number | null,
    local_currency_code?: string | null
  }[] | null,
  line_item_credits?: {
    cn_id?: string | null,
    applied_amount?: number | null,
    line_item_id?: string | null
  }[] | null,
  line_item_addresses?: {
    line_item_id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  }[] | null,
  discounts?: {
    amount?: number | null,
    description?: string | null,
    line_item_id?: string | null,
    entity_type?: string | null,
    discount_type?: string | null,
    entity_id?: string | null,
    coupon_set_code?: string | null
  }[] | null,
  taxes?: {
    name?: string | null,
    amount?: number | null,
    description?: string | null
  }[] | null,
  tax_origin?: {
    country?: string | null,
    registration_number?: string | null
  } | null,
  linked_taxes_withheld?: {
    id?: string | null,
    amount?: number | null,
    description?: string | null,
    date?: number | null,
    reference_number?: string | null
  }[] | null,
  linked_payments?: {
    txn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null
  }[] | null,
  reference_transactions?: {
    applied_amount?: number | null,
    applied_at?: number | null,
    txn_id?: string | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null,
    txn_type?: string | null,
    amount_capturable?: number | null,
    authorization_reason?: string | null
  }[] | null,
  dunning_attempts?: {
    attempt?: number | null,
    transaction_id?: string | null,
    dunning_type?: string | null,
    created_at?: number | null,
    txn_status?: string | null,
    txn_amount?: number | null,
    retry_engine?: string | null
  }[] | null,
  applied_credits?: {
    cn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_status?: string | null,
    tax_application?: string | null
  }[] | null,
  adjustment_credit_notes?: {
    cn_id?: string | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_total?: number | null,
    cn_status?: string | null
  }[] | null,
  issued_credit_notes?: {
    cn_id?: string | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_total?: number | null,
    cn_status?: string | null
  }[] | null,
  linked_orders?: {
    id?: string | null,
    document_number?: string | null,
    status?: string | null,
    order_type?: string | null,
    reference_id?: string | null,
    fulfillment_status?: string | null,
    batch_id?: string | null,
    created_at?: number | null
  }[] | null,
  notes?: {
    note?: string | null,
    entity_id?: string | null,
    entity_type?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  statement_descriptor?: {
    id?: string | null,
    descriptor?: string | null
  } | null,
  einvoice?: {
    id?: string | null,
    reference_id?: string | null,
    reference_number?: string | null,
    status?: string | null,
    message?: string | null,
    provider_references?: any[] | null
  } | null,
  site_details_at_creation?: {
    timezone?: string | null,
    organization_address?: {
    } | null
  } | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  subscription_id?: string | null,
  date_from?: number | null,
  date_to?: number | null,
  unit_amount?: number | null,
  pricing_model?: string | null,
  quantity?: number | null,
  amount?: number | null,
  currency_code?: string | null,
  discount_amount?: number | null,
  description?: string | null,
  entity_type?: string | null,
  entity_id?: string | null,
  is_voided?: boolean | null,
  voided_at?: number | null,
  unit_amount_in_decimal?: string | null,
  quantity_in_decimal?: string | null,
  amount_in_decimal?: string | null,
  created_at?: number | null,
  updated_at?: number | null,
  is_advance_charge?: boolean | null,
  business_entity_id?: string | null,
  deleted?: boolean | null,
  tiers?: {
    starting_unit?: number | null,
    ending_unit?: number | null,
    quantity_used?: number | null,
    unit_amount?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    quantity_used_in_decimal?: string | null,
    unit_amount_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null
  }[] | null
}[] | null
```

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  subscription_id?: string | null,
  reference_invoice_id?: string | null,
  type?: string | null,
  reason_code?: string | null,
  status?: string | null,
  vat_number?: string | null,
  date?: number | null,
  price_type?: string | null,
  currency_code?: string | null,
  total?: number | null,
  amount_allocated?: number | null,
  amount_refunded?: number | null,
  amount_available?: number | null,
  refunded_at?: number | null,
  voided_at?: number | null,
  generated_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  channel?: string | null,
  line_items_next_offset?: string | null,
  sub_total?: number | null,
  sub_total_in_local_currency?: number | null,
  total_in_local_currency?: number | null,
  local_currency_code?: string | null,
  round_off_amount?: number | null,
  fractional_correction?: number | null,
  notes?: string[] | null,
  deleted?: boolean | null,
  tax_category?: string | null,
  local_currency_exchange_rate?: number | null,
  create_reason_code?: string | null,
  vat_number_prefix?: string | null,
  business_entity_id?: string | null,
  brand_id?: string | null,
  line_items?: {
    id?: string | null,
    subscription_id?: string | null,
    date_from?: number | null,
    date_to?: number | null,
    unit_amount?: number | null,
    quantity?: number | null,
    amount?: number | null,
    pricing_model?: string | null,
    is_taxed?: boolean | null,
    tax_amount?: number | null,
    tax_rate?: number | null,
    unit_amount_in_decimal?: string | null,
    quantity_in_decimal?: string | null,
    amount_in_decimal?: string | null,
    discount_amount?: number | null,
    item_level_discount_amount?: number | null,
    metered?: boolean | null,
    is_percentage_pricing?: boolean | null,
    reference_line_item_id?: string | null,
    description?: string | null,
    entity_description?: string | null,
    entity_type?: string | null,
    tax_exempt_reason?: string | null,
    entity_id?: string | null,
    customer_id?: string | null,
    proration_mode?: string | null
  }[] | null,
  line_item_tiers?: {
    line_item_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    quantity_used?: number | null,
    unit_amount?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    quantity_used_in_decimal?: string | null,
    unit_amount_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null
  }[] | null,
  line_item_discounts?: {
    line_item_id?: string | null,
    discount_type?: string | null,
    coupon_id?: string | null,
    entity_id?: string | null,
    discount_amount?: number | null
  }[] | null,
  line_item_taxes?: {
    line_item_id?: string | null,
    tax_name?: string | null,
    tax_rate?: number | null,
    date_to?: number | null,
    date_from?: number | null,
    prorated_taxable_amount?: number | null,
    is_partial_tax_applied?: boolean | null,
    is_non_compliance_tax?: boolean | null,
    taxable_amount?: number | null,
    tax_amount?: number | null,
    tax_juris_type?: string | null,
    tax_juris_name?: string | null,
    tax_juris_code?: string | null,
    tax_amount_in_local_currency?: number | null,
    local_currency_code?: string | null
  }[] | null,
  line_item_addresses?: {
    line_item_id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  }[] | null,
  discounts?: {
    amount?: number | null,
    description?: string | null,
    line_item_id?: string | null,
    entity_type?: string | null,
    discount_type?: string | null,
    entity_id?: string | null,
    coupon_set_code?: string | null
  }[] | null,
  taxes?: {
    name?: string | null,
    amount?: number | null,
    description?: string | null
  }[] | null,
  tax_origin?: {
    country?: string | null,
    registration_number?: string | null
  } | null,
  linked_refunds?: {
    txn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null,
    refund_reason_code?: string | null
  }[] | null,
  linked_tax_withheld_refunds?: {
    id?: string | null,
    amount?: number | null,
    description?: string | null,
    date?: number | null,
    reference_number?: string | null
  }[] | null,
  allocations?: {
    invoice_id?: string | null,
    allocated_amount?: number | null,
    allocated_at?: number | null,
    invoice_date?: number | null,
    invoice_status?: string | null,
    tax_application?: string | null
  }[] | null,
  exchange_rates?: {
    currency_code?: string | null,
    rate?: number | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  einvoice?: {
    id?: string | null,
    reference_id?: string | null,
    reference_number?: string | null,
    status?: string | null,
    message?: string | null,
    provider_references?: any[] | null
  } | null,
  site_details_at_creation?: {
    timezone?: string | null,
    organization_address?: {
    } | null
  } | null
}[] | null
```

***

### updateForItems

`subscriptions.updateForItems`

Update a subscription. Updates a subscription by modifying its item prices, coupons, billing configuration, payment method, and other attributes. Any parameters not provided remain unchanged. The changes can be applied immediately, scheduled for a future date, or even backdated to a past date.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.subscriptions.updateForItems({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `mandatory_items_to_remove` | `string[]` | No | A list of item IDs representing the [mandatorily attached addons](https://docs.corsair.dev/docs/api/attached_items) associated with the plan to which the subscription is being updated. These addons will be removed from the subscription during the subscription update process. |
| `replace_items_list` | `boolean` | No | Determines whether the provided `subscription_items` replace existing subscription items or are added to the existing list. **When `subscription_items` includes a plan** \* `true`: The entire subscription item list (plan and addons) is replaced by the provided list. \* `false`: The provided items are added to the existing list. If multi-plan subscriptions is disabled, the existing plan item price is replaced. If multi-plan subscriptions is enabled, the existing plan item price is retained. **When `subscription_items` contains only addons** \* The existing plan on the subscription is always retained; it is not replaced. \* `true`: Existing addons are replaced by the provided addons, except mandatory addons (auto-attached to the plan). Mandatory addons are kept unless you list them in `mandatory_items_to_remove`. The subscription will have the current plan, the addons you passed, plus any existing mandatory addons not in `mandatory_items_to_remove`. \* `false`: The provided addons are added to the existing addons. |
| `net_term_days` | `number` | No | Updates [Net D](https://www.chargebee.com/docs/net_d.html) for the subscription. Net D is the number of days from [`invoice.date`](https://docs.corsair.dev/docs/api/invoices/invoice-object#date) until payment for the invoice is due. **Constraints** \* The value must match one of the options defined in your [site configuration](https://www.chargebee.com/docs/net_d.html#enable-net-d-for-chargebee-invoices). \* To reset this attribute, set the value to `-1`. When reset, it is not returned by the API, and the `net_term_days` value set at the [customer level](https://docs.corsair.dev/docs/api/customers/customer-object#net_term_days) is used instead. |
| `invoice_date` | `number` | No | The document date displayed on the invoice PDF. Use this parameter to backdate the invoice for reasons such as booking revenue for a previous date or when the subscription is effective as of a past date. **Prerequisites** \* `invoice_immediately` must be `true`. **Default value** \* The current date is used when not provided. **Constraints** \* Must be a date-timein the past. \* Must not be more than one calendar month into the past. For example, if today is 13th January, you cannot pass a value that is earlier than 13th December. \* It must not be earlier than `changes_scheduled_at`, `reactivate_from`, or `trial_end`. **Impacts** \* [`taxes[]`](https://docs.corsair.dev/docs/api/invoices#taxes) and [`line_item_taxes[]`](https://docs.corsair.dev/docs/api/invoices#line_item_taxes) are computed based on the tax configuration as of `invoice_date`. \* If `create_pending_invoices` is set to `true`, and if the site is [configured](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) to set invoice dates to date of closing, then upon invoice closure, this date is changed to the invoice closing date. |
| `start_date` | `number` | No | The new start date of a `future` subscription. **Prerequisites** \* The subscription `status` must be `future`. |
| `trial_end` | `number` | No | The time at which the trial has ended or will end for the subscription. Set to `0` to have no trial period. **Constraints** \* This is only allowed when the subscription `status` is `future`, `in_trial`, or `cancelled`. \* The value must not be earlier than `changes_scheduled_at` or `start_date`. \* 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. **Impact** \* When `trial_end` is backdated, the subscription immediately goes into `active` or `non_renewing` status. |
| `billing_cycles` | `number` | No | The number of billing cycles the subscription runs before canceling automatically. **Default value** \* The value set for the [plan-item price](https://docs.corsair.dev/docs/api/item_prices#billing_cycles) is used when not provided. |
| `terms_to_charge` | `number` | No | 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` | `number` | No | 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` | `immediate \| delayed` | No | 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. \* 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. |
| `auto_collection` | `on \| off` | No | Defines whether payments need to be collected automatically for this subscription. Overrides customer's auto-collection property. \* 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` | `no_preference \| cash \| check \| bank_transfer \| ach_credit \| sepa_credit \| boleto \| us_automated_bank_transfer \| eu_automated_bank_transfer \| uk_automated_bank_transfer \| jp_automated_bank_transfer \| mx_automated_bank_transfer \| custom` | No | The preferred offline payment method for the subscription. \* sepa\_credit - SEPA Credit \* cash - Cash \* no\_preference - No Preference \* bank\_transfer - Bank Transfer \* check - Check \* eu\_automated\_bank\_transfer - EU Automated Bank Transfer \* jp\_automated\_bank\_transfer - JP Automated Bank Transfer \* uk\_automated\_bank\_transfer - UK Automated Bank Transfer \* custom - Custom \* boleto - Boleto \* mx\_automated\_bank\_transfer - MX Automated Bank Transfer \* us\_automated\_bank\_transfer - US Automated Bank Transfer \* ach\_credit - ACH Credit |
| `po_number` | `string` | No | Purchase order number for this subscription. |
| `coupon_ids` | `string[]` | No | The list of coupons to be applied to this subscription. You can provide [coupon IDs](https://docs.corsair.dev/docs/api/coupons/coupon-object#id) or [coupon codes](https://docs.corsair.dev/docs/api/coupon_codes/coupon-code-object#code). **Note** \* If `changes_scheduled_at` is in the past, you can use currently available coupons even if those coupons were not available on the date of the change. |
| `replace_coupon_list` | `boolean` | No | Determines whether the provided `coupon_ids` replace or add to the [existing coupons](https://docs.corsair.dev/docs/api/subscriptions#coupons) on the subscription. **Default value** \* `false` (the provided coupons are added to the existing coupons) |
| `prorate` | `boolean` | No | When this subscription change is set to occur in the middle of the subscription term, `prorate` determines whether [prorated credits and charges](https://www.chargebee.com/docs/billing/2.0/subscriptions/proration#proration-mechanism) are created for the change. \* When `true`: Prorated credits or charges are created as applicable for this change. \* When `false`: The subscription is changed without creating any credits or charges. **Default value** The value configured in the [site settings](https://www.chargebee.com/docs/2.0/proration.html#proration-for-subscription-change) is used when not provided. **Constraints** If you set `prorate` to `true` for a change made mid-term in the billing cycle, credits are **not** created if all of the following were true for a previous change in the same billing term: \* The earlier change had `prorate` set to `false`. \* No changes were made to the subscription's billing term. \* Only the subscription's items or their prices were updated. |
| `end_of_term` | `boolean` | No | **Deprecated** \* This option is deprecated; use the [Create a ramp API](https://docs.corsair.dev/docs/api/ramps/create-a-ramp) instead. \* If you pass this parameter along with `change_option`, then `change_option` takes precedence. This parameter has the same effect as setting the `change_option` parameter to `end_of_term`. |
| `force_term_reset` | `boolean` | No | Forces the subscription term to start from the date of the subscription change when updating to a plan-item price with the same billing period as the current plan-item price. **Default value** \* `false` **Constraints** \* Only applicable when the new plan-item price has the same billing period as the current plan-item price. When the billing period differs, the term is always reset regardless of this parameter's value. \* Only takes effect when `end_of_term` is `false`. \* If you pass `force_term_reset`, you must also pass `invoice_usages` with the same value when **all** of the following site configuration settings are enabled: \* [Usage-based billing](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/setting-up-usage-based-billing) \* Mid-term changes for usage-based items \* [Invoice and charge for usage-based items when a subscription is changing](https://www.chargebee.com/docs/billing/2.0/subscriptions/metered_billing#configuring-metered-billing) |
| `reactivate` | `boolean` | No | Determines whether to reactivate a cancelled subscription when making this API request. **Default value** \* `true` when `subscription_items` or `coupons` are provided, unless explicitly set to `false`. **Required if** \* The subscription `status` is `cancelled` and you want to reactivate it. |
| `token_id` | `string` | No | The Chargebee payment token generated by [Chargebee.js](https://www.chargebee.com/docs/payments/2.0/card-components-and-helpers/3ds-helper#using-the-gateways-hosted-fields). **Note** : The payment token created via Chargebee.js uses the gateway selected through [Smart Routing](https://www.chargebee.com/docs/payments/2.0/payment-gateways-and-configuration/gateway_settings#smart-routing). Explicitly passing a `gateway_id` in this API call will not override the gateway associated with the token. |
| `invoice_notes` | `string` | No | A customer-facing note added to all invoices associated with this subscription. This note is one among [all the notes](https://docs.corsair.dev/docs/api/invoices/invoice-object#notes) displayed on the invoice PDF. |
| `meta_data` | `object` | No | A collection of [key-value pairs](https://docs.corsair.dev/docs/api/advanced-features#metadata) that provides extra information about the subscription. **Constraints** \* There's a character limit of 65,535. |
| `invoice_immediately` | `boolean` | No | Determines whether charges raised immediately for the subscription are invoiced immediately or added to [unbilled charges](https://docs.corsair.dev/docs/api/unbilled_charges). **Default value** \* The value configured in the [site settings](https://www.chargebee.com/docs/unbilled-charges.html#configuration) is used when not provided. **Note:** \* Any charges scheduled to be raised in the future are not affected by this parameter. |
| `override_relationship` | `boolean` | No | If `true` , ignores the [hierarchy relationship](https://docs.corsair.dev/docs/api/customers/customer-object#relationship) and uses customer as payment and invoice owner. |
| `changes_scheduled_at` | `number` | No | The date-time at which the subscription change is to happen or has happened. **Deprecated for scheduling changes** \* Setting this parameter to a future date-time for scheduling changes is deprecated. Use the [Create a ramp API](https://docs.corsair.dev/docs/api/ramps/create-a-ramp) instead. **Required if** \* `change_option` is set to `specific_date`. **Constraints** \* Do not pass this parameter along with `reactivate_from`. **Backdated changes** `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](https://www.chargebee.com/docs/billing/2.0/subscriptions/backdating#configuring-backdated-subscription-actions-and-invoicing) 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. |
| `change_option` | `immediately \| end_of_term \| specific_date` | No | Specifies when the subscription change takes effect. **Constraints** Regardless of the value of the `change_option` parameter, the following parameters always take effect immediately: \* `auto_collection` \* `shipping_address` \* `po_number` \* Any subscription-level [custom field](https://docs.corsair.dev/docs/api/advanced-features#custom-fields) parameters **Constraints** \* When `change_option` is `end_of_term` or `specific_date`, you cannot reduce `quantity` (or `quantity_in_decimal`) and change `unit_price` (or `unit_price_in_decimal`) for the same per-unit addon in one request. Split the changes into separate API calls. If both are included in one scheduled update, Chargebee returns an `invalid_request` error when the scheduled change is applied. **See also** \* [Impacts on existing scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#impact-scheduled-changes). \* end\_of\_term - **Deprecated** This option is deprecated; use the [Create a ramp API](https://docs.corsair.dev/docs/api/ramps/create-a-ramp) instead. The change is carried out at the end of the current billing cycle of the subscription. \* specific\_date - **Deprecated for scheduling changes** This option is deprecated for scheduling changes to occur at a future date-time, use the [Create a ramp API](https://docs.corsair.dev/docs/api/ramps/create-a-ramp) instead. Executes the change on a specified date. The change occurs as of the date-time defined in `changes_scheduled_at`. \* immediately - The subscription change takes effect immediately. |
| `contract_term_billing_cycle_on_renewal` | `number` | No | 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) . |
| `free_period` | `number` | No | The period of time by which the first billing term after trial is extended free of charge. The value is expressed in the time unit specified by `free_period_unit`. For example, `3` with `free_period_unit` = `month` adds 3 free months to the first paid term when the subscription becomes active. |
| `free_period_unit` | `day \| week \| month \| year` | No | The time unit for `free_period`. **Constraints** Must be equal to or lower than the [`period_unit`](https://docs.corsair.dev/docs/api/item_prices#period_unit) of the plan [item price](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#subscription_items_item_price_id) of the subscription. \* week - Charge based on week(s) \* month - Charge based on month(s) \* day - Charge based on day(s) \* year - Charge based on year(s) |
| `create_pending_invoices` | `boolean` | No | Determines whether invoices for this subscription are generated with a `pending` status. **Prerequisites** \* [Metered Billing](https://www.chargebee.com/docs/metered_billing.html) must be enabled for the site. **Default behavior** \* Set to `true` automatically when the subscription has item prices that belong to `metered` items. **Use case** \* Pending invoices allow you to inspect all charges on each invoice before closing it. |
| `auto_close_invoices` | `boolean` | No | Overrides the [site-level setting](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) for auto-closing invoices for this subscription. **Prerequisites** \* Auto-closing invoices must be enabled for the site. **Constraints** \* This attribute has a higher precedence than the same attribute at the [customer level](customers/customer-object#auto_close_invoices). |
| `trial_end_action` | `site_default \| plan_default \| activate_subscription \| cancel_subscription` | No | Applicable only when [End-of-trial Action](https://www.chargebee.com/docs/2.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. \* activate\_subscription - The subscription activates and charges are raised for non-metered items. \* cancel\_subscription - The subscription cancels. \* plan\_default - The action [configured for the site](https://www.chargebee.com/docs/2.0/trial_periods_hidden.html#how-to-define-the-end-of-trial-actions-for-subscriptions) at the time when the trial ends, takes effect. \* site\_default - This is the default value. The action [configured for the site](https://www.chargebee.com/docs/2.0/trial_periods_hidden.html#how-to-define-the-end-of-trial-actions-for-subscriptions) at the time when the trial ends, takes effect. |
| `payment_initiator` | `customer \| merchant` | No | The type of initiator to be used for the payment request triggered by this operation. \* customer - Pass this value to indicate that the request is initiated by the customer \* merchant - Pass this value to indicate that the request is initiated by the merchant |
| `invoice_usages` | `boolean` | No | Determines whether to invoice the overages for metered items during the subscription change. **Prerequisites** \* [Usage-based billing](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/setting-up-usage-based-billing) must be enabled. \* Contact [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 the backend site setting `invoice_overages` for invoicing overages during subscription changes. **Constraints** \* If you pass `invoice_usages`, you must also pass `force_term_reset` with the same value when **all** of the following site configuration settings are enabled: \* Mid-term changes for usage-based items \* [Invoice and charge for usage-based items when a subscription is changing](https://www.chargebee.com/docs/billing/2.0/subscriptions/metered_billing#configuring-metered-billing) |
| `card` | `object` | No | Parameters for card. Use this parameter to pass raw card details. Passing raw card data via API involves PCI liability at your end due to the sensitivity of the data. |
| `payment_method` | `object` | No | Use this parameter if you prefer to use the payment gateway's SDKs to capture the payment method details and pass the payment method token and other details here. See [use cases](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#use-cases) to learn more. |
| `payment_intent` | `object` | No | Pass these parameters to create a new `payment_source` using an authorized `payment_intent`. This is the recommended way to create a payment source in Chargebee for both [Strong Customer Authentication](https://www.chargebee.com/docs/payments/2.0/others/psd2-sca) (SCA) (i.e. 3D-Secure) and non-SCA flows. See use cases to learn more. |
| `billing_address` | `object` | No | Parameters for billing\_address |
| `shipping_address` | `object` | No | Parameters for shipping\_address |
| `statement_descriptor` | `object` | No | Parameters for statement\_descriptor |
| `customer` | `object` | No | Parameters for customer |
| `contract_term` | `object` | No | Parameters for contract\_term |
| `billing_override` | `object` | No | Specify limits on how credits and payments are applied to individual invoices for the subscription. Contact [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. Note: These limits do not apply to [consolidated invoices](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) . |
| `subscription_items` | `object` | No | The list of item prices to add or update in the subscription. **Note** See `replace_items_list` for more details. |
| `discounts` | `object` | No | Parameters for discounts |
| `item_tiers` | `object` | No | Parameters for item\_tiers |

```ts theme={null}
{
}
```

```ts theme={null}
{
  gateway_account_id?: string,
  first_name?: string,
  last_name?: string,
  number?: string,
  expiry_month?: number,
  expiry_year?: number,
  cvv?: string,
  preferred_scheme?: cartes_bancaires | mastercard | visa | dankort,
  billing_addr1?: string,
  billing_addr2?: string,
  billing_city?: string,
  billing_state_code?: string,
  billing_state?: string,
  billing_zip?: string,
  billing_country?: string,
  additional_information?: {
  }
}
```

```ts theme={null}
{
  type?: card | paypal_express_checkout | amazon_payments | direct_debit | generic | alipay | unionpay | apple_pay | wechat_pay | ideal | google_pay | sofort | bancontact | giropay | dotpay | upi | netbanking_emandates | venmo | pay_to | faster_payments | sepa_instant_transfer | automated_bank_transfer | klarna_pay_now | online_banking_poland | payconiq_by_bancontact | electronic_payment_standard | kbc_payment_button | pay_by_bank | trustly | stablecoin | kakao_pay | naver_pay | revolut_pay | cash_app_pay | twint | go_pay | grab_pay | pay_co | after_pay | swish | payme | pix | klarna | alipay_hk | paypay | gcash | south_korean_cards | paynow | bizum | promptpay | dana | touch_n_go | tamara | qpay | ovo | momo | mercado_pago | nequi | nupay | picpay | thai_qr | blik | fpx | wero | p24 | affirm_pay | rakuten_pay,
  gateway_account_id?: string,
  reference_id?: string,
  tmp_token?: string,
  issuing_country?: string,
  additional_information?: {
  }
}
```

```ts theme={null}
{
  id?: string,
  gateway_account_id?: string,
  gw_token?: string,
  payment_method_type?: card | ideal | sofort | bancontact | google_pay | dotpay | giropay | apple_pay | upi | netbanking_emandates | paypal_express_checkout | direct_debit | boleto | venmo | amazon_payments | pay_to | faster_payments | sepa_instant_transfer | klarna_pay_now | online_banking_poland | payconiq_by_bancontact | electronic_payment_standard | kbc_payment_button | pay_by_bank | trustly | stablecoin | kakao_pay | naver_pay | revolut_pay | cash_app_pay | wechat_pay | alipay | twint | go_pay | grab_pay | pay_co | after_pay | swish | payme | pix | klarna | alipay_hk | paypay | gcash | south_korean_cards | paynow | bizum | promptpay | dana | touch_n_go | tamara | qpay | ovo | momo | mercado_pago | nequi | nupay | picpay | thai_qr | blik | fpx | wero | p24 | affirm_pay | rakuten_pay,
  reference_id?: string,
  additional_information?: {
  }
}
```

```ts theme={null}
{
  first_name?: string,
  last_name?: string,
  email?: string,
  company?: string,
  phone?: string,
  line1?: string,
  line2?: string,
  line3?: string,
  city?: string,
  state_code?: string,
  state?: string,
  zip?: string,
  country?: string,
  validation_status?: not_validated | valid | partially_valid | invalid
}
```

```ts theme={null}
{
  first_name?: string,
  last_name?: string,
  email?: string,
  company?: string,
  phone?: string,
  line1?: string,
  line2?: string,
  line3?: string,
  city?: string,
  state_code?: string,
  state?: string,
  zip?: string,
  country?: string,
  validation_status?: not_validated | valid | partially_valid | invalid
}
```

```ts theme={null}
{
  descriptor?: string
}
```

```ts theme={null}
{
  vat_number?: string,
  vat_number_prefix?: string,
  entity_identifier_scheme?: string,
  is_einvoice_enabled?: boolean,
  einvoicing_method?: automatic | manual | site_default,
  entity_identifier_standard?: string,
  business_customer_without_vat_number?: boolean,
  registered_for_gst?: boolean
}
```

```ts theme={null}
{
  action_at_term_end?: renew | evergreen | cancel | renew_once,
  cancellation_cutoff_period?: number
}
```

```ts theme={null}
{
  max_excess_payment_usage?: number,
  max_refundable_credits_usage?: number
}
```

```ts theme={null}
{
  item_price_id: string[],
  quantity?: number[],
  quantity_in_decimal?: string[],
  unit_price?: number[],
  unit_price_in_decimal?: string[],
  billing_cycles?: number[],
  trial_end?: number[],
  service_period_days?: number[],
  charge_on_event?: (subscription_creation | subscription_trial_start | plan_activation | subscription_activation | contract_termination)[],
  charge_once?: boolean[],
  charge_on_option?: (immediately | on_event)[],
  description?: string[],
  proration_type?: (full_term | partial_term | none)[],
  usage_accumulation_reset_frequency?: (never | subscription_billing_frequency)[]
}
```

```ts theme={null}
{
  apply_on?: (invoice_amount | specific_item_price)[],
  duration_type: (one_time | forever | limited_period)[],
  percentage?: number[],
  amount?: number[],
  period?: number[],
  period_unit?: (day | week | month | year)[],
  included_in_mrr?: boolean[],
  item_price_id?: string[],
  quantity?: number[],
  operation_type: (add | remove)[],
  id?: string[],
  description?: string[]
}
```

```ts theme={null}
{
  item_price_id?: string[],
  starting_unit?: number[],
  ending_unit?: number[],
  price?: number[],
  starting_unit_in_decimal?: string[],
  ending_unit_in_decimal?: string[],
  price_in_decimal?: string[],
  pricing_type?: (per_unit | flat_fee | package)[],
  package_size?: number[]
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `subscription` | `object \| null` | No | A Chargebee subscription connects a customer record to products/services. It describes what the customer has signed up for and how often they're charged for it. The essential components of a subscription are: \* A [plan-item price](https://docs.corsair.dev/docs/api/item_prices). \* Any addon- and charge-item prices applied to the subscription. \* Any [coupons](https://docs.corsair.dev/docs/api/coupons) applied. \* Any [discounts](https://docs.corsair.dev/docs/api/discounts) applied. The charges in a subscription are billed via invoices. **Note:** The maximum number of subscriptions for any given [customer](https://docs.corsair.dev/docs/api/customers) ([active](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#status) or not) is 900. #### Subscription billing frequencies Chargebee offers two billing frequency options for subscriptions: \* **Plan-based billing** (`default`): Subscriptions are billed based on the billing period defined for the item price of the `item_type` `plan`. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/subscriptions#plan-based-billing). \* **Multi-frequency billing** : Subscriptions are billed according to the billing period of each recurring item price within the subscription. [Learn more](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing). **Important** [Limitations](https://www.chargebee.com/docs/billing/2.0/subscriptions/multi-frequency-billing#limitations) of Multi-frequency billing. The selection of the billing frequency preference is configured at the site level. #### Item price compatibility in a subscription When creating or updating a subscription, one of the item prices specified under subscription\_items must be a plan-item price. The remaining must be compatible addon- or charge-item prices. An item price is compatible with a plan-item price if their currencies are the same. Additionally, an addon-item price is compatible with a plan-item price only if their billing frequencies meet the following conditions: \| `period_unit` for plan-item price \| Compatible `period_unit` for addon-item price \| Compatible period for addon-item price \| \|-----------------------------------\|-----------------------------------------------\|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `day` \| `day` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `10`, then the period of the addon-item price can be `10`, `5`, `2`, or `1`. \| \| `week` \| `week` or `day` \| The `period` (in days) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the period of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `week`, `period` can be `2` or `1`. \* for `period_unit` as `day`, `period` can be `14`, `7`, `2`, or `1`. \| \| `month` \| `month` \| The `period` of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `6`, then the `period` of the addon-item price can be `6`, `3`, `2`, or `1`. \| \| `year` \| `year` or `month` \| The `period` (in months) of the plan-item price should be divisible by the `period` of the addon-item price. **Example** If the `period` of the plan-item price is `2`, then the `period` of the addon-item price can be as follows depending on the value of `period_unit`: \* for `period_unit` as `year`, `period` can be `2` or `1`. \* for `period_unit` as `month`, `period` can be `24`, `12`, `8`, `6`, `4`, `3`, `2`, or `1`. \| #### Tax provider fields **Avalara** : Merchants using **Avalara Sales Tax** can optionally associate each item price with a locationCode (from their Avalara company locations), so tax can be resolved correctly at the line item level. \| Field ID \| Field Value \| APIs \| \|--------------------------------------------------------------------------------\|----------------------------------------------------------------------\|--------------------------------------------------------------------------------\| \| `locationCode` \| Merchant to configure it on Avalara Platform under company locations \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| **Anrok**: Canadian customers can have multiple tax registration numbers. We currently support only sharing one tax registration number with Anrok. So we added a new field which can have comma separated multiple tax reg numbers for Anrok. Values configured in the field is passed as it is to Anrok for accurate tax calculation \| Field ID \| Field Value \| APIs \| \|---------------------------------------------------------------------------------------------------------------------------------------\|---------------------------------------------------------------\|---------------------------------------------------------------------------------------------------------------------------------------\| \| `additionalTaxRegistrationNumber` \| Canadian tax registration numbers in comma separated fashion. \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| \| APIs involving customer attributes. Also includes APIs where we are creating new customers. Eg: estimate, subscription, hosted pages. \| **Vertex**: Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Vertex Platform for seamless integration **Note:** Field Id like `customerCode` , `customerClass` , and`taxExempted` belong to the customer object. Field Id like `productCode` , `productClass` , `productTaxCode` , and `productClass` belong to the product object. \| Field ID \| Field Value \| APIs \| \|-----------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productCode` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Vertex Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `customerCode` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `customerClass` \| Merchant to configure it on Vertex Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **Taxamo:** Chargebee shares field IDs and corresponding values with merchants, who then configure them on the Taxamo Platform for seamless integration \| Field Id \| Field Value \| APIs \| \|------------------\|---------------------------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `productTaxCode` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `productClass` \| Merchant to configure it on Taxamo Platform \| APIs having [Item Prices](https://docs.corsair.dev/docs/api/item_prices/item-price-object) attributes. \| \| `taxExempted` \| Merchant to configure it on Taxamo Platform \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **cbtaxes**: With CBTaxes, you can activate India IGST for customers located in Special Economic Zones (SEZ), implement zero-rated tax for SEZ customers, enable India IGST for customers outside of India, and set up zero-rated tax for customers outside of India. \| Field ID \| Field Value \| APIs \| \|---------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `indiaSez` \| `SEZ_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaSez` \| `SEZ_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_IGST_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| `indiaExport` \| `EXPORT_ZERO_RATED_TAX` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| **All**: For tax inclusive tax calculation, For tax exclusive tax calculation. This is currently used for price type overriding at customer level \| Field ID \| Field Value \| APIs \| \|-------------\|-------------------------\|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `priceType` \| `TAX_INCLUSIVE` \| APIs involving [customer](https://docs.corsair.dev/docs/api/customers/customer-object) attributes. Also includes APIs where we are creating new customers. For example: [estimate](https://docs.corsair.dev/docs/api/estimates/estimate-for-creating-a-customer-and-subscription), [subscription](https://docs.corsair.dev/docs/api/subscriptions), [hosted pages](https://docs.corsair.dev/docs/api/hosted_pages/checkout-charge-items-and-one-time-charges). \| \| \| `TAX_EXCLUSIVE` \| \| \| \| `SITE_DEFAULT` or blank \| Removes price type override, and allows site level configuration to be used for tax calculation. \| #### Ramps API compatibility mode If you want to schedule changes on a subscription, use the [Ramps API](https://docs.corsair.dev/docs/api/ramps). If you are currently scheduling changes through the [Update subscription API](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items), migrate to the Ramps API. To get started, [request access for Subscription Ramps](https://app.chargebee.com/login?forward=https://app.chargebee.com/request_access/subscription-ramps\&ref=feature). Chargebee will enable Ramps compatibility mode for your site. Once enabled, you can test the Ramps API without impacting your existing integrations. The following parts of the Billing API have subtle differences in behavior when the Ramps feature is disabled versus when it is enabled with compatibility mode. (Follow the links to learn more.) \* The value of the [`subscription.has_scheduled_changes`](https://docs.corsair.dev/docs/api/subscriptions/subscription-object#has_scheduled_changes) attribute. \* [Update subscription](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items#impact-scheduled-changes) \* [Create Checkout for updating a subscription](https://docs.corsair.dev/docs/api/hosted_pages/create-checkout-to-update-a-subscription#impact-scheduled-changes) \* [Remove scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/remove-scheduled-changes) \* [Retrieve with scheduled changes](https://docs.corsair.dev/docs/api/subscriptions/retrieve-with-scheduled-changes) \* [Create a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/create-a-quote-for-update-subscription-items) \* [Edit a quote for updating a subscription](https://docs.corsair.dev/docs/api/quotes/edit-update-subscription-quote-for-items) \* [Portal sessions](https://docs.corsair.dev/docs/api/portal_sessions#scheduled-subscription-changes) |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |
| `card` | `object \| null` | No | #### Deprecated The [Payment Sources API](https://docs.corsair.dev/docs/api/payment_sources) , with its additional options and improvements, obsoletes the Cards APIs. [Learn more](https://docs.corsair.dev/docs/api/getting-started) . The following table lists the Payment Sources API operations alongside the equivalent Card API operations: \| API at Card resource \| Use instead \| \|------------------------------------------------------------------------------\|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| [Retrieve card for a customer](https://docs.corsair.dev/docs/api/cards/retrieve-card-for-a-customer) \| [Retrieve a payment source](https://docs.corsair.dev/docs/api/payment_sources/retrieve-a-payment-source) \| \| [Update card for a customer](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) \| \* [Create using temporary token](https://docs.corsair.dev/docs/api/payment_sources/create-using-gateway-temporary-token) \* [Create using permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) \* [Create a card payment source](https://docs.corsair.dev/docs/api/payment_sources/create-a-card-payment-source) \| \| [Switch gateway](https://docs.corsair.dev/docs/api/cards/switch-gateway) \| [Switch gateway account](https://docs.corsair.dev/docs/api/payment_sources/switch-gateway-account) \| \| [Copy card](https://docs.corsair.dev/docs/api/cards/copy-card) \| [Export payment source](https://docs.corsair.dev/docs/api/payment_sources/export-payment-source) \| \| [Delete card for a customer](https://docs.corsair.dev/docs/api/cards/delete-card-for-a-customer) \| [Delete a payment source](https://docs.corsair.dev/docs/api/payment_sources/delete-a-payment-source) \| |
| `invoice` | `object \| null` | No | An invoice is a commercial document representing a sale of products/services offered by you to a customer. It enumerates all the charges, adjustments, payments, discounts and taxes associated with the sale. An invoice is said to be a recurring one when it is has at least one charge for [a plan or an addon item price](https://docs.corsair.dev/docs/api/items). It is a non-recurring one when it has charges for only charge-item prices or [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices for any given billing term of a subscription are billed via an invoice at the beginning of the term (unless the charges are left unbilled). However, item prices that belong to `metered` items are billed at the end of the term via a `pending` invoice that can [close automatically](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/metered_billing#configuring-metered-billing) or via [an API call](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice). Moreover, when there are no `metered` items in the subscription, the invoices can still be generated as `pending` while [creating](https://docs.corsair.dev/docs/api/subscriptions/create-subscription-for-items) or [updating](https://docs.corsair.dev/docs/api/subscriptions/update-subscription-for-items) a subscription. #### Auto-collection If [auto-collection](https://www.chargebee.com/docs/2.0/customers.html#auto-collection-status) is enabled, then immediately on invoice generation (or, in case of subscriptions that have `create_pending_invoices` as `true`, on [invoice closure](https://docs.corsair.dev/docs/api/invoices/close-a-pending-invoice)), the [payment method](https://docs.corsair.dev/docs/api/customers/customer-object#payment_method) on file is charged: \* If the payment succeeds, the invoice is marked as `paid`. \* On payment failure, the invoice is marked as `payment_due` and [dunning settings](https://www.chargebee.com/docs/2.0/dunning-v2.html) are taken into account for payment retries. \* If no retry attempts are configured, or when retries are exhausted, the invoice is marked as `not_paid`. \* the amount due is zero or negative, the invoice is immediately marked as `paid` and the balance, if any, is added to [excess payments](https://www.chargebee.com/docs/2.0/customers.html#excess-payments) for the customer. **Note:** If [consolidated invoicing](https://www.chargebee.com/docs/2.0/consolidated-invoicing.html) is enabled, the attribute `subscription_id` is unavailable when the invoice has line items from multiple subscriptions. The individual subscription ids are seen under `line_items.subscription_id`. #### Recurring and non-recurring invoices A recurring invoice contains at least one line item that is billed on a recurring basis. Specifically, it has at least one [`line_items[]`](https://docs.corsair.dev/docs/api/invoices/invoice-object#line_items) with `entity_type` set to `plan_item_price` or `addon_item_price`. A non-recurring invoice contains no recurring line items. #### Refundable amount for an invoice The refundable amount for an invoice is the (amount paid on the invoice + refundable credit applied on the invoice + taxes withheld on the invoice) minus (amount issued as refundable credit notes from the invoice). Each of these amounts is obtained from the invoice resource as follows: \* Amount paid on the invoice: [`amount_paid`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_amount_paid) \* Refundable credit applied on the invoice: [`credits_applied`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_credits_applied) \* Taxes withheld on the invoice: Sum of [`linked_taxes_withheld[].amount`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_linked_taxes_withheld) \* Amount issued as refundable credit notes from the invoice: Sum of [`issued_credit_notes[i].cn_total`](https://docs.corsair.dev/docs/api/invoices/invoice-object#invoice_issued_credit_notes) where `issued_credit_notes[i].cn_status` is `refunded` or `refund_due`. |
| `unbilled_charges` | `object[] \| null` | No | Resource object representing unbilled\_charge |
| `credit_notes` | `object[] \| null` | No | Resource object representing credit\_note |

```ts theme={null}
{
  id?: string | null,
  currency_code?: string | null,
  billing_period?: number | null,
  billing_period_unit?: string | null,
  start_date?: number | null,
  trial_end?: number | null,
  remaining_billing_cycles?: number | null,
  po_number?: string | null,
  auto_collection?: string | null,
  plan_quantity_in_decimal?: string | null,
  plan_unit_price_in_decimal?: string | null,
  customer_id?: string | null,
  status?: string | null,
  trial_start?: number | null,
  trial_end_action?: string | null,
  current_term_start?: number | null,
  current_term_end?: number | null,
  next_billing_at?: number | null,
  created_at?: number | null,
  started_at?: number | null,
  activated_at?: number | null,
  contract_term_billing_cycle_on_renewal?: number | null,
  override_relationship?: boolean | null,
  pause_date?: number | null,
  resume_date?: number | null,
  cancelled_at?: number | null,
  cancel_reason?: string | null,
  created_from_ip?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  has_scheduled_advance_invoices?: boolean | null,
  has_scheduled_changes?: boolean | null,
  payment_source_id?: string | null,
  plan_free_quantity_in_decimal?: string | null,
  plan_amount_in_decimal?: string | null,
  cancel_schedule_created_at?: number | null,
  offline_payment_method?: string | null,
  channel?: string | null,
  net_term_days?: number | null,
  active_id?: string | null,
  due_invoices_count?: number | null,
  due_since?: number | null,
  total_dues?: number | null,
  mrr?: number | null,
  exchange_rate?: number | null,
  base_currency_code?: string | null,
  invoice_notes?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  changes_scheduled_at?: number | null,
  cancel_reason_code?: string | null,
  free_period?: number | null,
  free_period_unit?: string | null,
  create_pending_invoices?: boolean | null,
  auto_close_invoices?: boolean | null,
  business_entity_id?: string | null,
  decommissioned?: boolean | null,
  brand_id?: string | null,
  subscription_items?: {
    item_price_id?: string | null,
    item_type?: string | null,
    quantity?: number | null,
    quantity_in_decimal?: string | null,
    unit_price?: number | null,
    unit_price_in_decimal?: string | null,
    amount?: number | null,
    current_term_start?: number | null,
    current_term_end?: number | null,
    next_billing_at?: number | null,
    amount_in_decimal?: string | null,
    billing_period?: number | null,
    billing_period_unit?: string | null,
    free_quantity?: number | null,
    free_quantity_in_decimal?: string | null,
    trial_end?: number | null,
    billing_cycles?: number | null,
    service_period_days?: number | null,
    charge_on_event?: string | null,
    charge_once?: boolean | null,
    charge_on_option?: string | null,
    proration_type?: string | null,
    usage_accumulation_reset_frequency?: string | null,
    description?: string | null
  }[] | null,
  item_tiers?: {
    item_price_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    price?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    price_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null,
    index?: number | null
  }[] | null,
  charged_items?: {
    item_price_id?: string | null,
    last_charged_at?: number | null
  }[] | null,
  coupons?: {
    coupon_id?: string | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_code?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_info?: {
    referral_code?: string | null,
    coupon_code?: string | null,
    referrer_id?: string | null,
    external_reference_id?: string | null,
    reward_status?: string | null,
    referral_system?: string | null,
    account_id?: string | null,
    campaign_id?: string | null,
    external_campaign_id?: string | null,
    friend_offer_type?: string | null,
    referrer_reward_type?: string | null,
    notify_referral_system?: string | null,
    destination_url?: string | null,
    post_purchase_widget_enabled?: boolean | null
  } | null,
  billing_override?: {
    max_excess_payment_usage?: number | null,
    max_refundable_credits_usage?: number | null
  } | null,
  contract_term?: {
    id?: string | null,
    status?: string | null,
    contract_start?: number | null,
    contract_end?: number | null,
    billing_cycle?: number | null,
    action_at_term_end?: string | null,
    total_contract_value?: number | null,
    total_contract_value_before_tax?: number | null,
    cancellation_cutoff_period?: number | null,
    created_at?: number | null,
    subscription_id?: string | null,
    remaining_billing_cycles?: number | null
  } | null,
  discounts?: {
    id?: string | null,
    invoice_name?: string | null,
    description?: string | null,
    type?: string | null,
    percentage?: number | null,
    amount?: number | null,
    quantity?: number | null,
    currency_code?: string | null,
    duration_type?: string | null,
    period?: number | null,
    period_unit?: string | null,
    included_in_mrr?: boolean | null,
    apply_on?: string | null,
    item_price_id?: string | null,
    created_at?: number | null,
    apply_till?: number | null,
    applied_count?: number | null,
    coupon_id?: string | null,
    index?: number | null
  }[] | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  email?: string | null,
  phone?: string | null,
  company?: string | null,
  vat_number?: string | null,
  auto_collection?: string | null,
  offline_payment_method?: string | null,
  net_term_days?: number | null,
  vat_number_validated_time?: number | null,
  vat_number_status?: string | null,
  allow_direct_debit?: boolean | null,
  is_location_valid?: boolean | null,
  created_at?: number | null,
  created_from_ip?: string | null,
  exemption_details?: any[] | null,
  taxability?: string | null,
  entity_code?: string | null,
  exempt_number?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  locale?: string | null,
  billing_date?: number | null,
  billing_month?: number | null,
  billing_date_mode?: string | null,
  billing_day_of_week?: string | null,
  billing_day_of_week_mode?: string | null,
  pii_cleared?: string | null,
  auto_close_invoices?: boolean | null,
  channel?: string | null,
  active_id?: string | null,
  fraud_flag?: string | null,
  primary_payment_source_id?: string | null,
  backup_payment_source_id?: string | null,
  invoice_notes?: string | null,
  business_entity_id?: string | null,
  preferred_currency_code?: string | null,
  promotional_credits?: number | null,
  unbilled_charges?: number | null,
  refundable_credits?: number | null,
  excess_payments?: number | null,
  is_einvoice_enabled?: boolean | null,
  einvoicing_method?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  registered_for_gst?: boolean | null,
  consolidated_invoicing?: boolean | null,
  customer_type?: string | null,
  business_customer_without_vat_number?: boolean | null,
  client_profile_id?: string | null,
  use_default_hierarchy_settings?: boolean | null,
  vat_number_prefix?: string | null,
  entity_identifier_scheme?: string | null,
  entity_identifier_standard?: string | null,
  brand_id?: string | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_urls?: {
    external_customer_id?: string | null,
    referral_sharing_url?: string | null,
    created_at?: number | null,
    updated_at?: number | null,
    referral_campaign_id?: string | null,
    referral_account_id?: string | null,
    referral_external_campaign_id?: string | null,
    referral_system?: string | null
  }[] | null,
  contacts?: {
    id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    phone?: string | null,
    label?: string | null,
    enabled?: boolean | null,
    send_account_email?: boolean | null,
    send_billing_email?: boolean | null
  }[] | null,
  payment_method?: {
    type?: string | null,
    gateway?: string | null,
    gateway_account_id?: string | null,
    status?: string | null,
    reference_id?: string | null
  } | null,
  balances?: {
    promotional_credits?: number | null,
    excess_payments?: number | null,
    refundable_credits?: number | null,
    unbilled_charges?: number | null,
    currency_code?: string | null,
    business_entity_id?: string | null
  }[] | null,
  entity_identifiers?: {
    id?: string | null,
    value?: string | null,
    scheme?: string | null,
    standard?: string | null
  }[] | null,
  tax_providers_fields?: {
    provider_name?: string | null,
    field_id?: string | null,
    field_value?: string | null
  }[] | null,
  relationship?: {
    parent_id?: string | null,
    payment_owner_id?: string | null,
    invoice_owner_id?: string | null
  } | null,
  parent_account_access?: {
    portal_edit_child_subscriptions?: string | null,
    portal_download_child_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null,
  child_account_access?: {
    portal_edit_subscriptions?: string | null,
    portal_download_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null
} | null
```

```ts theme={null}
{
  payment_source_id?: string | null,
  status?: string | null,
  gateway?: string | null,
  gateway_account_id?: string | null,
  ref_tx_id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  iin?: string | null,
  last4?: string | null,
  card_type?: string | null,
  funding_type?: string | null,
  expiry_month?: number | null,
  expiry_year?: number | null,
  issuing_country?: string | null,
  billing_addr1?: string | null,
  billing_addr2?: string | null,
  billing_city?: string | null,
  billing_state_code?: string | null,
  billing_state?: string | null,
  billing_country?: string | null,
  billing_zip?: string | null,
  created_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  ip_address?: string | null,
  powered_by?: string | null,
  customer_id?: string | null,
  masked_number?: string | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  payment_owner?: string | null,
  subscription_id?: string | null,
  recurring?: boolean | null,
  status?: string | null,
  date?: number | null,
  due_date?: number | null,
  net_term_days?: number | null,
  po_number?: string | null,
  vat_number?: string | null,
  price_type?: string | null,
  exchange_rate?: number | null,
  local_currency_exchange_rate?: number | null,
  currency_code?: string | null,
  local_currency_code?: string | null,
  tax?: number | null,
  sub_total?: number | null,
  sub_total_in_local_currency?: number | null,
  total?: number | null,
  total_in_local_currency?: number | null,
  amount_due?: number | null,
  amount_adjusted?: number | null,
  amount_paid?: number | null,
  paid_at?: number | null,
  write_off_amount?: number | null,
  credits_applied?: number | null,
  dunning_status?: string | null,
  next_retry_at?: number | null,
  voided_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  line_items_next_offset?: string | null,
  first_invoice?: boolean | null,
  new_sales_amount?: number | null,
  has_advance_charges?: boolean | null,
  offline_payment_method?: string | null,
  term_finalized?: boolean | null,
  is_gifted?: boolean | null,
  generated_at?: number | null,
  expected_payment_date?: number | null,
  amount_to_collect?: number | null,
  round_off_amount?: number | null,
  retry_segment_id?: string | null,
  void_reason_code?: string | null,
  deleted?: boolean | null,
  tax_category?: string | null,
  vat_number_prefix?: string | null,
  channel?: string | null,
  business_entity_id?: string | null,
  brand_id?: string | null,
  exchange_rates?: {
    currency_code?: string | null,
    rate?: number | null
  }[] | null,
  line_items?: {
    id?: string | null,
    subscription_id?: string | null,
    date_from?: number | null,
    date_to?: number | null,
    unit_amount?: number | null,
    quantity?: number | null,
    amount?: number | null,
    pricing_model?: string | null,
    is_taxed?: boolean | null,
    tax_amount?: number | null,
    tax_rate?: number | null,
    unit_amount_in_decimal?: string | null,
    quantity_in_decimal?: string | null,
    amount_in_decimal?: string | null,
    discount_amount?: number | null,
    item_level_discount_amount?: number | null,
    metered?: boolean | null,
    is_percentage_pricing?: boolean | null,
    reference_line_item_id?: string | null,
    description?: string | null,
    entity_description?: string | null,
    entity_type?: string | null,
    tax_exempt_reason?: string | null,
    entity_id?: string | null,
    customer_id?: string | null,
    proration_mode?: string | null
  }[] | null,
  line_item_tiers?: {
    line_item_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    quantity_used?: number | null,
    unit_amount?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    quantity_used_in_decimal?: string | null,
    unit_amount_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null
  }[] | null,
  line_item_discounts?: {
    line_item_id?: string | null,
    discount_type?: string | null,
    coupon_id?: string | null,
    entity_id?: string | null,
    discount_amount?: number | null
  }[] | null,
  line_item_taxes?: {
    line_item_id?: string | null,
    tax_name?: string | null,
    tax_rate?: number | null,
    date_to?: number | null,
    date_from?: number | null,
    prorated_taxable_amount?: number | null,
    is_partial_tax_applied?: boolean | null,
    is_non_compliance_tax?: boolean | null,
    taxable_amount?: number | null,
    tax_amount?: number | null,
    tax_juris_type?: string | null,
    tax_juris_name?: string | null,
    tax_juris_code?: string | null,
    tax_amount_in_local_currency?: number | null,
    local_currency_code?: string | null
  }[] | null,
  line_item_credits?: {
    cn_id?: string | null,
    applied_amount?: number | null,
    line_item_id?: string | null
  }[] | null,
  line_item_addresses?: {
    line_item_id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  }[] | null,
  discounts?: {
    amount?: number | null,
    description?: string | null,
    line_item_id?: string | null,
    entity_type?: string | null,
    discount_type?: string | null,
    entity_id?: string | null,
    coupon_set_code?: string | null
  }[] | null,
  taxes?: {
    name?: string | null,
    amount?: number | null,
    description?: string | null
  }[] | null,
  tax_origin?: {
    country?: string | null,
    registration_number?: string | null
  } | null,
  linked_taxes_withheld?: {
    id?: string | null,
    amount?: number | null,
    description?: string | null,
    date?: number | null,
    reference_number?: string | null
  }[] | null,
  linked_payments?: {
    txn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null
  }[] | null,
  reference_transactions?: {
    applied_amount?: number | null,
    applied_at?: number | null,
    txn_id?: string | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null,
    txn_type?: string | null,
    amount_capturable?: number | null,
    authorization_reason?: string | null
  }[] | null,
  dunning_attempts?: {
    attempt?: number | null,
    transaction_id?: string | null,
    dunning_type?: string | null,
    created_at?: number | null,
    txn_status?: string | null,
    txn_amount?: number | null,
    retry_engine?: string | null
  }[] | null,
  applied_credits?: {
    cn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_status?: string | null,
    tax_application?: string | null
  }[] | null,
  adjustment_credit_notes?: {
    cn_id?: string | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_total?: number | null,
    cn_status?: string | null
  }[] | null,
  issued_credit_notes?: {
    cn_id?: string | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_total?: number | null,
    cn_status?: string | null
  }[] | null,
  linked_orders?: {
    id?: string | null,
    document_number?: string | null,
    status?: string | null,
    order_type?: string | null,
    reference_id?: string | null,
    fulfillment_status?: string | null,
    batch_id?: string | null,
    created_at?: number | null
  }[] | null,
  notes?: {
    note?: string | null,
    entity_id?: string | null,
    entity_type?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  statement_descriptor?: {
    id?: string | null,
    descriptor?: string | null
  } | null,
  einvoice?: {
    id?: string | null,
    reference_id?: string | null,
    reference_number?: string | null,
    status?: string | null,
    message?: string | null,
    provider_references?: any[] | null
  } | null,
  site_details_at_creation?: {
    timezone?: string | null,
    organization_address?: {
    } | null
  } | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  subscription_id?: string | null,
  date_from?: number | null,
  date_to?: number | null,
  unit_amount?: number | null,
  pricing_model?: string | null,
  quantity?: number | null,
  amount?: number | null,
  currency_code?: string | null,
  discount_amount?: number | null,
  description?: string | null,
  entity_type?: string | null,
  entity_id?: string | null,
  is_voided?: boolean | null,
  voided_at?: number | null,
  unit_amount_in_decimal?: string | null,
  quantity_in_decimal?: string | null,
  amount_in_decimal?: string | null,
  created_at?: number | null,
  updated_at?: number | null,
  is_advance_charge?: boolean | null,
  business_entity_id?: string | null,
  deleted?: boolean | null,
  tiers?: {
    starting_unit?: number | null,
    ending_unit?: number | null,
    quantity_used?: number | null,
    unit_amount?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    quantity_used_in_decimal?: string | null,
    unit_amount_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null
  }[] | null
}[] | null
```

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  subscription_id?: string | null,
  reference_invoice_id?: string | null,
  type?: string | null,
  reason_code?: string | null,
  status?: string | null,
  vat_number?: string | null,
  date?: number | null,
  price_type?: string | null,
  currency_code?: string | null,
  total?: number | null,
  amount_allocated?: number | null,
  amount_refunded?: number | null,
  amount_available?: number | null,
  refunded_at?: number | null,
  voided_at?: number | null,
  generated_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  channel?: string | null,
  line_items_next_offset?: string | null,
  sub_total?: number | null,
  sub_total_in_local_currency?: number | null,
  total_in_local_currency?: number | null,
  local_currency_code?: string | null,
  round_off_amount?: number | null,
  fractional_correction?: number | null,
  notes?: string[] | null,
  deleted?: boolean | null,
  tax_category?: string | null,
  local_currency_exchange_rate?: number | null,
  create_reason_code?: string | null,
  vat_number_prefix?: string | null,
  business_entity_id?: string | null,
  brand_id?: string | null,
  line_items?: {
    id?: string | null,
    subscription_id?: string | null,
    date_from?: number | null,
    date_to?: number | null,
    unit_amount?: number | null,
    quantity?: number | null,
    amount?: number | null,
    pricing_model?: string | null,
    is_taxed?: boolean | null,
    tax_amount?: number | null,
    tax_rate?: number | null,
    unit_amount_in_decimal?: string | null,
    quantity_in_decimal?: string | null,
    amount_in_decimal?: string | null,
    discount_amount?: number | null,
    item_level_discount_amount?: number | null,
    metered?: boolean | null,
    is_percentage_pricing?: boolean | null,
    reference_line_item_id?: string | null,
    description?: string | null,
    entity_description?: string | null,
    entity_type?: string | null,
    tax_exempt_reason?: string | null,
    entity_id?: string | null,
    customer_id?: string | null,
    proration_mode?: string | null
  }[] | null,
  line_item_tiers?: {
    line_item_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    quantity_used?: number | null,
    unit_amount?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    quantity_used_in_decimal?: string | null,
    unit_amount_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null
  }[] | null,
  line_item_discounts?: {
    line_item_id?: string | null,
    discount_type?: string | null,
    coupon_id?: string | null,
    entity_id?: string | null,
    discount_amount?: number | null
  }[] | null,
  line_item_taxes?: {
    line_item_id?: string | null,
    tax_name?: string | null,
    tax_rate?: number | null,
    date_to?: number | null,
    date_from?: number | null,
    prorated_taxable_amount?: number | null,
    is_partial_tax_applied?: boolean | null,
    is_non_compliance_tax?: boolean | null,
    taxable_amount?: number | null,
    tax_amount?: number | null,
    tax_juris_type?: string | null,
    tax_juris_name?: string | null,
    tax_juris_code?: string | null,
    tax_amount_in_local_currency?: number | null,
    local_currency_code?: string | null
  }[] | null,
  line_item_addresses?: {
    line_item_id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  }[] | null,
  discounts?: {
    amount?: number | null,
    description?: string | null,
    line_item_id?: string | null,
    entity_type?: string | null,
    discount_type?: string | null,
    entity_id?: string | null,
    coupon_set_code?: string | null
  }[] | null,
  taxes?: {
    name?: string | null,
    amount?: number | null,
    description?: string | null
  }[] | null,
  tax_origin?: {
    country?: string | null,
    registration_number?: string | null
  } | null,
  linked_refunds?: {
    txn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null,
    refund_reason_code?: string | null
  }[] | null,
  linked_tax_withheld_refunds?: {
    id?: string | null,
    amount?: number | null,
    description?: string | null,
    date?: number | null,
    reference_number?: string | null
  }[] | null,
  allocations?: {
    invoice_id?: string | null,
    allocated_amount?: number | null,
    allocated_at?: number | null,
    invoice_date?: number | null,
    invoice_status?: string | null,
    tax_application?: string | null
  }[] | null,
  exchange_rates?: {
    currency_code?: string | null,
    rate?: number | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  einvoice?: {
    id?: string | null,
    reference_id?: string | null,
    reference_number?: string | null,
    status?: string | null,
    message?: string | null,
    provider_references?: any[] | null
  } | null,
  site_details_at_creation?: {
    timezone?: string | null,
    organization_address?: {
    } | null
  } | null
}[] | null
```

***

### updateScheduledChanges

`subscriptions.updateScheduledChanges`

Update\_scheduled\_changes a subscription\_scheduled\_change.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.subscriptions.updateScheduledChanges({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `cancel_reason_code` | `string` | No | — |
| `action_type` | `cancel \| pause \| reactivate` | No | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `subscription_scheduled_change` | `object \| null` | No | — |

```ts theme={null}
{
  action_type?: string | null,
  data?: string | null,
  created_at?: number | null,
  modified_at?: number | null
} | null
```

***

### upsertEntitlementOverrides

`subscriptions.upsertEntitlementOverrides`

Upsert or remove entitlement overrides for a subscription. Upserts or removes a set of entitlement\_overrides for a subscription depending on the action specified. The API returns the upserted or deleted entitlement\_overrides after successfully completing the operation.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.subscriptions.upsertEntitlementOverrides({ subscriptionId: 'sub_8gsnbYfsMLds' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscriptionId` | `string` | Yes | — |
| `action` | `upsert \| remove` | No | The action to perform for each `entitlement_override` specified in the `entitlement_overrides` array. \* upsert - If the `entitlement_override` for the `subscription_id`, `feature_id`, and `entity_id` combination already exists, the `value` of the `entitlement_override` is updated. If it doesn't exist, a new `entitlement_override` is created. \* remove - Deletes the `entitlement_override` for the `subscription_id`, `feature_id`, and `entity_id` combination, if it exists. |
| `entitlement_overrides` | `object` | No | Parameters for entitlement\_overrides. |

```ts theme={null}
{
  feature_id: string[],
  entity_id?: string[],
  entity_type?: (plan_price | addon_price | charge)[],
  value?: string[],
  expires_at?: number[],
  effective_from?: number[],
  is_enabled?: boolean[]
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |

```ts theme={null}
{
  entitlement_override?: {
    id?: string | null,
    subscription_id?: string | null,
    entity_id?: string | null,
    entity_type?: string | null,
    feature_id?: string | null,
    feature_name?: string | null,
    value?: string | null,
    name?: string | null,
    expires_at?: number | null,
    effective_from?: number | null,
    is_enabled?: boolean | null
  } | null
}[] | null
```

***

## Time Machines

### get

`timeMachines.get`

Retrieve a time machine. Retrieves the time machine. Currently only one time machine is available per site and is named 'delorean'.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.timeMachines.get({ timeMachineName: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `timeMachineName` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `time_machine` | `object \| null` | No | Time Machine is a simulation feature which imitates the key characteristics, behaviours and functions of the billing configurations. It is a virtual time travelling tool which facilitates the integration testing process by carrying out subscription renewals, dunning, webhooks etc on a hypothetical time frame. You can use Time Machine in the test site to verify if the billing rules configured in your site adhere to your expectations before executing them in real time. This feature can be used in both API and UI versions. View this [doc](https://www.chargebee.com/docs/time-machine.html) for more details. **Note:** In order to use Time Machine via API , you need to first "enable" the Time Travel option which is available under **Settings** \\> **Configure Chargebee** \\> **Time Machine**. |

```ts theme={null}
{
  name?: string | null,
  time_travel_status?: string | null,
  genesis_time?: number | null,
  destination_time?: number | null,
  failure_code?: string | null,
  failure_reason?: string | null,
  error_json?: string | null
} | null
```

***

### startAfresh

`timeMachines.startAfresh`

Start afresh. Restart the time machine. This will clear the "customer" data like customer details, subscriptions, invoices, transactions. Also a time travel is initiated to travel back to specified genesis time. Note: This API call is asynchronous. Test sites only: deletes all test data on the site and resets the clock.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.timeMachines.startAfresh({ timeMachineName: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `timeMachineName` | `string` | Yes | — |
| `genesis_time` | `number` | No | The genesis time to travel back as part of the reset operation. If not provided, then the travel is set to 6 months in the past. **Note:** Can only be in the past. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `time_machine` | `object \| null` | No | Time Machine is a simulation feature which imitates the key characteristics, behaviours and functions of the billing configurations. It is a virtual time travelling tool which facilitates the integration testing process by carrying out subscription renewals, dunning, webhooks etc on a hypothetical time frame. You can use Time Machine in the test site to verify if the billing rules configured in your site adhere to your expectations before executing them in real time. This feature can be used in both API and UI versions. View this [doc](https://www.chargebee.com/docs/time-machine.html) for more details. **Note:** In order to use Time Machine via API , you need to first "enable" the Time Travel option which is available under **Settings** \\> **Configure Chargebee** \\> **Time Machine**. |

```ts theme={null}
{
  name?: string | null,
  time_travel_status?: string | null,
  genesis_time?: number | null,
  destination_time?: number | null,
  failure_code?: string | null,
  failure_reason?: string | null,
  error_json?: string | null
} | null
```

***

### travelForward

`timeMachines.travelForward`

Travel forward. in time. This operation is asynchronous . You need to check if the "start afresh" operation has completed by checking if the time travel status is successful by retrieving the time machine in a loop with a minimum delay of 3 secs between two retrieve requests. Test sites only: moves the site's clock forward and runs every billing event in between.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.timeMachines.travelForward({ timeMachineName: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `timeMachineName` | `string` | Yes | — |
| `destination_time` | `number` | No | The **time** to travel to. Should be between the 'current' destination time of the time machine and present time. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `time_machine` | `object \| null` | No | Time Machine is a simulation feature which imitates the key characteristics, behaviours and functions of the billing configurations. It is a virtual time travelling tool which facilitates the integration testing process by carrying out subscription renewals, dunning, webhooks etc on a hypothetical time frame. You can use Time Machine in the test site to verify if the billing rules configured in your site adhere to your expectations before executing them in real time. This feature can be used in both API and UI versions. View this [doc](https://www.chargebee.com/docs/time-machine.html) for more details. **Note:** In order to use Time Machine via API , you need to first "enable" the Time Travel option which is available under **Settings** \\> **Configure Chargebee** \\> **Time Machine**. |

```ts theme={null}
{
  name?: string | null,
  time_travel_status?: string | null,
  genesis_time?: number | null,
  destination_time?: number | null,
  failure_code?: string | null,
  failure_reason?: string | null,
  error_json?: string | null
} | null
```

***

## Tokens

### createForCard

`tokens.createForCard`

Create a card payment method token. Generate a token that holds card related information.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.tokens.createForCard({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `browser_details` | `object` | No | — |
| `card` | `object` | No | Parameters for card |

```ts theme={null}
{
}
```

```ts theme={null}
{
  gateway_account_id?: string,
  first_name?: string,
  last_name?: string,
  number: string,
  expiry_month: number,
  expiry_year: number,
  cvv?: string,
  preferred_scheme?: cartes_bancaires | mastercard | visa | dankort,
  billing_addr1?: string,
  billing_addr2?: string,
  billing_city?: string,
  billing_state_code?: string,
  billing_state?: string,
  billing_zip?: string,
  billing_country?: string,
  additional_information?: {
  },
  card_type?: visa | mastercard | american_express | discover | jcb | diners_club | bancontact | cmr_falabella | tarjeta_naranja | nativa | cencosud | cabal | argencard | elo | hipercard | carnet | rupay | maestro | dankort | cartes_bancaires | mada | other | not_applicable,
  email?: string
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `token` | `object \| null` | No | Tokenization hides sensitive payment information into a unique token for a secure transaction. The token does not expose any actual payment details. |

```ts theme={null}
{
  id?: string | null,
  gateway?: string | null,
  gateway_account_id?: string | null,
  payment_method_type?: string | null,
  status?: string | null,
  id_at_vault?: string | null,
  vault?: string | null,
  ip_address?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  created_at?: number | null,
  expired_at?: number | null
} | null
```

***

### createUsingTempToken

`tokens.createUsingTempToken`

Create using vault temp token. Generate a token using the one time token created by payment gateways for any specific payment method.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.tokens.createUsingTempToken({ id_at_vault: 'example', payment_method_type: 'card' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `gateway_account_id` | `string` | No | The gateway account to which the token is associated. |
| `payment_method_type` | `card \| paypal_express_checkout \| amazon_payments \| direct_debit \| generic \| alipay \| unionpay \| apple_pay \| wechat_pay \| ideal \| google_pay \| sofort \| bancontact \| giropay \| dotpay \| upi \| netbanking_emandates \| venmo \| pay_to \| faster_payments \| sepa_instant_transfer \| automated_bank_transfer \| klarna_pay_now \| online_banking_poland \| payconiq_by_bancontact \| electronic_payment_standard \| kbc_payment_button \| pay_by_bank \| trustly \| stablecoin \| kakao_pay \| naver_pay \| revolut_pay \| cash_app_pay \| twint \| go_pay \| grab_pay \| pay_co \| after_pay \| swish \| payme \| pix \| klarna \| alipay_hk \| paypay \| gcash \| south_korean_cards \| paynow \| bizum \| promptpay \| dana \| touch_n_go \| tamara \| qpay \| ovo \| momo \| mercado_pago \| nequi \| nupay \| picpay \| thai_qr \| blik \| fpx \| wero \| p24 \| affirm_pay \| rakuten_pay` | Yes | Type of payment method of the token. \* google\_pay - Payments made via Google Pay. \* pay\_co - Payments made via PayCo \* tamara - Payments made via Tamara. \* alipay\_hk - Payments made via Alipay HK. \* ovo - Payments made via OVO. \* apple\_pay - Payments made via Apple Pay. \* unionpay - Payments made via UnionPay. \* ideal - Payments made via iDEAL. \* bancontact - Payments made via Bancontact Card. \* nequi - Payments made via Nequi. \* netbanking\_emandates - Netbanking (eMandates) Payments. \* trustly - Trustly \* after\_pay - Payments made via Afterpay \* alipay - Payments made via Alipay. This payment source is deprecated. \* picpay - Payments made via PicPay. \* dotpay - Payments made via Dotpay. \* giropay - Payments made via giropay. \* fpx - Payments made via FPX. \* sofort - Payments made via Sofort. \* momo - Payments made via MoMo. \* gcash - Payments made via GCash. \* mercado\_pago - Payments made via Mercado Pago. \* nupay - Payments made via NuPay. \* blik - Payments made via BLIK. \* direct\_debit - Represents bank account for which the direct debit or ACH agreement/mandate is created. \* dana - Payments made via Dana. \* paypal\_express\_checkout - Payments made via PayPal Express Checkout. \* touch\_n\_go - Payments made via Touch 'n Go. \* rakuten\_pay - Payments made via Rakuten Pay. \* qpay - Payments made via Qpay. \* amazon\_payments - Payments made via Amazon Payments. \* electronic\_payment\_standard - Electronic Payment Standard \* grab\_pay - Payments made via GrabPay \* card - Card based payment including credit cards and debit cards. Details about the card can be obtained from the card resource. \* upi - UPI Payments. \* affirm\_pay - Payments made via Affirm Pay. \* p24 - Payments made via Przelewy24 (P24). \* thai\_qr - Payments made via Thai QR. \* wero - Payments made via Wero. \* pay\_by\_bank - Pay By Bank \* go\_pay - Payments made via GoPay \* swish - Payments made via Swish \* twint - Payments made via Twint \* generic - Payments made via Generic Payment Method. \* payme - Payments made via PayMe \* wechat\_pay - Payments made via WeChat Pay. This payment source is deprecated. \* kbc\_payment\_button - KBC Payment Button |
| `id_at_vault` | `string` | Yes | Single-use token created by payment gateways. In Stripe, a single-use token is created for Apple Pay Wallet, card details or direct debit. In Braintree, a nonce is created for Apple Pay Wallet, PayPal, or card details. In Authorize.net, a nonce is created for card details. In Adyen, an encrypted data is created from the card details. |
| `gw_obj_type` | `string` | No | Represents what type of object at gateway eg. "token" in case Stripe token and "source" in case of Stripe Source. |
| `currency_code` | `string` | No | Used to derieve Bank Account Scheme by default will take site default currency. |
| `additional_information` | `object` | No | \* `checkout_com`: While adding a new payment method using [permanent token](https://docs.corsair.dev/docs/api/payment_sources/create-using-permanent-token) or passing raw card details to Checkout.com, `document` ID and `country_of_residence` are required to support payments through [dLocal](https://www.checkout.com/docs/previous/payments/payment-methods/cards/dlocal). \* `payer`: User related information. \* `country_of_residence`: This is required since the billing country associated with the user's payment method may not be the same as their country of residence. Hence the user's country of residence needs to be specified. The country code should be a [two-character ISO code](https://docs.checkout.com/resources/codes/country-codes). \* `document`: Document ID is the user's [identification number](https://docs.dlocal.com/api-documentation/payins-api-reference/country-reference#documents) based on their country. \* `bluesnap`: While passing raw card details to BlueSnap, if `fraud_session_id` is added, [additional validation](https://developers.bluesnap.com/docs/fraud-prevention) is performed to avoid fraudulent transactions. \* `fraud`: Fraud identification related information. \* `fraud_session_id`: Your [BlueSnap fraud session ID](https://developers.bluesnap.com/docs/fraud-prevention#section-implementing-device-data-collector) required to perform anti-fraud validation. \* `braintree`: While passing raw card details to Braintree, your `fraud_merchant_id` and the user's `device_session_id` can be added to perform [additional validation](https://developers.braintreepayments.com/guides/premium-fraud-management-tools/device-data-collection/javascript/v3#collecting-device-data) and avoid fraudulent transactions. \* `fraud`: Fraud identification related information. \* `device_session_id`: Session ID associated with the user's device. \* `fraud_merchant_id`: Your [merchant ID](https://developers.braintreepayments.com/guides/premium-fraud-management-tools/device-data-collection/javascript/v3#collecting-device-data) for fraud detection. \* `chargebee_payments`: While passing raw card details to Chargebee Payments, if `fraud_session_id` is added, additional validation is performed to avoid fraudulent transactions. \* `fraud`: Fraud identification related information. \* `fraud_session_id`: Your Chargebee Payments fraud session ID required to perform anti-fraud validation. \* `bank_of_america`: While passing raw card details to Bank of America, your user's `device_session_id` can be added to perform additional validation and avoid fraudulent transactions. \* `fraud`: Fraud identification related information. \* `device_session_id`: Session ID associated with the user's device. \* `ecentric`: This parameter is used to verify and process payment method details in Ecentric. If the `merchant_id` parameter is included, Chargebee will vault it / perform a lookup and verification against this `merchant_id`, overriding the one configured in Chargebee. If tokens and processing occur in the same Merchant GUID, you can just skip this part. \* `merchant_id`: Merchant GUID where the card is vaulted or need to be vaulted. \* `ebanx`: While passing raw card details to EBANX, the user's `document` is required for some countries and `device_session_id` can be added to perform [additional validation](https://developer.ebanx.com/docs/payments/guides/features/device-fingerprint#device-fingerprint) and avoid fraudulent transactions. \* `payer`: User related information. \* `document`: Document is the user's identification number based on their country. \* `fraud`: Fraud identification related information. \* `device_session_id`: Session ID associated with the user's device . |
| `browser_details` | `object` | No | — |
| `token_additional_detail` | `object` | No | Parameters for token\_additional\_detail |
| `token_billing_address` | `object` | No | Parameters for token\_billing\_address |

```ts theme={null}
{
}
```

```ts theme={null}
{
}
```

```ts theme={null}
{
  first_name?: string,
  last_name?: string,
  expiry_month?: number,
  expiry_year?: number
}
```

```ts theme={null}
{
  line1?: string,
  line2?: string,
  city?: string,
  state?: string,
  state_code?: string,
  country_code?: string,
  zip?: string
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `token` | `object \| null` | No | Tokenization hides sensitive payment information into a unique token for a secure transaction. The token does not expose any actual payment details. |

```ts theme={null}
{
  id?: string | null,
  gateway?: string | null,
  gateway_account_id?: string | null,
  payment_method_type?: string | null,
  status?: string | null,
  id_at_vault?: string | null,
  vault?: string | null,
  ip_address?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  created_at?: number | null,
  expired_at?: number | null
} | null
```

***

### get

`tokens.get`

Retrieve a token. using token ID. (GET /tokens/\{cb-token-id})

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.tokens.get({ cbTokenId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `cbTokenId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `token` | `object \| null` | No | Tokenization hides sensitive payment information into a unique token for a secure transaction. The token does not expose any actual payment details. |

```ts theme={null}
{
  id?: string | null,
  gateway?: string | null,
  gateway_account_id?: string | null,
  payment_method_type?: string | null,
  status?: string | null,
  id_at_vault?: string | null,
  vault?: string | null,
  ip_address?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  created_at?: number | null,
  expired_at?: number | null
} | null
```

***

## Transactions

### createAuthorization

`transactions.createAuthorization`

Create an authorization payment. Authorizes a specific amount in customer's Credit card, which can be collected within a span of time. Read more on authorization and capture here. \* Supported only for Card payments. \* Currently supported only for Stripe.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.transactions.createAuthorization({ amount: 1, customer_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customer_id` | `string` | Yes | Identifier of the customer. |
| `payment_source_id` | `string` | No | Payment source to be used for authorizing the transaction. |
| `currency_code` | `string` | No | The currency code (ISO 4217 format) of the transaction amount. |
| `amount` | `number` | Yes | The amount to be blocked. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `transaction` | `object \| null` | No | This resource represents the [transaction](https://www.chargebee.com/docs/transactions.html) event that has happened in your account. |

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  subscription_id?: string | null,
  gateway_account_id?: string | null,
  payment_source_id?: string | null,
  payment_method?: string | null,
  reference_number?: string | null,
  gateway?: string | null,
  type?: string | null,
  date?: number | null,
  settled_at?: number | null,
  exchange_rate?: number | null,
  currency_code?: string | null,
  amount?: number | null,
  id_at_gateway?: string | null,
  status?: string | null,
  fraud_flag?: string | null,
  initiator_type?: string | null,
  three_d_secure?: boolean | null,
  authorization_reason?: string | null,
  error_code?: string | null,
  error_text?: string | null,
  voided_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  fraud_reason?: string | null,
  custom_payment_method_id?: string | null,
  amount_unused?: number | null,
  masked_card_number?: string | null,
  reference_transaction_id?: string | null,
  refunded_txn_id?: string | null,
  reference_authorization_id?: string | null,
  amount_capturable?: number | null,
  reversal_transaction_id?: string | null,
  deleted?: boolean | null,
  iin?: string | null,
  last4?: string | null,
  merchant_reference_id?: string | null,
  business_entity_id?: string | null,
  payment_method_details?: string | null,
  custom_payment_method_name?: string | null,
  linked_invoices?: {
    invoice_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    invoice_date?: number | null,
    invoice_total?: number | null,
    invoice_status?: string | null
  }[] | null,
  linked_credit_notes?: {
    cn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_total?: number | null,
    cn_status?: string | null,
    cn_reference_invoice_id?: string | null
  }[] | null,
  linked_refunds?: {
    txn_id?: string | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null
  }[] | null,
  linked_payments?: {
    id?: string | null,
    status?: string | null,
    amount?: number | null,
    date?: number | null
  }[] | null,
  gateway_metadata?: {
    acquirer_reference_id?: string | null
  } | null,
  error_detail?: {
    request_id?: string | null,
    error_category?: string | null,
    error_code?: string | null,
    error_message?: string | null,
    decline_code?: string | null,
    decline_message?: string | null,
    network_error_code?: string | null,
    network_error_message?: string | null,
    error_field?: string | null,
    recommendation_code?: string | null,
    recommendation_message?: string | null,
    processor_error_code?: string | null,
    processor_error_message?: string | null,
    error_cause_id?: string | null,
    processor_advice_code?: string | null
  } | null,
  network_transaction_details?: {
    network_transaction_id?: string | null,
    original_network_transaction_id?: string | null
  } | null
} | null
```

***

### deleteOfflineTransaction

`transactions.deleteOfflineTransaction`

Delete an offline transaction. This API deletes an offline transaction. However, to delete an offline transaction all payment allocations associated with the transaction must be removed.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.transactions.deleteOfflineTransaction({ transactionId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `transactionId` | `string` | Yes | — |
| `comment` | `string` | No | An internal [comment](https://docs.corsair.dev/docs/api/comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](https://docs.corsair.dev/docs/api/hosted_pages) or any document such as the [Invoice PDF](https://docs.corsair.dev/docs/api/invoices/retrieve-invoice-as-pdf) . |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `transaction` | `object \| null` | No | This resource represents the [transaction](https://www.chargebee.com/docs/transactions.html) event that has happened in your account. |

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  subscription_id?: string | null,
  gateway_account_id?: string | null,
  payment_source_id?: string | null,
  payment_method?: string | null,
  reference_number?: string | null,
  gateway?: string | null,
  type?: string | null,
  date?: number | null,
  settled_at?: number | null,
  exchange_rate?: number | null,
  currency_code?: string | null,
  amount?: number | null,
  id_at_gateway?: string | null,
  status?: string | null,
  fraud_flag?: string | null,
  initiator_type?: string | null,
  three_d_secure?: boolean | null,
  authorization_reason?: string | null,
  error_code?: string | null,
  error_text?: string | null,
  voided_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  fraud_reason?: string | null,
  custom_payment_method_id?: string | null,
  amount_unused?: number | null,
  masked_card_number?: string | null,
  reference_transaction_id?: string | null,
  refunded_txn_id?: string | null,
  reference_authorization_id?: string | null,
  amount_capturable?: number | null,
  reversal_transaction_id?: string | null,
  deleted?: boolean | null,
  iin?: string | null,
  last4?: string | null,
  merchant_reference_id?: string | null,
  business_entity_id?: string | null,
  payment_method_details?: string | null,
  custom_payment_method_name?: string | null,
  linked_invoices?: {
    invoice_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    invoice_date?: number | null,
    invoice_total?: number | null,
    invoice_status?: string | null
  }[] | null,
  linked_credit_notes?: {
    cn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_total?: number | null,
    cn_status?: string | null,
    cn_reference_invoice_id?: string | null
  }[] | null,
  linked_refunds?: {
    txn_id?: string | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null
  }[] | null,
  linked_payments?: {
    id?: string | null,
    status?: string | null,
    amount?: number | null,
    date?: number | null
  }[] | null,
  gateway_metadata?: {
    acquirer_reference_id?: string | null
  } | null,
  error_detail?: {
    request_id?: string | null,
    error_category?: string | null,
    error_code?: string | null,
    error_message?: string | null,
    decline_code?: string | null,
    decline_message?: string | null,
    network_error_code?: string | null,
    network_error_message?: string | null,
    error_field?: string | null,
    recommendation_code?: string | null,
    recommendation_message?: string | null,
    processor_error_code?: string | null,
    processor_error_message?: string | null,
    error_cause_id?: string | null,
    processor_advice_code?: string | null
  } | null,
  network_transaction_details?: {
    network_transaction_id?: string | null,
    original_network_transaction_id?: string | null
  } | null
} | null
```

***

### get

`transactions.get`

Retrieve a transaction. identified by its unique id.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.transactions.get({ transactionId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `transactionId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `transaction` | `object \| null` | No | This resource represents the [transaction](https://www.chargebee.com/docs/transactions.html) event that has happened in your account. |

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  subscription_id?: string | null,
  gateway_account_id?: string | null,
  payment_source_id?: string | null,
  payment_method?: string | null,
  reference_number?: string | null,
  gateway?: string | null,
  type?: string | null,
  date?: number | null,
  settled_at?: number | null,
  exchange_rate?: number | null,
  currency_code?: string | null,
  amount?: number | null,
  id_at_gateway?: string | null,
  status?: string | null,
  fraud_flag?: string | null,
  initiator_type?: string | null,
  three_d_secure?: boolean | null,
  authorization_reason?: string | null,
  error_code?: string | null,
  error_text?: string | null,
  voided_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  fraud_reason?: string | null,
  custom_payment_method_id?: string | null,
  amount_unused?: number | null,
  masked_card_number?: string | null,
  reference_transaction_id?: string | null,
  refunded_txn_id?: string | null,
  reference_authorization_id?: string | null,
  amount_capturable?: number | null,
  reversal_transaction_id?: string | null,
  deleted?: boolean | null,
  iin?: string | null,
  last4?: string | null,
  merchant_reference_id?: string | null,
  business_entity_id?: string | null,
  payment_method_details?: string | null,
  custom_payment_method_name?: string | null,
  linked_invoices?: {
    invoice_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    invoice_date?: number | null,
    invoice_total?: number | null,
    invoice_status?: string | null
  }[] | null,
  linked_credit_notes?: {
    cn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_total?: number | null,
    cn_status?: string | null,
    cn_reference_invoice_id?: string | null
  }[] | null,
  linked_refunds?: {
    txn_id?: string | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null
  }[] | null,
  linked_payments?: {
    id?: string | null,
    status?: string | null,
    amount?: number | null,
    date?: number | null
  }[] | null,
  gateway_metadata?: {
    acquirer_reference_id?: string | null
  } | null,
  error_detail?: {
    request_id?: string | null,
    error_category?: string | null,
    error_code?: string | null,
    error_message?: string | null,
    decline_code?: string | null,
    decline_message?: string | null,
    network_error_code?: string | null,
    network_error_message?: string | null,
    error_field?: string | null,
    recommendation_code?: string | null,
    recommendation_message?: string | null,
    processor_error_code?: string | null,
    processor_error_message?: string | null,
    error_cause_id?: string | null,
    processor_advice_code?: string | null
  } | null,
  network_transaction_details?: {
    network_transaction_id?: string | null,
    original_network_transaction_id?: string | null
  } | null
} | null
```

***

### list

`transactions.list`

List transactions. Lists all the transactions. Note: For better query performance, we recommend using a date filter (for example, date\[after] or date\[between]) when listing transactions. If you are already filtering by updated\_at, you do not need to also filter by date.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.transactions.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `include_deleted` | `boolean` | No | If set to true, includes the deleted resources in the response. For the deleted resources in the response, the '**deleted** ' attribute will be '**true** '. |
| `id` | `object` | No | optional, string filter Uniquely identifies the transaction. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *id\\\[is\\] = "txn\_88ybdbsnvf2"* |
| `customer_id` | `object` | No | optional, string filter Identifier of the customer for which this transaction is made. **Supported operators :** is, is\_not, starts\_with, is\_present, in, not\_in **Example →** *customer\_id\\\[is\\] = "5hjdk8nOpd"* |
| `subscription_id` | `object` | No | optional, string filter Identifier of the subscription for which this transaction is made. **Supported operators :** is, is\_not, starts\_with, is\_present, in, not\_in **Example →** *subscription\_id\\\[is\\] = "5hjdk8nOpd"* |
| `payment_source_id` | `object` | No | optional, string filter To filter based on Transaction payment source id. **Supported operators :** is, is\_not, starts\_with, is\_present, in, not\_in **Example →** *payment\_source\_id\\\[is\\] = "pm\_3Nl8XXUQUXDVFa2"* |
| `payment_method` | `object` | No | optional, enumerated string filter The payment method of this transaction. Possible values are : card, cash, check, chargeback, bank\_transfer, amazon\_payments, paypal\_express\_checkout, direct\_debit, alipay, alipay\_hk, gcash, ovo, momo, mercado\_pago, nequi, nupay, picpay, thai\_qr, blik, fpx, wero, p24, affirm\_pay, rakuten\_pay, dana, touch\_n\_go, tamara, qpay, unionpay, apple\_pay, wechat\_pay, ach\_credit, sepa\_credit, ideal, google\_pay, sofort, bancontact, giropay, dotpay, other, upi, netbanking\_emandates. **Supported operators :** is, is\_not, in, not\_in **Example →** *payment\_method\\\[is\_not\\] = "card"* |
| `gateway` | `object` | No | optional, enumerated string filter Gateway through which this transaction was done. Applicable only for 'Card' Payment Method. Possible values are : chargebee, chargebee\_payments, stripe, wepay, braintree, authorize\_net, paypal\_pro, pin, eway, eway\_rapid, worldpay, balanced\_payments, beanstream, bluepay, elavon, first\_data\_global, hdfc, migs, nmi, ogone, paymill, paypal\_payflow\_pro, sage\_pay, tco, wirecard, amazon\_payments, paypal\_express\_checkout, gocardless, adyen, orbital, moneris\_us, moneris, bluesnap, cybersource, vantiv, checkout\_com, paypal, ingenico\_direct, exact, mollie, quickbooks, razorpay, payu, not\_applicable. **Supported operators :** is, is\_not, in, not\_in **Example →** *gateway\\\[is\\] = "stripe"* |
| `gateway_account_id` | `object` | No | optional, string filter The gateway account used for this transaction. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *gateway\_account\_id\\\[is\\] = "gw\_3Nl9BNeQ7438Ks1"* |
| `id_at_gateway` | `object` | No | optional, string filter The id with which this transaction is referred in gateway. **Supported operators :** is, is\_not, starts\_with **Example →** *id\_at\_gateway\\\[is\_not\\] = "txn\_5678HJS89900"* |
| `reference_number` | `object` | No | optional, string filter The reference number for this transaction. For example, the check number when [payment\_method](https://docs.corsair.dev/docs/api/transactions/transaction-object#payment_method) = `check` . **Supported operators :** is, is\_not, starts\_with, is\_present **Example →** *reference\_number\\\[is\\] = "cus\_u239732"* |
| `type` | `object` | No | optional, enumerated string filter Type of the transaction. Possible values are : authorization, payment, refund, payment\_reversal. **Supported operators :** is, is\_not, in, not\_in **Example →** *type\\\[is\_not\\] = "payment"* |
| `date` | `object` | No | optional, timestamp(UTC) in seconds filter Indicates when this transaction occurred. We recommend using this filter when listing transactions for better query performance. It is advisable when using this filter, to pass the `sort_by` input parameter as `date` for a faster response. **Supported operators :** after, before, on, between **Example →** *date\\\[before\\] = "1435054328"* |
| `amount` | `object` | No | optional, in cents filter Amount for this transaction. **Supported operators :** is, is\_not, lt, lte, gt, gte, between **Example →** *amount\\\[gt\\] = "1200"* |
| `amount_capturable` | `object` | No | optional, in cents filter To filter based on transaction's unused authorized/blocked amount. **Supported operators :** is, is\_not, lt, lte, gt, gte, between **Example →** *amount\_capturable\\\[lt\\] = "1200"* |
| `status` | `object` | No | optional, enumerated string filter The status of this transaction. Possible values are : in\_progress, success, voided, failure, timeout, needs\_attention. **Supported operators :** is, is\_not, in, not\_in **Example →** *status\\\[is\\] = "success"* |
| `updated_at` | `object` | No | optional, timestamp(UTC) in seconds filter To filter based on `updated_at`. This attribute will be present only if the resource has been updated after 2016-09-28. It is advisable when using this filter, to pass the `sort_by` input parameter as `updated_at` for a faster response. **Supported operators :** after, before, on, between **Example →** *updated\_at\\\[after\\] = "1243545465"* |
| `sort_by` | `object` | No | optional, string filter Sorts based on the specified attribute. **Supported attributes :** date, updated\_at **Supported sort-orders :** asc, desc **Example →** *sort\_by\\\[asc\\] = "date"* This will sort the result based on the 'date' attribute in ascending(earliest first) order. |

```ts theme={null}
{
  is?: string,
  is_not?: string,
  starts_with?: string,
  in?: string,
  not_in?: string
}
```

```ts theme={null}
{
  is?: string,
  is_not?: string,
  starts_with?: string,
  is_present?: true | false,
  in?: string,
  not_in?: string
}
```

```ts theme={null}
{
  is?: string,
  is_not?: string,
  starts_with?: string,
  is_present?: true | false,
  in?: string,
  not_in?: string
}
```

```ts theme={null}
{
  is?: string,
  is_not?: string,
  starts_with?: string,
  is_present?: true | false,
  in?: string,
  not_in?: string
}
```

```ts theme={null}
{
  is?: card | cash | check | chargeback | bank_transfer | amazon_payments | paypal_express_checkout | direct_debit | alipay | unionpay | apple_pay | wechat_pay | ach_credit | sepa_credit | ideal | google_pay | sofort | bancontact | giropay | dotpay | other | upi | netbanking_emandates | custom | boleto | venmo | pay_to | faster_payments | sepa_instant_transfer | automated_bank_transfer | klarna_pay_now | online_banking_poland | payconiq_by_bancontact | electronic_payment_standard | kbc_payment_button | pay_by_bank | trustly | stablecoin | kakao_pay | naver_pay | revolut_pay | cash_app_pay | pix | twint | go_pay | grab_pay | pay_co | after_pay | swish | payme | klarna | alipay_hk | paypay | gcash | south_korean_cards | paynow | bizum | promptpay | dana | touch_n_go | tamara | qpay | ovo | momo | mercado_pago | nequi | nupay | picpay | thai_qr | blik | fpx | wero | p24 | affirm_pay | rakuten_pay,
  is_not?: card | cash | check | chargeback | bank_transfer | amazon_payments | paypal_express_checkout | direct_debit | alipay | unionpay | apple_pay | wechat_pay | ach_credit | sepa_credit | ideal | google_pay | sofort | bancontact | giropay | dotpay | other | upi | netbanking_emandates | custom | boleto | venmo | pay_to | faster_payments | sepa_instant_transfer | automated_bank_transfer | klarna_pay_now | online_banking_poland | payconiq_by_bancontact | electronic_payment_standard | kbc_payment_button | pay_by_bank | trustly | stablecoin | kakao_pay | naver_pay | revolut_pay | cash_app_pay | pix | twint | go_pay | grab_pay | pay_co | after_pay | swish | payme | klarna | alipay_hk | paypay | gcash | south_korean_cards | paynow | bizum | promptpay | dana | touch_n_go | tamara | qpay | ovo | momo | mercado_pago | nequi | nupay | picpay | thai_qr | blik | fpx | wero | p24 | affirm_pay | rakuten_pay,
  in?: string,
  not_in?: string
}
```

```ts theme={null}
{
  is?: chargebee | chargebee_payments | adyen | stripe | wepay | braintree | authorize_net | paypal_pro | pin | eway | eway_rapid | worldpay | balanced_payments | beanstream | bluepay | elavon | first_data_global | hdfc | migs | nmi | ogone | paymill | paypal_payflow_pro | sage_pay | tco | wirecard | amazon_payments | paypal_express_checkout | gocardless | orbital | moneris_us | moneris | bluesnap | cybersource | vantiv | checkout_com | paypal | ingenico_direct | exact | mollie | quickbooks | razorpay | global_payments | bank_of_america | ecentric | metrics_global | windcave | pay_com | ebanx | dlocal | nuvei | solidgate | paystack | jp_morgan | deutsche_bank | ezidebit | twikey | tempus | moyasar | payway | payu | not_applicable,
  is_not?: chargebee | chargebee_payments | adyen | stripe | wepay | braintree | authorize_net | paypal_pro | pin | eway | eway_rapid | worldpay | balanced_payments | beanstream | bluepay | elavon | first_data_global | hdfc | migs | nmi | ogone | paymill | paypal_payflow_pro | sage_pay | tco | wirecard | amazon_payments | paypal_express_checkout | gocardless | orbital | moneris_us | moneris | bluesnap | cybersource | vantiv | checkout_com | paypal | ingenico_direct | exact | mollie | quickbooks | razorpay | global_payments | bank_of_america | ecentric | metrics_global | windcave | pay_com | ebanx | dlocal | nuvei | solidgate | paystack | jp_morgan | deutsche_bank | ezidebit | twikey | tempus | moyasar | payway | payu | not_applicable,
  in?: string,
  not_in?: string
}
```

```ts theme={null}
{
  is?: string,
  is_not?: string,
  starts_with?: string,
  in?: string,
  not_in?: string
}
```

```ts theme={null}
{
  is?: string,
  is_not?: string,
  starts_with?: string
}
```

```ts theme={null}
{
  is?: string,
  is_not?: string,
  starts_with?: string,
  is_present?: true | false
}
```

```ts theme={null}
{
  is?: authorization | payment | refund | payment_reversal,
  is_not?: authorization | payment | refund | payment_reversal,
  in?: string,
  not_in?: string
}
```

```ts theme={null}
{
  after?: string,
  before?: string,
  on?: string,
  between?: string
}
```

```ts theme={null}
{
  is?: string,
  is_not?: string,
  lt?: string,
  lte?: string,
  gt?: string,
  gte?: string,
  between?: string
}
```

```ts theme={null}
{
  is?: string,
  is_not?: string,
  lt?: string,
  lte?: string,
  gt?: string,
  gte?: string,
  between?: string
}
```

```ts theme={null}
{
  is?: in_progress | success | voided | failure | timeout | needs_attention | late_failure,
  is_not?: in_progress | success | voided | failure | timeout | needs_attention | late_failure,
  in?: string,
  not_in?: string
}
```

```ts theme={null}
{
  after?: string,
  before?: string,
  on?: string,
  between?: string
}
```

```ts theme={null}
{
  asc?: date | updated_at,
  desc?: date | updated_at
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

```ts theme={null}
{
  transaction?: {
    id?: string | null,
    customer_id?: string | null,
    subscription_id?: string | null,
    gateway_account_id?: string | null,
    payment_source_id?: string | null,
    payment_method?: string | null,
    reference_number?: string | null,
    gateway?: string | null,
    type?: string | null,
    date?: number | null,
    settled_at?: number | null,
    exchange_rate?: number | null,
    currency_code?: string | null,
    amount?: number | null,
    id_at_gateway?: string | null,
    status?: string | null,
    fraud_flag?: string | null,
    initiator_type?: string | null,
    three_d_secure?: boolean | null,
    authorization_reason?: string | null,
    error_code?: string | null,
    error_text?: string | null,
    voided_at?: number | null,
    resource_version?: number | null,
    updated_at?: number | null,
    fraud_reason?: string | null,
    custom_payment_method_id?: string | null,
    amount_unused?: number | null,
    masked_card_number?: string | null,
    reference_transaction_id?: string | null,
    refunded_txn_id?: string | null,
    reference_authorization_id?: string | null,
    amount_capturable?: number | null,
    reversal_transaction_id?: string | null,
    deleted?: boolean | null,
    iin?: string | null,
    last4?: string | null,
    merchant_reference_id?: string | null,
    business_entity_id?: string | null,
    payment_method_details?: string | null,
    custom_payment_method_name?: string | null,
    linked_invoices?: {
      invoice_id?: string | null,
      applied_amount?: number | null,
      applied_at?: number | null,
      invoice_date?: number | null,
      invoice_total?: number | null,
      invoice_status?: string | null
    }[] | null,
    linked_credit_notes?: {
      cn_id?: string | null,
      applied_amount?: number | null,
      applied_at?: number | null,
      cn_reason_code?: string | null,
      cn_create_reason_code?: string | null,
      cn_date?: number | null,
      cn_total?: number | null,
      cn_status?: string | null,
      cn_reference_invoice_id?: string | null
    }[] | null,
    linked_refunds?: {
      txn_id?: string | null,
      txn_status?: string | null,
      txn_date?: number | null,
      txn_amount?: number | null
    }[] | null,
    linked_payments?: {
      id?: string | null,
      status?: string | null,
      amount?: number | null,
      date?: number | null
    }[] | null,
    gateway_metadata?: {
      acquirer_reference_id?: string | null
    } | null,
    error_detail?: {
      request_id?: string | null,
      error_category?: string | null,
      error_code?: string | null,
      error_message?: string | null,
      decline_code?: string | null,
      decline_message?: string | null,
      network_error_code?: string | null,
      network_error_message?: string | null,
      error_field?: string | null,
      recommendation_code?: string | null,
      recommendation_message?: string | null,
      processor_error_code?: string | null,
      processor_error_message?: string | null,
      error_cause_id?: string | null,
      processor_advice_code?: string | null
    } | null,
    network_transaction_details?: {
      network_transaction_id?: string | null,
      original_network_transaction_id?: string | null
    } | null
  } | null
}[] | null
```

***

### reconcile

`transactions.reconcile`

Reconcile transaction. Update selected attributes of the transaction resource: status, id\_at\_gateway, and customer\_id. Use this API for reconciliation purposes where the status of a transaction is in needs\_attention that can be updated to either success or failure status.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.transactions.reconcile({ transactionId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `transactionId` | `string` | Yes | — |
| `id_at_gateway` | `string` | No | The identifier with which this transaction is referred in gateway. The `id_at_gateway` can only be updated when the transaction status is in [needs\_attention](https://docs.corsair.dev/docs/api/transactions/transaction-object#status). **Note**: \* It is mandatory to pass this parameter value for updating the transaction status from `needs_attention` to `success`. It is recommended to pass this value if available in the gateway. \* An error occurs when the provided `id_at_gateway` value does not match the `id_at_gateway` value stored against the transaction in Chargebee. |
| `customer_id` | `string` | No | Unique identifier of the customer for which this transaction is made. This is needed only when the transaction is successful but not associated with any customer. **Note**: An error occurs when the provided `customer_id` value does not match the `customer_id` value stored against the transaction in Chargebee. |
| `status` | `success \| failure` | No | The status of this transaction. The status can only be updated when the transaction status is in [needs\_attention](https://docs.corsair.dev/docs/api/transactions/transaction-object#status) state. \* failure - When the transaction is in failure status. **Note**: When the transaction is updated to [failure](https://docs.corsair.dev/docs/api/transactions/transaction-object#status) status and the invoice is associated with the transaction, \* the invoice will be moved to the [payment\_due](https://docs.corsair.dev/docs/api/invoices/invoice-object#status) status if the [dunning](https://www.chargebee.com/docs/payments/2.0/dunning-v2.html) is configured. \* the invoice will be moved to the [not\_paid](https://docs.corsair.dev/docs/api/invoices/invoice-object#status) status if the [dunning](https://www.chargebee.com/docs/payments/2.0/dunning-v2.html) is not configured. \* success - When the transaction is successful. **Note**: When the transaction is updated to [success](https://docs.corsair.dev/docs/api/transactions/transaction-object#status) status, - and the invoice is associated with the transaction, the transaction [amount](https://docs.corsair.dev/docs/api/transactions/transaction-object#amount) will be applied to the invoice. \* and no invoice is associated but the customer is associated with the transaction, [customer\_excess\_payments](https://docs.corsair.dev/docs/api/customers/customer-object#excess_payments) will be updated. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `transaction` | `object \| null` | No | This resource represents the [transaction](https://www.chargebee.com/docs/transactions.html) event that has happened in your account. |

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  subscription_id?: string | null,
  gateway_account_id?: string | null,
  payment_source_id?: string | null,
  payment_method?: string | null,
  reference_number?: string | null,
  gateway?: string | null,
  type?: string | null,
  date?: number | null,
  settled_at?: number | null,
  exchange_rate?: number | null,
  currency_code?: string | null,
  amount?: number | null,
  id_at_gateway?: string | null,
  status?: string | null,
  fraud_flag?: string | null,
  initiator_type?: string | null,
  three_d_secure?: boolean | null,
  authorization_reason?: string | null,
  error_code?: string | null,
  error_text?: string | null,
  voided_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  fraud_reason?: string | null,
  custom_payment_method_id?: string | null,
  amount_unused?: number | null,
  masked_card_number?: string | null,
  reference_transaction_id?: string | null,
  refunded_txn_id?: string | null,
  reference_authorization_id?: string | null,
  amount_capturable?: number | null,
  reversal_transaction_id?: string | null,
  deleted?: boolean | null,
  iin?: string | null,
  last4?: string | null,
  merchant_reference_id?: string | null,
  business_entity_id?: string | null,
  payment_method_details?: string | null,
  custom_payment_method_name?: string | null,
  linked_invoices?: {
    invoice_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    invoice_date?: number | null,
    invoice_total?: number | null,
    invoice_status?: string | null
  }[] | null,
  linked_credit_notes?: {
    cn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_total?: number | null,
    cn_status?: string | null,
    cn_reference_invoice_id?: string | null
  }[] | null,
  linked_refunds?: {
    txn_id?: string | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null
  }[] | null,
  linked_payments?: {
    id?: string | null,
    status?: string | null,
    amount?: number | null,
    date?: number | null
  }[] | null,
  gateway_metadata?: {
    acquirer_reference_id?: string | null
  } | null,
  error_detail?: {
    request_id?: string | null,
    error_category?: string | null,
    error_code?: string | null,
    error_message?: string | null,
    decline_code?: string | null,
    decline_message?: string | null,
    network_error_code?: string | null,
    network_error_message?: string | null,
    error_field?: string | null,
    recommendation_code?: string | null,
    recommendation_message?: string | null,
    processor_error_code?: string | null,
    processor_error_message?: string | null,
    error_cause_id?: string | null,
    processor_advice_code?: string | null
  } | null,
  network_transaction_details?: {
    network_transaction_id?: string | null,
    original_network_transaction_id?: string | null
  } | null
} | null
```

***

### recordRefund

`transactions.recordRefund`

Record an offline refund. Records a refund made offline. Applicable only for transactions of type = payment.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.transactions.recordRefund({ transactionId: 'example', date: 1, payment_method: 'cash' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `transactionId` | `string` | Yes | — |
| `amount` | `number` | No | The amount to be recorded as refunded. Must not exceed [amount\_unused](https://docs.corsair.dev/docs/api/transactions/transaction-object#amount_unused). If not passed then all of [amount\_unused](https://docs.corsair.dev/docs/api/transactions/transaction-object#amount_unused) is recorded as refunded. |
| `payment_method` | `cash \| check \| chargeback \| bank_transfer \| other \| custom` | Yes | The payment method used to make the refund. \* check - Check \* cash - Cash \* custom - Custom \* chargeback - Only applicable for a transaction of [type](https://docs.corsair.dev/docs/api/transactions/transaction-object#type) = `refund`. This value is set by Chargebee when an automated [chargeback](https://www.chargebee.com/docs/chargeback.html#chargeback-process) occurs. You can also set this explicitly when [recording a refund](https://docs.corsair.dev/docs/api/transactions/record-an-offline-refund) . \* other - Payment Methods other than the above types \* bank\_transfer - Bank Transfer |
| `date` | `number` | Yes | The date when the refund was made. |
| `reference_number` | `string` | No | The reference number for this transaction. For example, the check number when `payment_method` = `check` . |
| `custom_payment_method_id` | `string` | No | Identifier of the custom payment method of this transaction. |
| `comment` | `string` | No | Remarks, if any, on the refund. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `transaction` | `object \| null` | No | This resource represents the [transaction](https://www.chargebee.com/docs/transactions.html) event that has happened in your account. |

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  subscription_id?: string | null,
  gateway_account_id?: string | null,
  payment_source_id?: string | null,
  payment_method?: string | null,
  reference_number?: string | null,
  gateway?: string | null,
  type?: string | null,
  date?: number | null,
  settled_at?: number | null,
  exchange_rate?: number | null,
  currency_code?: string | null,
  amount?: number | null,
  id_at_gateway?: string | null,
  status?: string | null,
  fraud_flag?: string | null,
  initiator_type?: string | null,
  three_d_secure?: boolean | null,
  authorization_reason?: string | null,
  error_code?: string | null,
  error_text?: string | null,
  voided_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  fraud_reason?: string | null,
  custom_payment_method_id?: string | null,
  amount_unused?: number | null,
  masked_card_number?: string | null,
  reference_transaction_id?: string | null,
  refunded_txn_id?: string | null,
  reference_authorization_id?: string | null,
  amount_capturable?: number | null,
  reversal_transaction_id?: string | null,
  deleted?: boolean | null,
  iin?: string | null,
  last4?: string | null,
  merchant_reference_id?: string | null,
  business_entity_id?: string | null,
  payment_method_details?: string | null,
  custom_payment_method_name?: string | null,
  linked_invoices?: {
    invoice_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    invoice_date?: number | null,
    invoice_total?: number | null,
    invoice_status?: string | null
  }[] | null,
  linked_credit_notes?: {
    cn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_total?: number | null,
    cn_status?: string | null,
    cn_reference_invoice_id?: string | null
  }[] | null,
  linked_refunds?: {
    txn_id?: string | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null
  }[] | null,
  linked_payments?: {
    id?: string | null,
    status?: string | null,
    amount?: number | null,
    date?: number | null
  }[] | null,
  gateway_metadata?: {
    acquirer_reference_id?: string | null
  } | null,
  error_detail?: {
    request_id?: string | null,
    error_category?: string | null,
    error_code?: string | null,
    error_message?: string | null,
    decline_code?: string | null,
    decline_message?: string | null,
    network_error_code?: string | null,
    network_error_message?: string | null,
    error_field?: string | null,
    recommendation_code?: string | null,
    recommendation_message?: string | null,
    processor_error_code?: string | null,
    processor_error_message?: string | null,
    error_cause_id?: string | null,
    processor_advice_code?: string | null
  } | null,
  network_transaction_details?: {
    network_transaction_id?: string | null,
    original_network_transaction_id?: string | null
  } | null
} | null
```

***

### refund

`transactions.refund`

Refund a payment. Refunds an online payment. Applicable only for transactions of type = payment. You can only refund a transaction whose status is success. \* Not supported for ach\_credit, sepa\_credit, cash, check, bank\_transfer, other. \* Contact Chargebee Support to enable this endpoint.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.transactions.refund({ transactionId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `transactionId` | `string` | Yes | — |
| `amount` | `number` | No | The amount to be refunded. Must not exceed [amount\_unused](https://docs.corsair.dev/docs/api/transactions/transaction-object#amount_unused). If not passed then all of [amount\_unused](https://docs.corsair.dev/docs/api/transactions/transaction-object#amount_unused) is refunded. |
| `comment` | `string` | No | Remarks, if any, on the refund. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `transaction` | `object \| null` | No | This resource represents the [transaction](https://www.chargebee.com/docs/transactions.html) event that has happened in your account. |

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  subscription_id?: string | null,
  gateway_account_id?: string | null,
  payment_source_id?: string | null,
  payment_method?: string | null,
  reference_number?: string | null,
  gateway?: string | null,
  type?: string | null,
  date?: number | null,
  settled_at?: number | null,
  exchange_rate?: number | null,
  currency_code?: string | null,
  amount?: number | null,
  id_at_gateway?: string | null,
  status?: string | null,
  fraud_flag?: string | null,
  initiator_type?: string | null,
  three_d_secure?: boolean | null,
  authorization_reason?: string | null,
  error_code?: string | null,
  error_text?: string | null,
  voided_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  fraud_reason?: string | null,
  custom_payment_method_id?: string | null,
  amount_unused?: number | null,
  masked_card_number?: string | null,
  reference_transaction_id?: string | null,
  refunded_txn_id?: string | null,
  reference_authorization_id?: string | null,
  amount_capturable?: number | null,
  reversal_transaction_id?: string | null,
  deleted?: boolean | null,
  iin?: string | null,
  last4?: string | null,
  merchant_reference_id?: string | null,
  business_entity_id?: string | null,
  payment_method_details?: string | null,
  custom_payment_method_name?: string | null,
  linked_invoices?: {
    invoice_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    invoice_date?: number | null,
    invoice_total?: number | null,
    invoice_status?: string | null
  }[] | null,
  linked_credit_notes?: {
    cn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_total?: number | null,
    cn_status?: string | null,
    cn_reference_invoice_id?: string | null
  }[] | null,
  linked_refunds?: {
    txn_id?: string | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null
  }[] | null,
  linked_payments?: {
    id?: string | null,
    status?: string | null,
    amount?: number | null,
    date?: number | null
  }[] | null,
  gateway_metadata?: {
    acquirer_reference_id?: string | null
  } | null,
  error_detail?: {
    request_id?: string | null,
    error_category?: string | null,
    error_code?: string | null,
    error_message?: string | null,
    decline_code?: string | null,
    decline_message?: string | null,
    network_error_code?: string | null,
    network_error_message?: string | null,
    error_field?: string | null,
    recommendation_code?: string | null,
    recommendation_message?: string | null,
    processor_error_code?: string | null,
    processor_error_message?: string | null,
    error_cause_id?: string | null,
    processor_advice_code?: string | null
  } | null,
  network_transaction_details?: {
    network_transaction_id?: string | null,
    original_network_transaction_id?: string | null
  } | null
} | null
```

***

### void

`transactions.void`

Void an authorization transaction. This API voids the specific authorization transaction in order to release the blocked funds from the customer's card. Voiding an already captured or voided transaction is not possible.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.transactions.void({ transactionId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `transactionId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `transaction` | `object \| null` | No | This resource represents the [transaction](https://www.chargebee.com/docs/transactions.html) event that has happened in your account. |

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  subscription_id?: string | null,
  gateway_account_id?: string | null,
  payment_source_id?: string | null,
  payment_method?: string | null,
  reference_number?: string | null,
  gateway?: string | null,
  type?: string | null,
  date?: number | null,
  settled_at?: number | null,
  exchange_rate?: number | null,
  currency_code?: string | null,
  amount?: number | null,
  id_at_gateway?: string | null,
  status?: string | null,
  fraud_flag?: string | null,
  initiator_type?: string | null,
  three_d_secure?: boolean | null,
  authorization_reason?: string | null,
  error_code?: string | null,
  error_text?: string | null,
  voided_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  fraud_reason?: string | null,
  custom_payment_method_id?: string | null,
  amount_unused?: number | null,
  masked_card_number?: string | null,
  reference_transaction_id?: string | null,
  refunded_txn_id?: string | null,
  reference_authorization_id?: string | null,
  amount_capturable?: number | null,
  reversal_transaction_id?: string | null,
  deleted?: boolean | null,
  iin?: string | null,
  last4?: string | null,
  merchant_reference_id?: string | null,
  business_entity_id?: string | null,
  payment_method_details?: string | null,
  custom_payment_method_name?: string | null,
  linked_invoices?: {
    invoice_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    invoice_date?: number | null,
    invoice_total?: number | null,
    invoice_status?: string | null
  }[] | null,
  linked_credit_notes?: {
    cn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_total?: number | null,
    cn_status?: string | null,
    cn_reference_invoice_id?: string | null
  }[] | null,
  linked_refunds?: {
    txn_id?: string | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null
  }[] | null,
  linked_payments?: {
    id?: string | null,
    status?: string | null,
    amount?: number | null,
    date?: number | null
  }[] | null,
  gateway_metadata?: {
    acquirer_reference_id?: string | null
  } | null,
  error_detail?: {
    request_id?: string | null,
    error_category?: string | null,
    error_code?: string | null,
    error_message?: string | null,
    decline_code?: string | null,
    decline_message?: string | null,
    network_error_code?: string | null,
    network_error_message?: string | null,
    error_field?: string | null,
    recommendation_code?: string | null,
    recommendation_message?: string | null,
    processor_error_code?: string | null,
    processor_error_message?: string | null,
    error_cause_id?: string | null,
    processor_advice_code?: string | null
  } | null,
  network_transaction_details?: {
    network_transaction_id?: string | null,
    original_network_transaction_id?: string | null
  } | null
} | null
```

***

## Unbilled Charges

### create

`unbilledCharges.create`

Create unbilled charges for a subscription. using this API. Product Catalog 1.0 sites only.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.unbilledCharges.create({ subscription_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `subscription_id` | `string` | Yes | Identifier of the subscription for which this unbilled charges needs to be created. |
| `currency_code` | `string` | No | The currency code (ISO 4217 format) of the unbilled\_charge. |
| `addons` | `object` | No | Parameters for addons |
| `charges` | `object` | No | Parameters for charges |
| `tax_providers_fields` | `object` | No | Parameters for tax\_providers\_fields |

```ts theme={null}
{
  id?: string[],
  quantity?: number[],
  unit_price?: number[],
  quantity_in_decimal?: string[],
  unit_price_in_decimal?: string[],
  date_from?: number[],
  date_to?: number[]
}
```

```ts theme={null}
{
  amount?: number[],
  amount_in_decimal?: string[],
  description?: string[],
  taxable?: boolean[],
  tax_profile_id?: string[],
  avalara_tax_code?: string[],
  hsn_code?: string[],
  taxjar_product_code?: string[],
  avalara_sale_type?: (wholesale | retail | consumed | vendor_use)[],
  avalara_transaction_type?: number[],
  avalara_service_type?: number[],
  date_from?: number[],
  date_to?: number[]
}
```

```ts theme={null}
{
  provider_name?: string[],
  field_id?: string[],
  field_value?: string[]
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `unbilled_charges` | `object[] \| null` | No | Resource object representing unbilled\_charge |

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  subscription_id?: string | null,
  date_from?: number | null,
  date_to?: number | null,
  unit_amount?: number | null,
  pricing_model?: string | null,
  quantity?: number | null,
  amount?: number | null,
  currency_code?: string | null,
  discount_amount?: number | null,
  description?: string | null,
  entity_type?: string | null,
  entity_id?: string | null,
  is_voided?: boolean | null,
  voided_at?: number | null,
  unit_amount_in_decimal?: string | null,
  quantity_in_decimal?: string | null,
  amount_in_decimal?: string | null,
  created_at?: number | null,
  updated_at?: number | null,
  is_advance_charge?: boolean | null,
  business_entity_id?: string | null,
  deleted?: boolean | null,
  tiers?: {
    starting_unit?: number | null,
    ending_unit?: number | null,
    quantity_used?: number | null,
    unit_amount?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    quantity_used_in_decimal?: string | null,
    unit_amount_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null
  }[] | null
}[] | null
```

***

### createForItems

`unbilledCharges.createForItems`

Create unbilled charges for item subscription. This endpoint creates unbilled charges for a subscription.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.unbilledCharges.createForItems({ subscription_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscription_id` | `string` | Yes | Identifier of the subscription for which this unbilled charges needs to be created. |
| `currency_code` | `string` | No | The currency code (ISO 4217 format) of the unbilled\_charge. |
| `item_prices` | `object` | No | Parameters for item\_prices |
| `item_tiers` | `object` | No | Parameters for item\_tiers |
| `charges` | `object` | No | Parameters for charges |
| `tax_providers_fields` | `object` | No | Parameters for tax\_providers\_fields |

```ts theme={null}
{
  item_price_id?: string[],
  quantity?: number[],
  quantity_in_decimal?: string[],
  unit_price?: number[],
  unit_price_in_decimal?: string[],
  date_from?: number[],
  date_to?: number[]
}
```

```ts theme={null}
{
  item_price_id?: string[],
  starting_unit?: number[],
  ending_unit?: number[],
  price?: number[],
  starting_unit_in_decimal?: string[],
  ending_unit_in_decimal?: string[],
  price_in_decimal?: string[],
  pricing_type?: (per_unit | flat_fee | package)[],
  package_size?: number[]
}
```

```ts theme={null}
{
  amount?: number[],
  amount_in_decimal?: string[],
  description?: string[],
  taxable?: boolean[],
  tax_profile_id?: string[],
  avalara_tax_code?: string[],
  hsn_code?: string[],
  taxjar_product_code?: string[],
  avalara_sale_type?: (wholesale | retail | consumed | vendor_use)[],
  avalara_transaction_type?: number[],
  avalara_service_type?: number[],
  date_from?: number[],
  date_to?: number[]
}
```

```ts theme={null}
{
  provider_name?: string[],
  field_id?: string[],
  field_value?: string[]
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `unbilled_charges` | `object[] \| null` | No | Resource object representing unbilled\_charge |

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  subscription_id?: string | null,
  date_from?: number | null,
  date_to?: number | null,
  unit_amount?: number | null,
  pricing_model?: string | null,
  quantity?: number | null,
  amount?: number | null,
  currency_code?: string | null,
  discount_amount?: number | null,
  description?: string | null,
  entity_type?: string | null,
  entity_id?: string | null,
  is_voided?: boolean | null,
  voided_at?: number | null,
  unit_amount_in_decimal?: string | null,
  quantity_in_decimal?: string | null,
  amount_in_decimal?: string | null,
  created_at?: number | null,
  updated_at?: number | null,
  is_advance_charge?: boolean | null,
  business_entity_id?: string | null,
  deleted?: boolean | null,
  tiers?: {
    starting_unit?: number | null,
    ending_unit?: number | null,
    quantity_used?: number | null,
    unit_amount?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    quantity_used_in_decimal?: string | null,
    unit_amount_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null
  }[] | null
}[] | null
```

***

### delete

`unbilledCharges.delete`

Delete an unbilled charge. Use this API to delete an unbilled charge by specifying the id of the charge.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.unbilledCharges.delete({ unbilledChargeId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `unbilledChargeId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `unbilled_charge` | `object \| null` | No | Unbilled charge represents the charges that are held by passing `invoice_immediately` in various operations such as update subscription, add charge, create subscription, etc. [Learn more.](https://www.chargebee.com/docs/unbilled-charges.html) If any invoice is to be created for a subscription all the unbilled charges associated with the subscription will be included in that invoice. If any invoice is to be created for a customer, all the unbilled charges associated with its subscriptions will be included in that invoice. Any automatic invoice creation like renewal, activation, etc., will include the unbilled charges. Subscriptions are invoiced at the start of every term based on the recurring items and charged immediately against the customer's credit card if 'auto\_collection' is turned 'on', otherwise the resulting invoice will be created as 'Payment Due'. If consolidated invoicing is enabled, the charges during the subscription renewals/activations will be held and consolidated at the last renewal/activation that takes place on that particular day. |

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  subscription_id?: string | null,
  date_from?: number | null,
  date_to?: number | null,
  unit_amount?: number | null,
  pricing_model?: string | null,
  quantity?: number | null,
  amount?: number | null,
  currency_code?: string | null,
  discount_amount?: number | null,
  description?: string | null,
  entity_type?: string | null,
  entity_id?: string | null,
  is_voided?: boolean | null,
  voided_at?: number | null,
  unit_amount_in_decimal?: string | null,
  quantity_in_decimal?: string | null,
  amount_in_decimal?: string | null,
  created_at?: number | null,
  updated_at?: number | null,
  is_advance_charge?: boolean | null,
  business_entity_id?: string | null,
  deleted?: boolean | null,
  tiers?: {
    starting_unit?: number | null,
    ending_unit?: number | null,
    quantity_used?: number | null,
    unit_amount?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    quantity_used_in_decimal?: string | null,
    unit_amount_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null
  }[] | null
} | null
```

***

### invoiceNowEstimate

`unbilledCharges.invoiceNowEstimate`

Create an estimate for unbilled charges. This is similar to the "Create an invoice for unbilled charges" API but no invoice will be created, only an estimate for this operation is created. In the estimate response, \* estimate.invoice\_estimates is an array of estimate.invoice\_estimate.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.unbilledCharges.invoiceNowEstimate({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscription_id` | `string` | No | Identifier of the subscription for which this estimate needs to be created. Should be given if 'customer\_id' is not specified. |
| `customer_id` | `string` | No | Identifier of the customer for whom this estimate is created. Is given if 'subscription\_id' is not specified. Applicable only if the 'Consolidated Invoicing' is enabled. If 'Consolidated Invoicing' is not enabled, an invoice will be generated for every subscription. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `estimate` | `object \| null` | No | During the process of signing up customers to subscriptions, use the Estimates API to evaluate the details of the purchase before actually signing them up. The details returned by the API include the invoice amounts, next billing date and unbilled charges. For example, consider that you are creating a new subscription or update an existing one. Use the Estimates API before that to deduce the details such as the amount the customer would be charged, the state the subscription would be in after creation or updation, and so on. If you have configured the [Avalara integration](https://www.chargebee.com/docs/2.0/avalara.html), Chargebee retrieves the tax amount from Avalara for the invoice. This counts against your Avalara API limits. |

```ts theme={null}
{
  created_at?: number | null,
  subscription_estimate?: {
    id?: string | null,
    currency_code?: string | null,
    status?: string | null,
    trial_end_action?: string | null,
    next_billing_at?: number | null,
    pause_date?: number | null,
    resume_date?: number | null,
    shipping_address?: {
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    } | null,
    contract_term?: {
      id?: string | null,
      status?: string | null,
      contract_start?: number | null,
      contract_end?: number | null,
      billing_cycle?: number | null,
      action_at_term_end?: string | null,
      total_contract_value?: number | null,
      total_contract_value_before_tax?: number | null,
      cancellation_cutoff_period?: number | null,
      created_at?: number | null,
      subscription_id?: string | null,
      remaining_billing_cycles?: number | null
    } | null
  } | null,
  subscription_estimates?: {
    id?: string | null,
    currency_code?: string | null,
    status?: string | null,
    trial_end_action?: string | null,
    next_billing_at?: number | null,
    pause_date?: number | null,
    resume_date?: number | null,
    shipping_address?: {
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    } | null,
    contract_term?: {
      id?: string | null,
      status?: string | null,
      contract_start?: number | null,
      contract_end?: number | null,
      billing_cycle?: number | null,
      action_at_term_end?: string | null,
      total_contract_value?: number | null,
      total_contract_value_before_tax?: number | null,
      cancellation_cutoff_period?: number | null,
      created_at?: number | null,
      subscription_id?: string | null,
      remaining_billing_cycles?: number | null
    } | null
  }[] | null,
  invoice_estimate?: {
    recurring?: boolean | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    credits_applied?: number | null,
    amount_paid?: number | null,
    amount_due?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    line_item_credits?: {
      cn_id?: string | null,
      applied_amount?: number | null,
      line_item_id?: string | null
    }[] | null,
    line_item_addresses?: {
      line_item_id?: string | null,
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  } | null,
  invoice_estimates?: {
    recurring?: boolean | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    credits_applied?: number | null,
    amount_paid?: number | null,
    amount_due?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    line_item_credits?: {
      cn_id?: string | null,
      applied_amount?: number | null,
      line_item_id?: string | null
    }[] | null,
    line_item_addresses?: {
      line_item_id?: string | null,
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  }[] | null,
  payment_schedule_estimates?: {
    id?: string | null,
    scheme_id?: string | null,
    entity_type?: string | null,
    entity_id?: string | null,
    amount?: number | null,
    currency_code?: string | null,
    schedule_entries?: {
      id?: string | null,
      date?: number | null,
      amount?: number | null,
      scheduled_amount?: number | null,
      status?: string | null
    }[] | null
  }[] | null,
  next_invoice_estimate?: {
    recurring?: boolean | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    credits_applied?: number | null,
    amount_paid?: number | null,
    amount_due?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    line_item_credits?: {
      cn_id?: string | null,
      applied_amount?: number | null,
      line_item_id?: string | null
    }[] | null,
    line_item_addresses?: {
      line_item_id?: string | null,
      first_name?: string | null,
      last_name?: string | null,
      email?: string | null,
      company?: string | null,
      phone?: string | null,
      line1?: string | null,
      line2?: string | null,
      line3?: string | null,
      city?: string | null,
      state_code?: string | null,
      state?: string | null,
      country?: string | null,
      zip?: string | null,
      validation_status?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  } | null,
  credit_note_estimates?: {
    reference_invoice_id?: string | null,
    type?: string | null,
    price_type?: string | null,
    currency_code?: string | null,
    sub_total?: number | null,
    total?: number | null,
    amount_allocated?: number | null,
    amount_available?: number | null,
    line_items?: {
      id?: string | null,
      subscription_id?: string | null,
      date_from?: number | null,
      date_to?: number | null,
      unit_amount?: number | null,
      quantity?: number | null,
      amount?: number | null,
      pricing_model?: string | null,
      is_taxed?: boolean | null,
      tax_amount?: number | null,
      tax_rate?: number | null,
      unit_amount_in_decimal?: string | null,
      quantity_in_decimal?: string | null,
      amount_in_decimal?: string | null,
      discount_amount?: number | null,
      item_level_discount_amount?: number | null,
      metered?: boolean | null,
      is_percentage_pricing?: boolean | null,
      reference_line_item_id?: string | null,
      description?: string | null,
      entity_description?: string | null,
      entity_type?: string | null,
      tax_exempt_reason?: string | null,
      entity_id?: string | null,
      customer_id?: string | null,
      proration_mode?: string | null
    }[] | null,
    line_item_tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    line_item_discounts?: {
      line_item_id?: string | null,
      discount_type?: string | null,
      coupon_id?: string | null,
      entity_id?: string | null,
      discount_amount?: number | null
    }[] | null,
    line_item_taxes?: {
      line_item_id?: string | null,
      tax_name?: string | null,
      tax_rate?: number | null,
      date_to?: number | null,
      date_from?: number | null,
      prorated_taxable_amount?: number | null,
      is_partial_tax_applied?: boolean | null,
      is_non_compliance_tax?: boolean | null,
      taxable_amount?: number | null,
      tax_amount?: number | null,
      tax_juris_type?: string | null,
      tax_juris_name?: string | null,
      tax_juris_code?: string | null,
      tax_amount_in_local_currency?: number | null,
      local_currency_code?: string | null
    }[] | null,
    discounts?: {
      amount?: number | null,
      description?: string | null,
      line_item_id?: string | null,
      entity_type?: string | null,
      discount_type?: string | null,
      entity_id?: string | null,
      coupon_set_code?: string | null
    }[] | null,
    taxes?: {
      name?: string | null,
      amount?: number | null,
      description?: string | null
    }[] | null,
    round_off_amount?: number | null,
    customer_id?: string | null
  }[] | null,
  unbilled_charge_estimates?: {
    id?: string | null,
    customer_id?: string | null,
    subscription_id?: string | null,
    date_from?: number | null,
    date_to?: number | null,
    unit_amount?: number | null,
    pricing_model?: string | null,
    quantity?: number | null,
    amount?: number | null,
    currency_code?: string | null,
    discount_amount?: number | null,
    description?: string | null,
    entity_type?: string | null,
    entity_id?: string | null,
    is_voided?: boolean | null,
    voided_at?: number | null,
    unit_amount_in_decimal?: string | null,
    quantity_in_decimal?: string | null,
    amount_in_decimal?: string | null,
    created_at?: number | null,
    updated_at?: number | null,
    tiers?: {
      line_item_id?: string | null,
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null,
    is_advance_charge?: boolean | null,
    business_entity_id?: string | null,
    deleted?: boolean | null
  }[] | null
} | null
```

***

### invoiceUnbilledCharges

`unbilledCharges.invoiceUnbilledCharges`

Create an invoice for unbilled charges. Use this API to bill the unbilled charges. Available Credits and Excess Payments will automatically be applied while creating the invoice.

**Risk:** `destructive`

```ts theme={null}
await corsair.chargebee.api.unbilledCharges.invoiceUnbilledCharges({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `subscription_id` | `string` | No | Identifier of the subscription for which this invoice needs to be created. Should be specified if 'customer\_id' is not specified. |
| `customer_id` | `string` | No | Identifier of the customer for whom this invoice needs to be created. Should be specified if 'subscription\_id' is not specified. Applicable only if the consolidated invoicing is enabled. . |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `invoices` | `object[] \| null` | No | Resource object representing invoice |

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  payment_owner?: string | null,
  subscription_id?: string | null,
  recurring?: boolean | null,
  status?: string | null,
  date?: number | null,
  due_date?: number | null,
  net_term_days?: number | null,
  po_number?: string | null,
  vat_number?: string | null,
  price_type?: string | null,
  exchange_rate?: number | null,
  local_currency_exchange_rate?: number | null,
  currency_code?: string | null,
  local_currency_code?: string | null,
  tax?: number | null,
  sub_total?: number | null,
  sub_total_in_local_currency?: number | null,
  total?: number | null,
  total_in_local_currency?: number | null,
  amount_due?: number | null,
  amount_adjusted?: number | null,
  amount_paid?: number | null,
  paid_at?: number | null,
  write_off_amount?: number | null,
  credits_applied?: number | null,
  dunning_status?: string | null,
  next_retry_at?: number | null,
  voided_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  line_items_next_offset?: string | null,
  first_invoice?: boolean | null,
  new_sales_amount?: number | null,
  has_advance_charges?: boolean | null,
  offline_payment_method?: string | null,
  term_finalized?: boolean | null,
  is_gifted?: boolean | null,
  generated_at?: number | null,
  expected_payment_date?: number | null,
  amount_to_collect?: number | null,
  round_off_amount?: number | null,
  retry_segment_id?: string | null,
  void_reason_code?: string | null,
  deleted?: boolean | null,
  tax_category?: string | null,
  vat_number_prefix?: string | null,
  channel?: string | null,
  business_entity_id?: string | null,
  brand_id?: string | null,
  exchange_rates?: {
    currency_code?: string | null,
    rate?: number | null
  }[] | null,
  line_items?: {
    id?: string | null,
    subscription_id?: string | null,
    date_from?: number | null,
    date_to?: number | null,
    unit_amount?: number | null,
    quantity?: number | null,
    amount?: number | null,
    pricing_model?: string | null,
    is_taxed?: boolean | null,
    tax_amount?: number | null,
    tax_rate?: number | null,
    unit_amount_in_decimal?: string | null,
    quantity_in_decimal?: string | null,
    amount_in_decimal?: string | null,
    discount_amount?: number | null,
    item_level_discount_amount?: number | null,
    metered?: boolean | null,
    is_percentage_pricing?: boolean | null,
    reference_line_item_id?: string | null,
    description?: string | null,
    entity_description?: string | null,
    entity_type?: string | null,
    tax_exempt_reason?: string | null,
    entity_id?: string | null,
    customer_id?: string | null,
    proration_mode?: string | null
  }[] | null,
  line_item_tiers?: {
    line_item_id?: string | null,
    starting_unit?: number | null,
    ending_unit?: number | null,
    quantity_used?: number | null,
    unit_amount?: number | null,
    starting_unit_in_decimal?: string | null,
    ending_unit_in_decimal?: string | null,
    quantity_used_in_decimal?: string | null,
    unit_amount_in_decimal?: string | null,
    pricing_type?: string | null,
    package_size?: number | null
  }[] | null,
  line_item_discounts?: {
    line_item_id?: string | null,
    discount_type?: string | null,
    coupon_id?: string | null,
    entity_id?: string | null,
    discount_amount?: number | null
  }[] | null,
  line_item_taxes?: {
    line_item_id?: string | null,
    tax_name?: string | null,
    tax_rate?: number | null,
    date_to?: number | null,
    date_from?: number | null,
    prorated_taxable_amount?: number | null,
    is_partial_tax_applied?: boolean | null,
    is_non_compliance_tax?: boolean | null,
    taxable_amount?: number | null,
    tax_amount?: number | null,
    tax_juris_type?: string | null,
    tax_juris_name?: string | null,
    tax_juris_code?: string | null,
    tax_amount_in_local_currency?: number | null,
    local_currency_code?: string | null
  }[] | null,
  line_item_credits?: {
    cn_id?: string | null,
    applied_amount?: number | null,
    line_item_id?: string | null
  }[] | null,
  line_item_addresses?: {
    line_item_id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  }[] | null,
  discounts?: {
    amount?: number | null,
    description?: string | null,
    line_item_id?: string | null,
    entity_type?: string | null,
    discount_type?: string | null,
    entity_id?: string | null,
    coupon_set_code?: string | null
  }[] | null,
  taxes?: {
    name?: string | null,
    amount?: number | null,
    description?: string | null
  }[] | null,
  tax_origin?: {
    country?: string | null,
    registration_number?: string | null
  } | null,
  linked_taxes_withheld?: {
    id?: string | null,
    amount?: number | null,
    description?: string | null,
    date?: number | null,
    reference_number?: string | null
  }[] | null,
  linked_payments?: {
    txn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null
  }[] | null,
  reference_transactions?: {
    applied_amount?: number | null,
    applied_at?: number | null,
    txn_id?: string | null,
    txn_status?: string | null,
    txn_date?: number | null,
    txn_amount?: number | null,
    txn_type?: string | null,
    amount_capturable?: number | null,
    authorization_reason?: string | null
  }[] | null,
  dunning_attempts?: {
    attempt?: number | null,
    transaction_id?: string | null,
    dunning_type?: string | null,
    created_at?: number | null,
    txn_status?: string | null,
    txn_amount?: number | null,
    retry_engine?: string | null
  }[] | null,
  applied_credits?: {
    cn_id?: string | null,
    applied_amount?: number | null,
    applied_at?: number | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_status?: string | null,
    tax_application?: string | null
  }[] | null,
  adjustment_credit_notes?: {
    cn_id?: string | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_total?: number | null,
    cn_status?: string | null
  }[] | null,
  issued_credit_notes?: {
    cn_id?: string | null,
    cn_reason_code?: string | null,
    cn_create_reason_code?: string | null,
    cn_date?: number | null,
    cn_total?: number | null,
    cn_status?: string | null
  }[] | null,
  linked_orders?: {
    id?: string | null,
    document_number?: string | null,
    status?: string | null,
    order_type?: string | null,
    reference_id?: string | null,
    fulfillment_status?: string | null,
    batch_id?: string | null,
    created_at?: number | null
  }[] | null,
  notes?: {
    note?: string | null,
    entity_id?: string | null,
    entity_type?: string | null
  }[] | null,
  shipping_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  statement_descriptor?: {
    id?: string | null,
    descriptor?: string | null
  } | null,
  einvoice?: {
    id?: string | null,
    reference_id?: string | null,
    reference_number?: string | null,
    status?: string | null,
    message?: string | null,
    provider_references?: any[] | null
  } | null,
  site_details_at_creation?: {
    timezone?: string | null,
    organization_address?: {
    } | null
  } | null
}[] | null
```

***

### list

`unbilledCharges.list`

List unbilled charges. This endpoint lists all the unbilled charges.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.unbilledCharges.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `include_deleted` | `boolean` | No | If set to true, includes the deleted resources in the response. For the deleted resources in the response, the '**deleted** ' attribute will be '**true** '. |
| `is_voided` | `boolean` | No | Will be true if the charge has been voided. Usually the unbilled charge will be voided and revised to different charges(s) during proration. |
| `subscription_id` | `object` | No | optional, string filter A unique identifier for the subscription this charge belongs to. **Supported operators :** is, is\_not, starts\_with, is\_present, in, not\_in **Example →** *subscription\_id\\\[is\\] = "5hjdk8nOpd0b12"* |
| `customer_id` | `object` | No | optional, string filter A unique identifier for the customer being charged. **Supported operators :** is, is\_not, starts\_with, is\_present, in, not\_in **Example →** *customer\_id\\\[is\\] = "5hjdk8nOpd0b12"* |

```ts theme={null}
{
  is?: string,
  is_not?: string,
  starts_with?: string,
  is_present?: true | false,
  in?: string,
  not_in?: string
}
```

```ts theme={null}
{
  is?: string,
  is_not?: string,
  starts_with?: string,
  is_present?: true | false,
  in?: string,
  not_in?: string
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

```ts theme={null}
{
  unbilled_charge?: {
    id?: string | null,
    customer_id?: string | null,
    subscription_id?: string | null,
    date_from?: number | null,
    date_to?: number | null,
    unit_amount?: number | null,
    pricing_model?: string | null,
    quantity?: number | null,
    amount?: number | null,
    currency_code?: string | null,
    discount_amount?: number | null,
    description?: string | null,
    entity_type?: string | null,
    entity_id?: string | null,
    is_voided?: boolean | null,
    voided_at?: number | null,
    unit_amount_in_decimal?: string | null,
    quantity_in_decimal?: string | null,
    amount_in_decimal?: string | null,
    created_at?: number | null,
    updated_at?: number | null,
    is_advance_charge?: boolean | null,
    business_entity_id?: string | null,
    deleted?: boolean | null,
    tiers?: {
      starting_unit?: number | null,
      ending_unit?: number | null,
      quantity_used?: number | null,
      unit_amount?: number | null,
      starting_unit_in_decimal?: string | null,
      ending_unit_in_decimal?: string | null,
      quantity_used_in_decimal?: string | null,
      unit_amount_in_decimal?: string | null,
      pricing_type?: string | null,
      package_size?: number | null
    }[] | null
  } | null
}[] | null
```

***

## Usage Events

### create

`usageEvents.create`

Ingest a usage event. This endpoint ingests a usage event into Chargebee. See also \* Limits for Usage-based Billing in Chargebee.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.usageEvents.create({
	deduplication_id: 'example',
	properties: {},
	subscription_id: 'example',
	usage_timestamp: 1,
});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `deduplication_id` | `string` | Yes | An identifier used by the Chargebee's customer to distinguish between multiple events generated at the same timestamp for a single `subscription_id`. The combination of `usage_timestamp`, `subscription_id`, and `deduplication_id` uniquely identifies each event. **Example** : If 3 events are generated for `subscription_id` = `sub-1` at `2025-04-01T00:00:00.000Z`, each event must have a distinct `deduplication_id`. |
| `subscription_id` | `string` | Yes | The unique identifier of a subscription. **Note:** \* If an existing `subscription_id` is provided, usage data is recorded against it. \* If the subscription does not exist yet in Chargebee, a new `subscription_id` can be used, and the subscription can be imported later, once the usage is successfully recorded. \* During invoice generation, recorded usage linked to the `subscription_id` will be applied to the invoice. |
| `usage_timestamp` | `number` | Yes | The timestamp indicating when this usage occurred, represented as [Epoch](https://en.wikipedia.org/wiki/Unix_time) time in **milliseconds** . Example: `1738732394123` represents the timestamp for February 5, 2025, at 05:13:14.123 UTC. **Note** : The timestamp must be within the last **12 hours** . |
| `properties` | `object` | Yes | A schema-less field that accepts any JSON-formatted data to define the attributes of the ingested event. It is a requirement to structure the data in a flat format wherever possible for better compatibility with downstream processing. We strongly encourage using unique field names-particularly for fields intended for metering purposes. This approach enhances clarity and maintainability in the future. For example, a field named `status`, \* Can represent `string` values such as `accepted` or `processing` in one context. \* In another scenario, it might hold numeric values, such as HTTP response codes like `200`, `300`, or `400`. **Note**: \* Learn more about [field naming guidelines](https://docs.corsair.dev/docs/api/usage_files). |

```ts theme={null}
{
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `usage_event` | `object \| null` | No | This resource allows you to record usage events, which are essential for usage-based billing. These events track customer consumption and calculate charges based on actual usage. You can send usage data to Chargebee using two endpoints: [Ingest a Usage Event](https://docs.corsair.dev/docs/api/usage_events/create-a-usage-event) for individual events and [Ingest Usage Events in Batch](https://docs.corsair.dev/docs/api/usage_events/ingest-usages-in-batch) for bulk submissions. The usage event resource payload is schema-less, providing the flexibility to adapt to your unique business requirements. Because usage events are not directly tied to a pricing plan, this resource enables independent tracking of feature consumption. Events are processed and associated with relevant features as usage data. This information is used for billing alongside [entitlements](https://docs.corsair.dev/docs/api/entitlements), [items](https://docs.corsair.dev/docs/api/items)(such as plans or addons), or [item prices](https://docs.corsair.dev/docs/api/item_prices) to generate invoices. This decoupling of usage data from the product catalog provides flexibility in defining and monetizing usage beyond predefined pricing models. Additionally, this API supports feature usage analytics, churn prediction, and other insights. **Note** :- [Learn more](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/usage-based-billing-usecases) about the use cases associated with this resource. \* [Learn more](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/understanding-usages) about the Usage-based Billing. \* [Learn more](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/ingesting-usage-from-amazon-s3) about ingesting usage events from Amazon S3. **See also** \* [Limits for Usage-based Billing in Chargebee](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/understanding-usages#usage-based-billing-limits) |

```ts theme={null}
{
  subscription_id?: string | null,
  deduplication_id?: string | null,
  usage_timestamp?: number | null,
  properties?: {
  } | null
} | null
```

***

## Usage Files

### getProcessingStatus

`usageFiles.getProcessingStatus`

Retrieve file processing status. Use this endpoint to get the current status and details of a usage events file.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.usageFiles.getProcessingStatus({ usageFileId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `usageFileId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `usage_file` | `object \| null` | No | Represents a file containing usage events that has been uploaded for processing. Upload usage events using files \{#steps\_to\_upload\_usages\_file} -------------------------------------------------------------- Follow these steps to upload usage event files: **Step 1:** Request an [usage\_file](https://docs.corsair.dev/docs/api/usage_files/usage-file-object) object using the upload endpoint. This returns an [url](https://docs.corsair.dev/docs/api/usage_files/usage_file-object#upload_details). **Step 2:** Create a CSV file containing the usage event records. Ensure that the file meets the expected format and complies with the [file upload constraints](https://docs.corsair.dev/docs/api/usage_files#file_upload_constraints). Only `text/csv` files are supported. **Step 3:** Upload the CSV file using the returned [url](https://docs.corsair.dev/docs/api/usage_files/usage_file-object#upload_details). Make an HTTP `PUT` request to the upload URL. Include the file in the request body as binary data (raw file content). **Step 4:** Check the uploaded [usage\_file\_status](https://docs.corsair.dev/docs/api/usage_files/usage_file-object#status) using the [retrieve\_file\_processing\_status](https://docs.corsair.dev/docs/api/usage_files/get-uploaded-file-processing-status) endpoint. **Important** : [Learn more](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/ingesting-usage-from-amazon-s3) about ingesting usage events from Amazon S3. ### Best practices \{#best\_practices} \* We recommend not to create empty files which contain only header rows. \* We recommend uploading files in batches of **100,000** events per file or lesser to ensure optimal performance. \* We recommend ensuring that no row contains extra columns without corresponding headers. ### File upload constraints \{#file\_upload\_constraints} \* File names should not contain any special characters except for underscores `_` and hyphens `-`. \* File names must be under **150** characters and include the appropriate extensions, such as `.csv`. \* The supported delimiter for CSV file format is **comma(,)**. **See also** \* [Limits for Usage-based Billing in Chargebee](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/understanding-usages#usage-based-billing-limits) ### File field constraints \{#file\_field\_constraints} \* Make sure your file follows the sample file format: \|----------------------\|---------------------\|---------------------\|------------------\|-------------------\| \| **deduplication\_id** \| **subscription\_id** \| **usage\_timestamp** \| **input\_tokens** \| **output\_tokens** \| \| 123e4567-e89b-12d3 \| Sub-01 \| 1741156511000 \| 100 \| 100 \| \| 987f6543-b21c-34a5 \| Sub-02 \| 1741156511001 \| 859 \| 194 \| \* Learn more about [deduplication\_id](https://docs.corsair.dev/docs/api/usage_events/create-a-usage-event#deduplication_id), [subscription\_id](https://docs.corsair.dev/docs/api/usage_events/create-a-usage-event#subscription_id), and [usage\_timestamp](https://docs.corsair.dev/docs/api/usage_events/create-a-usage-event#usage_timestamp). \* Each row must include [deduplication\_id](https://docs.corsair.dev/docs/api/usage_events/create-a-usage-event#deduplication_id), [subscription\_id](https://docs.corsair.dev/docs/api/usage_events/create-a-usage-event#subscription_id), and [usage\_timestamp](https://docs.corsair.dev/docs/api/usage_events/create-a-usage-event#usage_timestamp). Rows missing any of these fields are flagged as failed events. \* Any top-level fields in the event row that are not a recognized field ([deduplication\_id](https://docs.corsair.dev/docs/api/usage_events/create-a-usage-event#deduplication_id), [subscription\_id](https://docs.corsair.dev/docs/api/usage_events/create-a-usage-event#subscription_id), and [usage\_timestamp](https://docs.corsair.dev/docs/api/usage_events/create-a-usage-event#usage_timestamp)) will automatically be added to the [properties](https://docs.corsair.dev/docs/api/usage_events/create-a-usage-event#properties). **Field Naming Guidelines**: Ensure that your file's column headers follow the required naming rules to avoid processing issues: \* **Start with:** a lowercase letter (`a-z`) \* **May include:** \* Lowercase letters (`a-z`) \* Numbers (`0-9`) \* Underscores (`_`) \|--------------------\|----------------------\| \| **Valid Examples** \| **Invalid Examples** \| \| `input_tokens` \| `InputTokens` \| \| `output_tokens` \| `Output Tokens` \| \| `feature_usage_1` \| `123output` \| \| `output_value` \| `output@value` \| \| `input_value` \| `input-value` \| ### Validating and handling errors \{#validating\_and\_handling\_errors} When uploading a usage events file using the API, certain validation checks are performed. If issues are detected, the upload or processing may fail. The following sections explain the possible error scenarios and how they are handled. \| Error Code \| Description \| \|-------------------------\|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `INVALID_FILE` \| This error occurs in the following scenarios: \* The file is not in a supported [MIME type](https://docs.corsair.dev/docs/api/usage_files/get-usages-file-upload-url#mime_type), so the upload [URL](https://docs.corsair.dev/docs/api/usage_files/usage_file-object#upload_details) is not generated. \* The file contains invalid or corrupt content that prevents successful parsing. **Error Message:** "The file format, size, or content is invalid. Please ensure the file is in the correct format and adheres to the size limits." \| \| `DUPLICATE_COLUMNS` \| This error occurs when the file contains duplicate column headers, which must be unique. **Error Message:** "Duplicate columns found: \\\[list of duplicates\\]. Please remove duplicates from your file before uploading again." \| \| `RECORD_LIMIT_EXCEEDED` \| This error occurs when the number of records in the uploaded file exceeds the system-defined limit. The `[limit]` placeholder specifies the maximum allowed records. **Error Message:** "The number of records exceeds the allowed limit of \\\[limit\\]. Please reduce the number of records in the file and try uploading again." \| \| `PARTIAL_FAILURE` \| This error indicates that some records in the file failed to process, while others were processed successfully. Review the failed records in the UI or failed queue for more details. **Error Message:** "Some records in the file could not be processed successfully. Please check the failed records in the \\\[UI/Failed Queue\\] for more details." \| \| `COMPLETE_FAILURE` \| This error indicates that all records in the uploaded file failed to process. Review the file, fix the issues, and try uploading it again. **Error Message:** "All records in the file failed to process. Please check the failed records in the \\\[UI/Failed Queue\\] for more details." \| \| `INVALID_COLUMNS` \| This error indicates that the file contains invalid column headers. **Error Message:** "Invalid columns found: \\\[list of invalid headers\\]. Please correct column names in your file before uploading again." \| **Note** : Usage events flagged as failed appear in the **Usages** \\> [**Failed Events**](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/ingesting-usage-events-into-chargebee#failed_events) section of the **Admin UI Dashboard**. |

```ts theme={null}
{
  id?: string | null,
  name?: string | null,
  mime_type?: string | null,
  error_code?: string | null,
  error_reason?: string | null,
  status?: string | null,
  total_records_count?: number | null,
  processed_records_count?: number | null,
  failed_records_count?: number | null,
  file_size_in_bytes?: number | null,
  processing_started_at?: number | null,
  processing_completed_at?: number | null,
  uploaded_by?: string | null,
  uploaded_at?: number | null,
  error_file_path?: string | null,
  error_file_url?: string | null,
  upload_details?: {
    url?: string | null,
    expires_at?: number | null
  } | null
} | null
```

***

### getUploadUrl

`usageFiles.getUploadUrl`

Retrieve usage file upload URL. This endpoint returns an upload URL for uploading usage events files, allowing you to upload files in supported formats. The file is processed asynchronously, and its status can be tracked using the retrieve\_file\_processing\_status endpoint.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.usageFiles.getUploadUrl({ file_name: 'example', mime_type: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `file_name` | `string` | Yes | Name of the file being uploaded. **Note:** No special characters are allowed in the `file_name` except for underscores `_` and hyphens `-` .**Example**: \|---------------------------\|---------------------------\| \| **Valid file name** \| **Invalid file name** \| \| merchant\_data.csv \| [merchant@data.csv](mailto:merchant@data.csv) \| \| sales\_report-2024.csv \| sales\\\&report-2024.csv \| \| customer\_details\_file.csv \| customer!details#file.csv \| |
| `mime_type` | `string` | Yes | Indicates the format of a file. **Note:** Currently, only `text/csv` is supported. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `usage_file` | `object \| null` | No | Represents a file containing usage events that has been uploaded for processing. Upload usage events using files \{#steps\_to\_upload\_usages\_file} -------------------------------------------------------------- Follow these steps to upload usage event files: **Step 1:** Request an [usage\_file](https://docs.corsair.dev/docs/api/usage_files/usage-file-object) object using the upload endpoint. This returns an [url](https://docs.corsair.dev/docs/api/usage_files/usage_file-object#upload_details). **Step 2:** Create a CSV file containing the usage event records. Ensure that the file meets the expected format and complies with the [file upload constraints](https://docs.corsair.dev/docs/api/usage_files#file_upload_constraints). Only `text/csv` files are supported. **Step 3:** Upload the CSV file using the returned [url](https://docs.corsair.dev/docs/api/usage_files/usage_file-object#upload_details). Make an HTTP `PUT` request to the upload URL. Include the file in the request body as binary data (raw file content). **Step 4:** Check the uploaded [usage\_file\_status](https://docs.corsair.dev/docs/api/usage_files/usage_file-object#status) using the [retrieve\_file\_processing\_status](https://docs.corsair.dev/docs/api/usage_files/get-uploaded-file-processing-status) endpoint. **Important** : [Learn more](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/ingesting-usage-from-amazon-s3) about ingesting usage events from Amazon S3. ### Best practices \{#best\_practices} \* We recommend not to create empty files which contain only header rows. \* We recommend uploading files in batches of **100,000** events per file or lesser to ensure optimal performance. \* We recommend ensuring that no row contains extra columns without corresponding headers. ### File upload constraints \{#file\_upload\_constraints} \* File names should not contain any special characters except for underscores `_` and hyphens `-`. \* File names must be under **150** characters and include the appropriate extensions, such as `.csv`. \* The supported delimiter for CSV file format is **comma(,)**. **See also** \* [Limits for Usage-based Billing in Chargebee](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/understanding-usages#usage-based-billing-limits) ### File field constraints \{#file\_field\_constraints} \* Make sure your file follows the sample file format: \|----------------------\|---------------------\|---------------------\|------------------\|-------------------\| \| **deduplication\_id** \| **subscription\_id** \| **usage\_timestamp** \| **input\_tokens** \| **output\_tokens** \| \| 123e4567-e89b-12d3 \| Sub-01 \| 1741156511000 \| 100 \| 100 \| \| 987f6543-b21c-34a5 \| Sub-02 \| 1741156511001 \| 859 \| 194 \| \* Learn more about [deduplication\_id](https://docs.corsair.dev/docs/api/usage_events/create-a-usage-event#deduplication_id), [subscription\_id](https://docs.corsair.dev/docs/api/usage_events/create-a-usage-event#subscription_id), and [usage\_timestamp](https://docs.corsair.dev/docs/api/usage_events/create-a-usage-event#usage_timestamp). \* Each row must include [deduplication\_id](https://docs.corsair.dev/docs/api/usage_events/create-a-usage-event#deduplication_id), [subscription\_id](https://docs.corsair.dev/docs/api/usage_events/create-a-usage-event#subscription_id), and [usage\_timestamp](https://docs.corsair.dev/docs/api/usage_events/create-a-usage-event#usage_timestamp). Rows missing any of these fields are flagged as failed events. \* Any top-level fields in the event row that are not a recognized field ([deduplication\_id](https://docs.corsair.dev/docs/api/usage_events/create-a-usage-event#deduplication_id), [subscription\_id](https://docs.corsair.dev/docs/api/usage_events/create-a-usage-event#subscription_id), and [usage\_timestamp](https://docs.corsair.dev/docs/api/usage_events/create-a-usage-event#usage_timestamp)) will automatically be added to the [properties](https://docs.corsair.dev/docs/api/usage_events/create-a-usage-event#properties). **Field Naming Guidelines**: Ensure that your file's column headers follow the required naming rules to avoid processing issues: \* **Start with:** a lowercase letter (`a-z`) \* **May include:** \* Lowercase letters (`a-z`) \* Numbers (`0-9`) \* Underscores (`_`) \|--------------------\|----------------------\| \| **Valid Examples** \| **Invalid Examples** \| \| `input_tokens` \| `InputTokens` \| \| `output_tokens` \| `Output Tokens` \| \| `feature_usage_1` \| `123output` \| \| `output_value` \| `output@value` \| \| `input_value` \| `input-value` \| ### Validating and handling errors \{#validating\_and\_handling\_errors} When uploading a usage events file using the API, certain validation checks are performed. If issues are detected, the upload or processing may fail. The following sections explain the possible error scenarios and how they are handled. \| Error Code \| Description \| \|-------------------------\|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\| \| `INVALID_FILE` \| This error occurs in the following scenarios: \* The file is not in a supported [MIME type](https://docs.corsair.dev/docs/api/usage_files/get-usages-file-upload-url#mime_type), so the upload [URL](https://docs.corsair.dev/docs/api/usage_files/usage_file-object#upload_details) is not generated. \* The file contains invalid or corrupt content that prevents successful parsing. **Error Message:** "The file format, size, or content is invalid. Please ensure the file is in the correct format and adheres to the size limits." \| \| `DUPLICATE_COLUMNS` \| This error occurs when the file contains duplicate column headers, which must be unique. **Error Message:** "Duplicate columns found: \\\[list of duplicates\\]. Please remove duplicates from your file before uploading again." \| \| `RECORD_LIMIT_EXCEEDED` \| This error occurs when the number of records in the uploaded file exceeds the system-defined limit. The `[limit]` placeholder specifies the maximum allowed records. **Error Message:** "The number of records exceeds the allowed limit of \\\[limit\\]. Please reduce the number of records in the file and try uploading again." \| \| `PARTIAL_FAILURE` \| This error indicates that some records in the file failed to process, while others were processed successfully. Review the failed records in the UI or failed queue for more details. **Error Message:** "Some records in the file could not be processed successfully. Please check the failed records in the \\\[UI/Failed Queue\\] for more details." \| \| `COMPLETE_FAILURE` \| This error indicates that all records in the uploaded file failed to process. Review the file, fix the issues, and try uploading it again. **Error Message:** "All records in the file failed to process. Please check the failed records in the \\\[UI/Failed Queue\\] for more details." \| \| `INVALID_COLUMNS` \| This error indicates that the file contains invalid column headers. **Error Message:** "Invalid columns found: \\\[list of invalid headers\\]. Please correct column names in your file before uploading again." \| **Note** : Usage events flagged as failed appear in the **Usages** \\> [**Failed Events**](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/ingesting-usage-events-into-chargebee#failed_events) section of the **Admin UI Dashboard**. |

```ts theme={null}
{
  id?: string | null,
  name?: string | null,
  mime_type?: string | null,
  error_code?: string | null,
  error_reason?: string | null,
  status?: string | null,
  total_records_count?: number | null,
  processed_records_count?: number | null,
  failed_records_count?: number | null,
  file_size_in_bytes?: number | null,
  processing_started_at?: number | null,
  processing_completed_at?: number | null,
  uploaded_by?: string | null,
  uploaded_at?: number | null,
  error_file_path?: string | null,
  error_file_url?: string | null,
  upload_details?: {
    url?: string | null,
    expires_at?: number | null
  } | null
} | null
```

***

## Usages

### getPdf

`usages.getPdf`

Retrieve usages for an invoice as PDF. Advanced Usage-Based Billing For high-scale usage ingestion, use Advanced Usage-Based Billing with the Usage Events API. The Usage Events API supports schemaless event ingestion at scale, including individual events, batch ingestion, and usage file ingestion.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.usages.getPdf({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `disposition_type` | `attachment \| inline` | No | Determines the pdf should be rendered as inline or attachment in the browser. \* attachment - PDF is rendered as attachment in the browser \* inline - PDF is rendered as inline in the browser |
| `invoice` | `object` | No | Parameters for invoice |
| `group_by` | `object` | No | — |

```ts theme={null}
{
  id: string
}
```

```ts theme={null}
{
  feature_id?: string[],
  attributes?: any[][],
  window_size?: (day | none)[]
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `download` | `object \| null` | No | Requesting to download a file through this API will return the `download_url` attribute as the response. This attribute will contain a URL that will allow the requested content to be downloaded. |

```ts theme={null}
{
  download_url?: string | null,
  valid_till?: number | null,
  mime_type?: string | null
} | null
```

***

### list

`usages.list`

Advanced Usage-Based Billing For high-scale usage ingestion, use Advanced Usage-Based Billing with the Usage Events API. The Usage Events API supports schemaless event ingestion at scale, including individual events, batch ingestion, and usage file ingestion. Retrieves the list of usages.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.usages.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `id` | `object` | No | optional, string filter A unique and immutable id for the usage. If not provided, it is autogenerated. **Supported operators :** is, is\_not, starts\_with **Example →** *id\\\[is\\] = "usage\_lsfja24411"* |
| `subscription_id` | `object` | No | optional, string filter The id of the [subscription](https://docs.corsair.dev/docs/api/subscriptions) to which this usage record belongs. **Supported operators :** is, is\_not, starts\_with **Example →** *subscription\_id\\\[is\\] = "active2"* |
| `usage_date` | `object` | No | optional, timestamp(UTC) in seconds filter The time at which this usage occurred. Chargebee bills only those usages whose `usage_date` falls within a time when the subscription `status` was `active` or `non_renewing`. However, the remaining usage records are still stored and are [retrievable](https://docs.corsair.dev/docs/api/usages/retrieve-a-usage). **Note:** If `usage_date` corresponds to a time already invoiced, then it is stored but never invoiced unless the [invoice is regenerated](https://docs.corsair.dev/docs/api/subscriptions/regenerate-an-invoice) . **Supported operators :** after, before, on, between **Example →** *usage\_date\\\[after\\] = "1601220958"* |
| `updated_at` | `object` | No | Timestamp indicating when this usage resource was last updated. |
| `item_price_id` | `object` | No | optional, string filter The id of the [item price](https://docs.corsair.dev/docs/api/item_prices) to which this usage belongs. The item price must be a part of the subscription or should have been part of it historically. **Supported operators :** is, is\_not, starts\_with **Example →** *item\_price\_id\\\[is\\] = "sprout"* |
| `invoice_id` | `object` | No | optional, string filter When the usage has been invoiced, this is the `id` of the [invoice](https://docs.corsair.dev/docs/api/invoices). This is cleared when the invoice is `voided` or deleted. **Supported operators :** is, is\_not, starts\_with, is\_present **Example →** *invoice\_id\\\[is\\] = "null"* |
| `source` | `object` | No | optional, enumerated string filter The source from which the usage record was created. Possible values are : admin\_console, api, bulk\_operation. **Supported operators :** is, is\_not, in, not\_in **Example →** *source\\\[is\\] = "api"* |
| `sort_by` | `object` | No | optional, string filter Sorts based on the specified attribute. **Supported attributes :** usage\_date **Supported sort-orders :** asc, desc **Example →** *sort\_by\\\[asc\\] = "usage\_date"* This will sort the result based on the 'usage\_date' attribute in ascending(earliest first) order. |

```ts theme={null}
{
  is?: string,
  is_not?: string,
  starts_with?: string
}
```

```ts theme={null}
{
  is?: string,
  is_not?: string,
  starts_with?: string
}
```

```ts theme={null}
{
  after?: string,
  before?: string,
  on?: string,
  between?: string
}
```

```ts theme={null}
{
  after?: string,
  before?: string,
  on?: string,
  between?: string
}
```

```ts theme={null}
{
  is?: string,
  is_not?: string,
  starts_with?: string
}
```

```ts theme={null}
{
  is?: string,
  is_not?: string,
  starts_with?: string,
  is_present?: true | false
}
```

```ts theme={null}
{
  is?: admin_console | api | bulk_operation,
  is_not?: admin_console | api | bulk_operation,
  in?: string,
  not_in?: string
}
```

```ts theme={null}
{
  asc?: usage_date | updated_at,
  desc?: usage_date | updated_at
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

```ts theme={null}
{
  usage?: {
    id?: string | null,
    usage_date?: number | null,
    subscription_id?: string | null,
    item_price_id?: string | null,
    invoice_id?: string | null,
    line_item_id?: string | null,
    quantity?: string | null,
    source?: string | null,
    note?: string | null,
    resource_version?: number | null,
    updated_at?: number | null,
    created_at?: number | null
  } | null
}[] | null
```

***

## Variants

### delete

`variants.delete`

Delete a product variant. This API deletes a product variant and returns the delete attribute value as true . Deletion of a product variant is not allowed if there are active or archived item\_price\_id under the variant. Once the variant is deleted, the id and name of the product variant can be reused.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.variants.delete({ productVariantId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `productVariantId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `variant` | `object \| null` | No | A product variant is a specific product version with a unique combination of product option values. |

```ts theme={null}
{
  id?: string | null,
  name?: string | null,
  external_name?: string | null,
  description?: string | null,
  sku?: string | null,
  deleted?: boolean | null,
  product_id?: string | null,
  status?: string | null,
  created_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  metadata?: {
  } | null,
  option_values?: {
    name?: string | null,
    value?: string | null
  }[] | null
} | null
```

***

### get

`variants.get`

Retrieve a product variant. This API is used to retrieve a product variant using variant\_id .

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.variants.get({ productVariantId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `productVariantId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `variant` | `object \| null` | No | A product variant is a specific product version with a unique combination of product option values. |

```ts theme={null}
{
  id?: string | null,
  name?: string | null,
  external_name?: string | null,
  description?: string | null,
  sku?: string | null,
  deleted?: boolean | null,
  product_id?: string | null,
  status?: string | null,
  created_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  metadata?: {
  } | null,
  option_values?: {
    name?: string | null,
    value?: string | null
  }[] | null
} | null
```

***

### update

`variants.update`

Update a product variant. This API is used to modify a product variant.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.variants.update({ productVariantId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `productVariantId` | `string` | Yes | — |
| `name` | `string` | No | This is a unique name that appears for each product variant to the end user. |
| `description` | `string` | No | A detailed description of this product variant. |
| `status` | `active \| inactive` | No | Status of the product variant. \* active - The active product variants are visible on the storefront, subscription, or checkout. \* inactive - The inactive product variants are not visible on the storefront, subscription, or checkout. |
| `external_name` | `string` | No | The unique name that appears for each product variant to the end user. |
| `sku` | `string` | No | A unique identifier code a seller assigns to each product variant. Retailers and merchants use SKUs to keep track of inventory and sales data and help organize products within a store or warehouse. SKUs can include a combination of letters, numbers, and symbols and can vary in length depending on the seller's needs. |
| `metadata` | `object` | No | A collection of key-value pairs that provides extra information about the variant. **Note:** There's a character limit of 65,535. [Learn more](https://docs.corsair.dev/docs/api/advanced-features#metadata) . |

```ts theme={null}
{
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `variant` | `object \| null` | No | A product variant is a specific product version with a unique combination of product option values. |

```ts theme={null}
{
  id?: string | null,
  name?: string | null,
  external_name?: string | null,
  description?: string | null,
  sku?: string | null,
  deleted?: boolean | null,
  product_id?: string | null,
  status?: string | null,
  created_at?: number | null,
  resource_version?: number | null,
  updated_at?: number | null,
  metadata?: {
  } | null,
  option_values?: {
    name?: string | null,
    value?: string | null
  }[] | null
} | null
```

***

## Vaulted Payment Methods

### get

`vaultedPaymentMethods.get`

Retrieve vaulted payment method. (GET /vaulted\_payment\_methods/\{vaulted-payment-method-id})

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.vaultedPaymentMethods.get({ vaultedPaymentMethodId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `vaultedPaymentMethodId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `vaulted_payment_method` | `object \| null` | No | — |

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  credit_card_id?: string | null,
  created_at?: number | null,
  modified_at?: number | null
} | null
```

***

## Virtual Bank Accounts

### create

`virtualBankAccounts.create`

Create a virtual bank account. Creates a virtual bank account for a customer. Email address is mandatory for virtual bank account creation. All notifications related to this virtual bank account will be sent to the email address you specify. Customer's email and virtual bank accounts will always be in sync.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.virtualBankAccounts.create({ customer_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customer_id` | `string` | Yes | Identifier of the customer. |
| `email` | `string` | No | Email address associated with the virtual bank account. |
| `gateway_account_id` | `string` | No | Identifier of the gateway account to use when creating the virtual bank account. **Default behavior** When not provided, Chargebee selects an applicable gateway account for the chosen `scheme`. Selection follows your site's [Smart Routing](https://www.chargebee.com/docs/payments/2.0/payment-gateways-and-configuration/gateway_settings#smart-routing) rules. |
| `scheme` | `ach_credit \| sepa_credit \| us_automated_bank_transfer \| gb_automated_bank_transfer \| eu_automated_bank_transfer \| jp_automated_bank_transfer \| mx_automated_bank_transfer` | No | Type of the credit transfer. \* mx\_automated\_bank\_transfer - MX Automated Bank Transfer \* sepa\_credit - SEPA Credit Transfer This scheme is deprecated. Instead of `sepa_credit` use `eu_automated_bank_transfer` . \* eu\_automated\_bank\_transfer - EU Automated Bank Transfer \* ach\_credit - ACH Credit Transfer This scheme is deprecated. Instead of `ach_credit` use `us_automated_bank_transfer` . \* jp\_automated\_bank\_transfer - JP Automated Bank Transfer \* us\_automated\_bank\_transfer - US Automated Bank Transfer \* gb\_automated\_bank\_transfer - UK Automated Bank Transfer |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `virtual_bank_account` | `object \| null` | No | A virtual bank account gives customers a dedicated account to pay into, so you don't share your organization's sensitive bank account details with them. You can create a virtual bank account for a customer and share the payment instructions. Customers pay using methods such as ACH credit or wire transfer. Chargebee automatically applies incoming funds to the customer's due invoices. |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  email?: string | null,
  scheme?: string | null,
  bank_name?: string | null,
  account_number?: string | null,
  routing_number?: string | null,
  swift_code?: string | null,
  gateway?: string | null,
  gateway_account_id?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  created_at?: number | null,
  reference_id?: string | null,
  deleted?: boolean | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  email?: string | null,
  phone?: string | null,
  company?: string | null,
  vat_number?: string | null,
  auto_collection?: string | null,
  offline_payment_method?: string | null,
  net_term_days?: number | null,
  vat_number_validated_time?: number | null,
  vat_number_status?: string | null,
  allow_direct_debit?: boolean | null,
  is_location_valid?: boolean | null,
  created_at?: number | null,
  created_from_ip?: string | null,
  exemption_details?: any[] | null,
  taxability?: string | null,
  entity_code?: string | null,
  exempt_number?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  locale?: string | null,
  billing_date?: number | null,
  billing_month?: number | null,
  billing_date_mode?: string | null,
  billing_day_of_week?: string | null,
  billing_day_of_week_mode?: string | null,
  pii_cleared?: string | null,
  auto_close_invoices?: boolean | null,
  channel?: string | null,
  active_id?: string | null,
  fraud_flag?: string | null,
  primary_payment_source_id?: string | null,
  backup_payment_source_id?: string | null,
  invoice_notes?: string | null,
  business_entity_id?: string | null,
  preferred_currency_code?: string | null,
  promotional_credits?: number | null,
  unbilled_charges?: number | null,
  refundable_credits?: number | null,
  excess_payments?: number | null,
  is_einvoice_enabled?: boolean | null,
  einvoicing_method?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  registered_for_gst?: boolean | null,
  consolidated_invoicing?: boolean | null,
  customer_type?: string | null,
  business_customer_without_vat_number?: boolean | null,
  client_profile_id?: string | null,
  use_default_hierarchy_settings?: boolean | null,
  vat_number_prefix?: string | null,
  entity_identifier_scheme?: string | null,
  entity_identifier_standard?: string | null,
  brand_id?: string | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_urls?: {
    external_customer_id?: string | null,
    referral_sharing_url?: string | null,
    created_at?: number | null,
    updated_at?: number | null,
    referral_campaign_id?: string | null,
    referral_account_id?: string | null,
    referral_external_campaign_id?: string | null,
    referral_system?: string | null
  }[] | null,
  contacts?: {
    id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    phone?: string | null,
    label?: string | null,
    enabled?: boolean | null,
    send_account_email?: boolean | null,
    send_billing_email?: boolean | null
  }[] | null,
  payment_method?: {
    type?: string | null,
    gateway?: string | null,
    gateway_account_id?: string | null,
    status?: string | null,
    reference_id?: string | null
  } | null,
  balances?: {
    promotional_credits?: number | null,
    excess_payments?: number | null,
    refundable_credits?: number | null,
    unbilled_charges?: number | null,
    currency_code?: string | null,
    business_entity_id?: string | null
  }[] | null,
  entity_identifiers?: {
    id?: string | null,
    value?: string | null,
    scheme?: string | null,
    standard?: string | null
  }[] | null,
  tax_providers_fields?: {
    provider_name?: string | null,
    field_id?: string | null,
    field_value?: string | null
  }[] | null,
  relationship?: {
    parent_id?: string | null,
    payment_owner_id?: string | null,
    invoice_owner_id?: string | null
  } | null,
  parent_account_access?: {
    portal_edit_child_subscriptions?: string | null,
    portal_download_child_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null,
  child_account_access?: {
    portal_edit_subscriptions?: string | null,
    portal_download_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null
} | null
```

***

### createUsingPermanentToken

`virtualBankAccounts.createUsingPermanentToken`

Create a virtual bank account using permanent token. Creates a virtual bank account (VBA) for a customer using a permanent token obtained from a payment gateway. Use this operation when you have already created a payment source at the gateway and obtained a permanent token (reference ID) for it.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.virtualBankAccounts.createUsingPermanentToken({ customer_id: 'example', reference_id: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `customer_id` | `string` | Yes | The unique identifier of the [customer](https://docs.corsair.dev/docs/api/customers) for whom you want to create a virtual bank account. |
| `reference_id` | `string` | Yes | The identifier (permanent token) used to fetch the payment source details from the gateway. For example, in Stripe it may be only the Stripe Customer ID (for example, cus\_63MnDn0t6kfDW7), or a combination of Stripe Customer ID and Stripe Source ID separated by a forward slash (for example, cus\_63MnDn0t6kfDW7/src\_6WjCF20vT9WN1G). **Constraints** \* If `gateway_account_id` is provided, the `reference_id` must belong to the gateway account. \* If the `gateway_account_id` is not provided, the `reference_id` must belong to the gateway account selected based on the [gateway routing rules](https://www.chargebee.com/docs/payments/2.0/payment-gateways-and-configuration/gateway_settings#smart-routing) for the payment method type and currency combination. |
| `gateway_account_id` | `string` | No | Identifier of the payment gateway account to use when creating the virtual bank account. **Default behavior** When not provided, Chargebee selects an applicable gateway account for the chosen `scheme`. Selection follows your site's [Smart Routing](https://www.chargebee.com/docs/payments/2.0/payment-gateways-and-configuration/gateway_settings#smart-routing) rules. |
| `scheme` | `ach_credit \| sepa_credit \| us_automated_bank_transfer \| gb_automated_bank_transfer \| eu_automated_bank_transfer \| jp_automated_bank_transfer \| mx_automated_bank_transfer` | No | The type of automated bank transfer scheme for the virtual bank account. **Prerequisites** \* If billing address validation is enabled for your site, the customer must have a billing address with a country code. \* mx\_automated\_bank\_transfer - Mexico Automated Bank Transfer scheme for Mexico-based customers. **Prerequisites** \* MXN currency must be [enabled](https://www.chargebee.com/docs/billing/2.0/site-configuration/multi-currency-pricing) for the site. \* The customer's [`billing_address.country`](https://docs.corsair.dev/docs/api/customers#billing_address_country) must be `MX`. \* sepa\_credit - **Deprecated** \* This scheme is deprecated. Use `eu_automated_bank_transfer` instead. SEPA Credit Transfer scheme for customers in the European Union. \* eu\_automated\_bank\_transfer - EU Automated Bank Transfer scheme for customers in the European Union. **Prerequisites** \* EUR currency must be [enabled](https://www.chargebee.com/docs/billing/2.0/site-configuration/multi-currency-pricing) for the site. \* The customer's [`billing_address.country`](https://docs.corsair.dev/docs/api/customers#billing_address_country) must be in a SEPA-supported region. \* ach\_credit - **Deprecated** \* This scheme is deprecated. Use `us_automated_bank_transfer` instead. ACH Credit Transfer scheme for US-based customers. \* jp\_automated\_bank\_transfer - Japan Automated Bank Transfer scheme for Japan-based customers. **Prerequisites** \* JPY currency must be [enabled](https://www.chargebee.com/docs/billing/2.0/site-configuration/multi-currency-pricing) for the site. \* The customer's [`billing_address.country`](https://docs.corsair.dev/docs/api/customers#billing_address_country) must be `JP`. \* us\_automated\_bank\_transfer - US Automated Bank Transfer scheme for US-based customers. **Prerequisites** \* USD currency must be [enabled](https://www.chargebee.com/docs/billing/2.0/site-configuration/multi-currency-pricing) for the site. \* The customer's [`billing_address.country`](https://docs.corsair.dev/docs/api/customers#billing_address_country) must be `US`. US Automated Bank Transfer \* gb\_automated\_bank\_transfer - UK Automated Bank Transfer scheme for UK-based customers. **Prerequisites** \* GBP currency must be [enabled](https://www.chargebee.com/docs/billing/2.0/site-configuration/multi-currency-pricing) for the site. \* The customer's [`billing_address.country`](https://docs.corsair.dev/docs/api/customers#billing_address_country) must be `GB`. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `virtual_bank_account` | `object \| null` | No | A virtual bank account gives customers a dedicated account to pay into, so you don't share your organization's sensitive bank account details with them. You can create a virtual bank account for a customer and share the payment instructions. Customers pay using methods such as ACH credit or wire transfer. Chargebee automatically applies incoming funds to the customer's due invoices. |
| `customer` | `object \| null` | No | Represents a customer, which can be an individual or organization that subscribes to your products or services. The customer resource associates with [subscriptions](https://docs.corsair.dev/docs/api/subscriptions/subscription-object), [card information](https://docs.corsair.dev/docs/api/cards/card-object), and billing addresses. The customer details include their ID, name, contact information, and any [custom attributes](https://docs.corsair.dev/docs/api/advanced-features) you'd like to associate with them. **Breaking Change**: \* [**Sites**](https://www.chargebee.com/docs/2.0/sites-intro.html) **created before March 1, 2014** : [updating the card](https://docs.corsair.dev/docs/api/cards/update-card-for-a-customer) deletes the customer's `billing_address` and `vat_number` and replaces them with values from the request. \* **Sites created on or after March 1, 2014** : updating the card doesn't change the `billing_address` and `vat_number`. |

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  email?: string | null,
  scheme?: string | null,
  bank_name?: string | null,
  account_number?: string | null,
  routing_number?: string | null,
  swift_code?: string | null,
  gateway?: string | null,
  gateway_account_id?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  created_at?: number | null,
  reference_id?: string | null,
  deleted?: boolean | null
} | null
```

```ts theme={null}
{
  id?: string | null,
  first_name?: string | null,
  last_name?: string | null,
  email?: string | null,
  phone?: string | null,
  company?: string | null,
  vat_number?: string | null,
  auto_collection?: string | null,
  offline_payment_method?: string | null,
  net_term_days?: number | null,
  vat_number_validated_time?: number | null,
  vat_number_status?: string | null,
  allow_direct_debit?: boolean | null,
  is_location_valid?: boolean | null,
  created_at?: number | null,
  created_from_ip?: string | null,
  exemption_details?: any[] | null,
  taxability?: string | null,
  entity_code?: string | null,
  exempt_number?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  locale?: string | null,
  billing_date?: number | null,
  billing_month?: number | null,
  billing_date_mode?: string | null,
  billing_day_of_week?: string | null,
  billing_day_of_week_mode?: string | null,
  pii_cleared?: string | null,
  auto_close_invoices?: boolean | null,
  channel?: string | null,
  active_id?: string | null,
  fraud_flag?: string | null,
  primary_payment_source_id?: string | null,
  backup_payment_source_id?: string | null,
  invoice_notes?: string | null,
  business_entity_id?: string | null,
  preferred_currency_code?: string | null,
  promotional_credits?: number | null,
  unbilled_charges?: number | null,
  refundable_credits?: number | null,
  excess_payments?: number | null,
  is_einvoice_enabled?: boolean | null,
  einvoicing_method?: string | null,
  meta_data?: {
  } | null,
  deleted?: boolean | null,
  registered_for_gst?: boolean | null,
  consolidated_invoicing?: boolean | null,
  customer_type?: string | null,
  business_customer_without_vat_number?: boolean | null,
  client_profile_id?: string | null,
  use_default_hierarchy_settings?: boolean | null,
  vat_number_prefix?: string | null,
  entity_identifier_scheme?: string | null,
  entity_identifier_standard?: string | null,
  brand_id?: string | null,
  billing_address?: {
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    company?: string | null,
    phone?: string | null,
    line1?: string | null,
    line2?: string | null,
    line3?: string | null,
    city?: string | null,
    state_code?: string | null,
    state?: string | null,
    country?: string | null,
    zip?: string | null,
    validation_status?: string | null
  } | null,
  referral_urls?: {
    external_customer_id?: string | null,
    referral_sharing_url?: string | null,
    created_at?: number | null,
    updated_at?: number | null,
    referral_campaign_id?: string | null,
    referral_account_id?: string | null,
    referral_external_campaign_id?: string | null,
    referral_system?: string | null
  }[] | null,
  contacts?: {
    id?: string | null,
    first_name?: string | null,
    last_name?: string | null,
    email?: string | null,
    phone?: string | null,
    label?: string | null,
    enabled?: boolean | null,
    send_account_email?: boolean | null,
    send_billing_email?: boolean | null
  }[] | null,
  payment_method?: {
    type?: string | null,
    gateway?: string | null,
    gateway_account_id?: string | null,
    status?: string | null,
    reference_id?: string | null
  } | null,
  balances?: {
    promotional_credits?: number | null,
    excess_payments?: number | null,
    refundable_credits?: number | null,
    unbilled_charges?: number | null,
    currency_code?: string | null,
    business_entity_id?: string | null
  }[] | null,
  entity_identifiers?: {
    id?: string | null,
    value?: string | null,
    scheme?: string | null,
    standard?: string | null
  }[] | null,
  tax_providers_fields?: {
    provider_name?: string | null,
    field_id?: string | null,
    field_value?: string | null
  }[] | null,
  relationship?: {
    parent_id?: string | null,
    payment_owner_id?: string | null,
    invoice_owner_id?: string | null
  } | null,
  parent_account_access?: {
    portal_edit_child_subscriptions?: string | null,
    portal_download_child_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null,
  child_account_access?: {
    portal_edit_subscriptions?: string | null,
    portal_download_invoices?: string | null,
    send_subscription_emails?: boolean | null,
    send_invoice_emails?: boolean | null,
    send_payment_emails?: boolean | null
  } | null
} | null
```

***

### delete

`virtualBankAccounts.delete`

Delete a virtual bank account. Deletes a virtual bank account. If there is no virtual bank account present in the gateway for the customer, this API will return successfully without throwing an error.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.virtualBankAccounts.delete({ virtualBankAccountId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `virtualBankAccountId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `virtual_bank_account` | `object \| null` | No | A virtual bank account gives customers a dedicated account to pay into, so you don't share your organization's sensitive bank account details with them. You can create a virtual bank account for a customer and share the payment instructions. Customers pay using methods such as ACH credit or wire transfer. Chargebee automatically applies incoming funds to the customer's due invoices. |

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  email?: string | null,
  scheme?: string | null,
  bank_name?: string | null,
  account_number?: string | null,
  routing_number?: string | null,
  swift_code?: string | null,
  gateway?: string | null,
  gateway_account_id?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  created_at?: number | null,
  reference_id?: string | null,
  deleted?: boolean | null
} | null
```

***

### deleteLocal

`virtualBankAccounts.deleteLocal`

Local delete a virtual bank account. Deletes virtual bank accounts from Chargebee. Payment method in the payment gateway, and Auto Collection settings in Chargebee are not affected.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.virtualBankAccounts.deleteLocal({ virtualBankAccountId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `virtualBankAccountId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `virtual_bank_account` | `object \| null` | No | A virtual bank account gives customers a dedicated account to pay into, so you don't share your organization's sensitive bank account details with them. You can create a virtual bank account for a customer and share the payment instructions. Customers pay using methods such as ACH credit or wire transfer. Chargebee automatically applies incoming funds to the customer's due invoices. |

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  email?: string | null,
  scheme?: string | null,
  bank_name?: string | null,
  account_number?: string | null,
  routing_number?: string | null,
  swift_code?: string | null,
  gateway?: string | null,
  gateway_account_id?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  created_at?: number | null,
  reference_id?: string | null,
  deleted?: boolean | null
} | null
```

***

### get

`virtualBankAccounts.get`

Retrieve a virtual bank account. Retrieves the virtual bank account identified by the unique identifier.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.virtualBankAccounts.get({ virtualBankAccountId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `virtualBankAccountId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `virtual_bank_account` | `object \| null` | No | A virtual bank account gives customers a dedicated account to pay into, so you don't share your organization's sensitive bank account details with them. You can create a virtual bank account for a customer and share the payment instructions. Customers pay using methods such as ACH credit or wire transfer. Chargebee automatically applies incoming funds to the customer's due invoices. |

```ts theme={null}
{
  id?: string | null,
  customer_id?: string | null,
  email?: string | null,
  scheme?: string | null,
  bank_name?: string | null,
  account_number?: string | null,
  routing_number?: string | null,
  swift_code?: string | null,
  gateway?: string | null,
  gateway_account_id?: string | null,
  resource_version?: number | null,
  updated_at?: number | null,
  created_at?: number | null,
  reference_id?: string | null,
  deleted?: boolean | null
} | null
```

***

### list

`virtualBankAccounts.list`

List virtual bank accounts. Lists all the virtual bank accounts.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.virtualBankAccounts.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |
| `customer_id` | `object` | No | optional, string filter Identifier of the customer. **Supported operators :** is, is\_not, starts\_with, in, not\_in **Example →** *customer\_id\\\[is\\] = "3bdjnDnsdQn"* |
| `updated_at` | `object` | No | optional, timestamp(UTC) in seconds filter Timestamp indicating when this virtual bank account resource was last updated. **Supported operators :** after, before, on, between **Example →** *updated\_at\\\[after\\] = "1435054328"* |
| `created_at` | `object` | No | optional, timestamp(UTC) in seconds filter Timestamp indicating when this virtual bank account resource is created. **Supported operators :** after, before, on, between **Example →** *created\_at\\\[after\\] = "1435054328"* |

```ts theme={null}
{
  is?: string,
  is_not?: string,
  starts_with?: string,
  in?: string,
  not_in?: string
}
```

```ts theme={null}
{
  after?: string,
  before?: string,
  on?: string,
  between?: string
}
```

```ts theme={null}
{
  after?: string,
  before?: string,
  on?: string,
  between?: string
}
```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

```ts theme={null}
{
  virtual_bank_account?: {
    id?: string | null,
    customer_id?: string | null,
    email?: string | null,
    scheme?: string | null,
    bank_name?: string | null,
    account_number?: string | null,
    routing_number?: string | null,
    swift_code?: string | null,
    gateway?: string | null,
    gateway_account_id?: string | null,
    resource_version?: number | null,
    updated_at?: number | null,
    created_at?: number | null,
    reference_id?: string | null,
    deleted?: boolean | null
  } | null
}[] | null
```

***

## Webhook Endpoints

### create

`webhookEndpoints.create`

Create a webhook endpoint. Create a new webhook API endpoint on your Chargebee Site.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.webhookEndpoints.create({ name: 'example', url: 'https://example.com/article' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `name` | `string` | Yes | A name to identify the webhook endpoint. |
| `api_version` | `v1 \| v2` | No | The API version used to format the webhook payload. Ensure this version matches the client library used by your webhook server \* v1 - If selected, the payload includes only attributes from API v1 resources. \* v2 - If selected, the payload includes only attributes from API v2 resources. |
| `url` | `string` | Yes | The target URL where webhook notifications will be sent. **Note** Only URL ports `80`, `443`, `8080`, or `8443` are allowed. |
| `primary_url` | `boolean` | No | Indicates whether this webhook is marked as the primary endpoint. If only one exists, it is primary by default. |
| `disabled` | `boolean` | No | Indicates whether the webhook endpoint is disabled. Set to `true` to disable the endpoint, set to `false` to enable the endpoint. |
| `basic_auth_password` | `string` | No | The password used for basic authentication to secure webhook delivery. |
| `basic_auth_username` | `string` | No | Username for basic authentication used to secure webhook delivery. |
| `send_card_resource` | `boolean` | No | Controls whether card-related resources are included in the webhook payload. Card details are always masked. |
| `chargebee_response_schema_type` | `plans_addons \| items \| compat` | No | Indicates the response schema used in the webhook payload, based on the product catalog version configured for the site. **Note** This field is only applicable if the site is in [`compat`](https://www.chargebee.com/docs/billing/1.0/product-catalog/product-catalog-coexistence-ui-changes) mode. \* compat - The webhook payload uses a schema compatible with both Product Catalog 1.0 and 2.0. This is applicable only to sites automatically upgraded to Product Catalog 2.0. \* plans\_addons - The webhook payload follows the [Product Catalog 1.0](https://www.chargebee.com/docs/billing/1.0/product-catalog/product-catalog) schema and uses the [Plans](https://docs.corsair.dev/docs/api/v2/pcv-1/plans) and [Addons](https://docs.corsair.dev/docs/api/v2/pcv-1/addons) model. \* items - The webhook payload follows the [Product Catalog 2.0](https://www.chargebee.com/docs/billing/2.0/product-catalog/product-catalog) schema and uses the [Items API model](https://docs.corsair.dev/docs/api/items) . |
| `enabled_events` | `(coupon_created \| coupon_updated \| coupon_deleted \| coupon_set_created \| coupon_set_updated \| coupon_set_deleted \| coupon_codes_added \| coupon_codes_deleted \| coupon_codes_updated \| customer_created \| customer_changed \| customer_deleted \| customer_moved_out \| customer_moved_in \| promotional_credits_added \| promotional_credits_deducted \| subscription_created \| subscription_created_with_backdating \| subscription_started \| subscription_trial_end_reminder \| subscription_activated \| subscription_activated_with_backdating \| subscription_changed \| subscription_trial_extended \| mrr_updated \| subscription_changed_with_backdating \| subscription_cancellation_scheduled \| subscription_cancellation_reminder \| subscription_cancelled \| subscription_canceled_with_backdating \| subscription_reactivated \| subscription_reactivated_with_backdating \| subscription_renewed \| subscription_items_renewed \| subscription_scheduled_cancellation_removed \| subscription_changes_scheduled \| subscription_scheduled_changes_removed \| subscription_shipping_address_updated \| subscription_deleted \| subscription_paused \| subscription_pause_scheduled \| subscription_scheduled_pause_removed \| subscription_resumed \| subscription_resumption_scheduled \| subscription_scheduled_resumption_removed \| subscription_advance_invoice_schedule_added \| subscription_advance_invoice_schedule_updated \| subscription_advance_invoice_schedule_removed \| pending_invoice_created \| pending_invoice_updated \| invoice_generated \| invoice_generated_with_backdating \| invoice_updated \| invoice_deleted \| credit_note_created \| credit_note_created_with_backdating \| credit_note_updated \| credit_note_deleted \| einvoice_created \| einvoice_updated \| payment_schedules_created \| payment_schedules_updated \| payment_schedule_scheme_created \| payment_schedule_scheme_deleted \| payment_schedules_cancelled \| subscription_renewal_reminder \| add_usages_reminder \| payment_due_reminder \| transaction_created \| transaction_updated \| transaction_deleted \| payment_succeeded \| payment_failed \| dunning_updated \| payment_refunded \| refund_failed \| payment_initiated \| refund_initiated \| authorization_succeeded \| authorization_voided \| card_added \| card_updated \| card_expiry_reminder \| card_expired \| card_deleted \| payment_source_added \| payment_source_updated \| payment_source_deleted \| payment_source_expiring \| payment_source_expired \| payment_source_locally_deleted \| virtual_bank_account_added \| virtual_bank_account_updated \| virtual_bank_account_deleted \| token_created \| token_consumed \| token_expired \| unbilled_charges_created \| unbilled_charges_voided \| unbilled_charges_deleted \| unbilled_charges_invoiced \| order_created \| order_updated \| order_cancelled \| order_delivered \| order_returned \| order_ready_to_process \| order_ready_to_ship \| order_deleted \| order_resent \| quote_created \| quote_updated \| quote_deleted \| tax_withheld_recorded \| tax_withheld_deleted \| tax_withheld_refunded \| gift_scheduled \| gift_unclaimed \| gift_claimed \| gift_expired \| gift_cancelled \| gift_updated \| hierarchy_created \| hierarchy_deleted \| payment_intent_created \| payment_intent_updated \| contract_term_created \| contract_term_renewed \| contract_term_terminated \| contract_term_completed \| contract_term_cancelled \| item_family_created \| item_family_updated \| item_family_deleted \| item_created \| item_updated \| item_deleted \| item_price_created \| item_price_updated \| item_price_deleted \| attached_item_created \| attached_item_updated \| attached_item_deleted \| differential_price_created \| differential_price_updated \| differential_price_deleted \| feature_created \| feature_updated \| feature_deleted \| feature_activated \| feature_reactivated \| feature_archived \| item_entitlements_updated \| entitlement_overrides_updated \| entitlement_overrides_removed \| item_entitlements_removed \| entitlement_overrides_auto_removed \| subscription_entitlements_created \| subscription_entitlements_updated \| business_entity_created \| business_entity_updated \| business_entity_deleted \| customer_business_entity_changed \| subscription_business_entity_changed \| payment_source_business_entity_changed \| organization_details_created \| organization_details_updated \| purchase_created \| voucher_created \| voucher_expired \| voucher_create_failed \| item_price_entitlements_updated \| item_price_entitlements_removed \| subscription_ramp_created \| subscription_ramp_deleted \| subscription_ramp_applied \| subscription_ramp_drafted \| subscription_ramp_updated \| price_variant_created \| price_variant_updated \| price_variant_deleted \| customer_entitlements_updated \| subscription_moved_in \| subscription_moved_out \| subscription_movement_failed \| omnichannel_subscription_created \| omnichannel_subscription_item_renewed \| omnichannel_subscription_item_downgraded \| omnichannel_subscription_item_expired \| omnichannel_subscription_item_cancellation_scheduled \| omnichannel_subscription_item_scheduled_cancellation_removed \| omnichannel_subscription_item_resubscribed \| omnichannel_subscription_item_upgraded \| omnichannel_subscription_item_cancelled \| omnichannel_subscription_imported \| omnichannel_subscription_item_grace_period_started \| omnichannel_subscription_item_grace_period_expired \| omnichannel_subscription_item_dunning_started \| omnichannel_subscription_item_dunning_expired \| rule_created \| rule_updated \| rule_deleted \| record_purchase_failed \| omnichannel_subscription_item_change_scheduled \| omnichannel_subscription_item_scheduled_change_removed \| omnichannel_subscription_item_reactivated \| sales_order_created \| sales_order_updated \| omnichannel_subscription_item_changed \| omnichannel_subscription_item_paused \| omnichannel_subscription_item_resumed \| omnichannel_one_time_order_created \| omnichannel_one_time_order_item_cancelled \| usage_file_ingested \| omnichannel_subscription_item_pause_scheduled \| omnichannel_subscription_moved_in \| omnichannel_transaction_created \| alert_status_changed \| omnichannel_subscription_item_updated \| omnichannel_subscription_item_recovered \| price_ramp_created \| price_ramp_updated \| price_ramp_deleted \| omnichannel_subscription_item_mrr_updated \| ledger_account_balance_updated \| grant_blocks_created \| grant_blocks_updated \| ledger_updated \| business_rule_created \| business_rule_updated \| business_rule_activated \| business_rule_deactivated \| business_rule_deleted \| business_rule_released \| vault_token_created \| vault_token_updated \| vault_token_deleted \| chargeback_initiated \| chargeback_won \| chargeback_lost \| business_ruleset_created \| business_ruleset_updated \| business_ruleset_activated \| business_ruleset_deactivated \| business_ruleset_deleted \| collections_reminder_sequence_created \| collections_reminder_sequence_paused \| collections_reminder_sequence_resumed \| collections_reminder_sequence_completed \| collections_payment_promise_created \| collections_payment_promise_updated \| collections_payment_promise_fulfilled \| collections_payment_promise_cancelled \| collections_payment_promise_broken \| collections_dispute_created \| collections_dispute_updated \| collections_dispute_resolved \| collections_dispute_withdrawn \| email_message_received \| private_note_added)[]` | No | A list of event types that trigger this webhook. **Note** If this field is left empty, the webhook will enable [all event types](https://docs.corsair.dev/docs/api/webhook_endpoints) by default. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `webhook_endpoint` | `object \| null` | No | A webhook endpoint receives real-time notifications from your Chargebee site when specific events occur, such as invoice generation, payment failures, or subscription updates. It allows your application, server, or third-party service to automatically respond to these changes, eliminating the need for manual checks or polling the API. Each webhook endpoint includes details such as a unique ID, target URL, list of subscribed events, and status. You can manage webhook endpoints using the Chargebee dashboard or the API. **Note** You can create up to five webhook endpoints per site. |

```ts theme={null}
{
  id?: string | null,
  name?: string | null,
  url?: string | null,
  send_card_resource?: boolean | null,
  disabled?: boolean | null,
  primary_url?: boolean | null,
  api_version?: string | null,
  chargebee_response_schema_type?: string | null,
  enabled_events?: string[] | null
} | null
```

***

### delete

`webhookEndpoints.delete`

Delete a webhook endpoint. Deletes a webhook endpoint using its unique identifier. Use this API to remove obsolete or inactive webhook endpoints from your Chargebee site. Deleting an endpoint ensures it no longer receives event notifications.

**Risk:** `destructive` · **Irreversible**

```ts theme={null}
await corsair.chargebee.api.webhookEndpoints.delete({ webhookEndpointId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `webhookEndpointId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `webhook_endpoint` | `object \| null` | No | A webhook endpoint receives real-time notifications from your Chargebee site when specific events occur, such as invoice generation, payment failures, or subscription updates. It allows your application, server, or third-party service to automatically respond to these changes, eliminating the need for manual checks or polling the API. Each webhook endpoint includes details such as a unique ID, target URL, list of subscribed events, and status. You can manage webhook endpoints using the Chargebee dashboard or the API. **Note** You can create up to five webhook endpoints per site. |

```ts theme={null}
{
  id?: string | null,
  name?: string | null,
  url?: string | null,
  send_card_resource?: boolean | null,
  disabled?: boolean | null,
  primary_url?: boolean | null,
  api_version?: string | null,
  chargebee_response_schema_type?: string | null,
  enabled_events?: string[] | null
} | null
```

***

### get

`webhookEndpoints.get`

Retrieve a webhook endpoint. Retrieves the details of a specific webhook endpoint using its unique identifier. Use this API to inspect an endpoint's configuration, such as the target URL, subscribed events, and authentication settings.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.webhookEndpoints.get({ webhookEndpointId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `webhookEndpointId` | `string` | Yes | — |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `webhook_endpoint` | `object \| null` | No | A webhook endpoint receives real-time notifications from your Chargebee site when specific events occur, such as invoice generation, payment failures, or subscription updates. It allows your application, server, or third-party service to automatically respond to these changes, eliminating the need for manual checks or polling the API. Each webhook endpoint includes details such as a unique ID, target URL, list of subscribed events, and status. You can manage webhook endpoints using the Chargebee dashboard or the API. **Note** You can create up to five webhook endpoints per site. |

```ts theme={null}
{
  id?: string | null,
  name?: string | null,
  url?: string | null,
  send_card_resource?: boolean | null,
  disabled?: boolean | null,
  primary_url?: boolean | null,
  api_version?: string | null,
  chargebee_response_schema_type?: string | null,
  enabled_events?: string[] | null
} | null
```

***

### list

`webhookEndpoints.list`

List webhook endpoints. Retrieves all webhook endpoints configured on your Chargebee site. The response includes each endpoint's ID, name, and target URL. Use this API to view, audit, or manage the list of webhook endpoints currently active or configured in your site.

**Risk:** `read`

```ts theme={null}
await corsair.chargebee.api.webhookEndpoints.list({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `limit` | `number` | No | The number of resources to be returned. |
| `offset` | `string` | No | Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `list` | `object[] \| null` | No | — |
| `next_offset` | `string \| null` | No | This attribute is returned only if more resources are present. To fetch the next set of resources use this value for the input parameter `offset`. |

```ts theme={null}
{
  webhook_endpoint?: {
    id?: string | null,
    name?: string | null,
    url?: string | null,
    send_card_resource?: boolean | null,
    disabled?: boolean | null,
    primary_url?: boolean | null,
    api_version?: string | null,
    chargebee_response_schema_type?: string | null,
    enabled_events?: string[] | null
  } | null
}[] | null
```

***

### update

`webhookEndpoints.update`

Update webhook endpoint. Updates the configuration of an existing webhook endpoint using its unique identifier. You can use this API to change properties such as the name, URL, subscribed events, authentication credentials, or API version.

**Risk:** `write`

```ts theme={null}
await corsair.chargebee.api.webhookEndpoints.update({ webhookEndpointId: 'example' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `eventActions` | `all-disabled` | No | skip all actions to be done on the events |
| `eventEmail` | `all-disabled` | No | skip only emails |
| `eventWebhook` | `all-disabled` | No | skip only webhooks |
| `businessEntityHeader` | `string` | No | If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
| `webhookEndpointId` | `string` | Yes | — |
| `name` | `string` | No | A name to identify the webhook endpoint. |
| `api_version` | `v1 \| v2` | No | The API version used to format the webhook payload. Ensure this version matches the client library used by your webhook server. \* v1 - If selected, the payload includes only attributes from API v1 resources. \* v2 - If selected, the payload includes only attributes from API v2 resources. |
| `url` | `string` | No | The target URL where webhook notifications will be sent. **Note** Only URL ports `80`, `443`, `8080`, or `8443` are allowed. |
| `primary_url` | `boolean` | No | Controls whether card-related resources are included in the webhook payload. Card details are always masked. |
| `send_card_resource` | `boolean` | No | Specifies whether card-related resources should be included in the webhook payload. |
| `basic_auth_password` | `string` | No | The password used for basic authentication to secure webhook delivery. |
| `basic_auth_username` | `string` | No | Username for basic authentication used to secure webhook delivery. |
| `disabled` | `boolean` | No | Indicates whether the webhook endpoint is disabled. Set to `true` to disable the endpoint, set to `false` to enable the endpoint. |
| `enabled_events` | `(coupon_created \| coupon_updated \| coupon_deleted \| coupon_set_created \| coupon_set_updated \| coupon_set_deleted \| coupon_codes_added \| coupon_codes_deleted \| coupon_codes_updated \| customer_created \| customer_changed \| customer_deleted \| customer_moved_out \| customer_moved_in \| promotional_credits_added \| promotional_credits_deducted \| subscription_created \| subscription_created_with_backdating \| subscription_started \| subscription_trial_end_reminder \| subscription_activated \| subscription_activated_with_backdating \| subscription_changed \| subscription_trial_extended \| mrr_updated \| subscription_changed_with_backdating \| subscription_cancellation_scheduled \| subscription_cancellation_reminder \| subscription_cancelled \| subscription_canceled_with_backdating \| subscription_reactivated \| subscription_reactivated_with_backdating \| subscription_renewed \| subscription_items_renewed \| subscription_scheduled_cancellation_removed \| subscription_changes_scheduled \| subscription_scheduled_changes_removed \| subscription_shipping_address_updated \| subscription_deleted \| subscription_paused \| subscription_pause_scheduled \| subscription_scheduled_pause_removed \| subscription_resumed \| subscription_resumption_scheduled \| subscription_scheduled_resumption_removed \| subscription_advance_invoice_schedule_added \| subscription_advance_invoice_schedule_updated \| subscription_advance_invoice_schedule_removed \| pending_invoice_created \| pending_invoice_updated \| invoice_generated \| invoice_generated_with_backdating \| invoice_updated \| invoice_deleted \| credit_note_created \| credit_note_created_with_backdating \| credit_note_updated \| credit_note_deleted \| einvoice_created \| einvoice_updated \| payment_schedules_created \| payment_schedules_updated \| payment_schedule_scheme_created \| payment_schedule_scheme_deleted \| payment_schedules_cancelled \| subscription_renewal_reminder \| add_usages_reminder \| payment_due_reminder \| transaction_created \| transaction_updated \| transaction_deleted \| payment_succeeded \| payment_failed \| dunning_updated \| payment_refunded \| refund_failed \| payment_initiated \| refund_initiated \| authorization_succeeded \| authorization_voided \| card_added \| card_updated \| card_expiry_reminder \| card_expired \| card_deleted \| payment_source_added \| payment_source_updated \| payment_source_deleted \| payment_source_expiring \| payment_source_expired \| payment_source_locally_deleted \| virtual_bank_account_added \| virtual_bank_account_updated \| virtual_bank_account_deleted \| token_created \| token_consumed \| token_expired \| unbilled_charges_created \| unbilled_charges_voided \| unbilled_charges_deleted \| unbilled_charges_invoiced \| order_created \| order_updated \| order_cancelled \| order_delivered \| order_returned \| order_ready_to_process \| order_ready_to_ship \| order_deleted \| order_resent \| quote_created \| quote_updated \| quote_deleted \| tax_withheld_recorded \| tax_withheld_deleted \| tax_withheld_refunded \| gift_scheduled \| gift_unclaimed \| gift_claimed \| gift_expired \| gift_cancelled \| gift_updated \| hierarchy_created \| hierarchy_deleted \| payment_intent_created \| payment_intent_updated \| contract_term_created \| contract_term_renewed \| contract_term_terminated \| contract_term_completed \| contract_term_cancelled \| item_family_created \| item_family_updated \| item_family_deleted \| item_created \| item_updated \| item_deleted \| item_price_created \| item_price_updated \| item_price_deleted \| attached_item_created \| attached_item_updated \| attached_item_deleted \| differential_price_created \| differential_price_updated \| differential_price_deleted \| feature_created \| feature_updated \| feature_deleted \| feature_activated \| feature_reactivated \| feature_archived \| item_entitlements_updated \| entitlement_overrides_updated \| entitlement_overrides_removed \| item_entitlements_removed \| entitlement_overrides_auto_removed \| subscription_entitlements_created \| subscription_entitlements_updated \| business_entity_created \| business_entity_updated \| business_entity_deleted \| customer_business_entity_changed \| subscription_business_entity_changed \| payment_source_business_entity_changed \| organization_details_created \| organization_details_updated \| purchase_created \| voucher_created \| voucher_expired \| voucher_create_failed \| item_price_entitlements_updated \| item_price_entitlements_removed \| subscription_ramp_created \| subscription_ramp_deleted \| subscription_ramp_applied \| subscription_ramp_drafted \| subscription_ramp_updated \| price_variant_created \| price_variant_updated \| price_variant_deleted \| customer_entitlements_updated \| subscription_moved_in \| subscription_moved_out \| subscription_movement_failed \| omnichannel_subscription_created \| omnichannel_subscription_item_renewed \| omnichannel_subscription_item_downgraded \| omnichannel_subscription_item_expired \| omnichannel_subscription_item_cancellation_scheduled \| omnichannel_subscription_item_scheduled_cancellation_removed \| omnichannel_subscription_item_resubscribed \| omnichannel_subscription_item_upgraded \| omnichannel_subscription_item_cancelled \| omnichannel_subscription_imported \| omnichannel_subscription_item_grace_period_started \| omnichannel_subscription_item_grace_period_expired \| omnichannel_subscription_item_dunning_started \| omnichannel_subscription_item_dunning_expired \| rule_created \| rule_updated \| rule_deleted \| record_purchase_failed \| omnichannel_subscription_item_change_scheduled \| omnichannel_subscription_item_scheduled_change_removed \| omnichannel_subscription_item_reactivated \| sales_order_created \| sales_order_updated \| omnichannel_subscription_item_changed \| omnichannel_subscription_item_paused \| omnichannel_subscription_item_resumed \| omnichannel_one_time_order_created \| omnichannel_one_time_order_item_cancelled \| usage_file_ingested \| omnichannel_subscription_item_pause_scheduled \| omnichannel_subscription_moved_in \| omnichannel_transaction_created \| alert_status_changed \| omnichannel_subscription_item_updated \| omnichannel_subscription_item_recovered \| price_ramp_created \| price_ramp_updated \| price_ramp_deleted \| omnichannel_subscription_item_mrr_updated \| ledger_account_balance_updated \| grant_blocks_created \| grant_blocks_updated \| ledger_updated \| business_rule_created \| business_rule_updated \| business_rule_activated \| business_rule_deactivated \| business_rule_deleted \| business_rule_released \| vault_token_created \| vault_token_updated \| vault_token_deleted \| chargeback_initiated \| chargeback_won \| chargeback_lost \| business_ruleset_created \| business_ruleset_updated \| business_ruleset_activated \| business_ruleset_deactivated \| business_ruleset_deleted \| collections_reminder_sequence_created \| collections_reminder_sequence_paused \| collections_reminder_sequence_resumed \| collections_reminder_sequence_completed \| collections_payment_promise_created \| collections_payment_promise_updated \| collections_payment_promise_fulfilled \| collections_payment_promise_cancelled \| collections_payment_promise_broken \| collections_dispute_created \| collections_dispute_updated \| collections_dispute_resolved \| collections_dispute_withdrawn \| email_message_received \| private_note_added)[]` | No | A list of event types that trigger this webhook. **Note** If this field is left empty, the webhook will enable [all event types](https://docs.corsair.dev/docs/api/webhook_endpoints) by default. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `webhook_endpoint` | `object \| null` | No | A webhook endpoint receives real-time notifications from your Chargebee site when specific events occur, such as invoice generation, payment failures, or subscription updates. It allows your application, server, or third-party service to automatically respond to these changes, eliminating the need for manual checks or polling the API. Each webhook endpoint includes details such as a unique ID, target URL, list of subscribed events, and status. You can manage webhook endpoints using the Chargebee dashboard or the API. **Note** You can create up to five webhook endpoints per site. |

```ts theme={null}
{
  id?: string | null,
  name?: string | null,
  url?: string | null,
  send_card_resource?: boolean | null,
  disabled?: boolean | null,
  primary_url?: boolean | null,
  api_version?: string | null,
  chargebee_response_schema_type?: string | null,
  enabled_events?: string[] | null
} | null
```

***


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.