# Update a subscription

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


[Idempotency Supported](/docs/api/idempotency)

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.

### Impacts

**

#### Subscription and Ramps: Impact on existing scheduled changes[](#subscription-and-ramps-impact-on-existing-scheduled-changes)

**

-   If the subscription has existing scheduled changes, the behavior depends on whether [Ramps](/docs/api/ramps) are enabled:
    -   **Ramps disabled**: Any existing scheduled change on the subscription is deleted.
    -   **Ramps enabled with compatibility mode**:
        -   If only one ramp is present:
            -   If the ramp was created using this API, the ramp is deleted.
            -   If the ramp was created using the [Create a ramp API](/docs/api/ramps/create-a-ramp), and the date-time of the new change is before the date-time of the ramp, then the ramp is moved to `draft` status if the [auto-draft conditions](/docs/api/ramps/ramp-object#auto-draft) are met.
        -   If multiple ramps are present: all ramps after the date-time of the new change are moved to `draft` status if the [auto-draft conditions](/docs/api/ramps/ramp-object#auto-draft) are met.
-   For more details, see [Ramps API compatibility mode](/docs/api/subscriptions#ramps-compat-mode).

**

#### Subscription: Other impacts[](#subscription-other-impacts)

**

-   When the [Remove mandatory add-ons from old plan during subscription plan update](https://www.chargebee.com/docs/2.0/subscriptions#remove-mandatory-addons) setting is enabled on your Chargebee site, all [mandatory addons](/docs/api/attached_items) with the old plan are automatically removed during the subscription update to a new plan.

**

#### Invoice[](#invoice)

**

-   If an invoice is generated, any available [credits and excess payments](/docs/api/customers#balances) for the customer are automatically applied subject to [limits set at the site level](https://www.chargebee.com/docs/billing/2.0/invoices-credit-notes-and-quotes/credit-notes#credits-flexibility), which can be overridden for subscriptions via [`subscription.billing_override`](/docs/api/subscriptions#billing_override).

**

#### Credit Note[](#credit-note)

**

-   When the subscription change occurs in the middle of a billing term, and `prorate` is `true`, prorated [credits](/docs/api/credit_notes) may be created for the unused service periods of the subscription items.

**

#### Payment Source[](#payment-source)

**

-   If `payment_intent`, `payment_method`, or `card` parameters are provided, a new [payment source](/docs/api/payment_sources) is created for the customer and associated with the subscription as the [`payment_source_id`](/docs/api/subscriptions/subscription-object#payment_source_id).

### Use Cases

#### Add item prices to the subscription[](#add-item-prices-to-the-subscription)

To add new item prices to the subscription, pass them in the `subscription_items` parameter.

##### Example[](#example)

Consider a subscription with the following item prices:

-   `plan-a-monthly-usd`
-   `addon-b-monthly-usd`

If you call this API with the following item price:

-   `addon-c-monthly-usd`

The subscription will be updated to include the following item prices:

-   `plan-a-monthly-usd`
-   `addon-b-monthly-usd`
-   `addon-c-monthly-usd`

#### Replace item prices in the subscription[](#replace-item-prices-in-the-subscription)

To replace all existing item prices in the subscription with a new set of item prices, include the `replace_items_list` parameter and set it to `true`.

##### Example[](#example)

Consider a subscription with the following item prices:

-   `plan-a-monthly-usd`
-   `addon-b-monthly-usd`

If you call this API with the following item prices and set `replace_items_list` to `true`:

-   `plan-c-monthly-usd`
-   `addon-d-monthly-usd`

The subscription will be updated to include only the new item prices:

-   `plan-c-monthly-usd`
-   `addon-d-monthly-usd`

#### Change the payment method during the update[](#change-the-payment-method-during-the-update)

An update can generate an invoice for prorated charges, which Chargebee attempts to collect immediately when `auto_collection` is `on`. Pass the payment details in this API call when the customer supplies a new payment method as part of the update, or when the resulting charge requires [Strong Customer Authentication](https://www.chargebee.com/docs/payments/2.0/others/psd2-sca) (SCA) (i.e. 3D-Secure).

Chargebee creates the [payment source](/docs/api/payment_sources), associates it with the subscription as the [`payment_source_id`](/docs/api/subscriptions/subscription-object#payment_source_id), and collects the invoice using it. This means you do not need a separate [Create a payment source API](/docs/api/payment_sources/create-using-payment-intent) call before updating the subscription.

Use `payment_intent`, `payment_method`, or `card`, depending on how you capture the payment details.

##### Using `payment_intent`[](#using-paymentintent)

Using payment intents is the recommended way to create a payment source in Chargebee for both SCA and non-SCA flows.

1.  Create a `payment_intent` resource by calling the [Create a payment intent API](/docs/api/payment_intents/create-a-payment-intent). Set `amount` to the amount due for this update, which you can retrieve using the [Estimate for updating a subscription API](/docs/api/estimates/estimate-for-updating-a-subscription).
2.  Pass the `payment_intent` object to your frontend and use Chargebee.js to capture the payment source details from the customer. Use [Payment Method Helpers](https://www.chargebee.com/checkout-portal-docs/payment-method-helper.html) to show payment method UIs and collect payment method details from the customer.
3.  Listen to the [`payment_intent_updated`](/docs/api/events#payment_intent_updated) event. Once the `payment_intent.status` is `authorized`, pass the `payment_intent.id` using the `payment_intent[id]` parameter in this API call.

##### Using `payment_method`[](#using-paymentmethod)

If you prefer to use the payment gateway's SDKs to capture the payment method details, you can then use the `payment_method` parameter in this API to pass the payment method token and other details.

1.  Use the JavaScript library of your payment gateway to capture the payment method details. Examples include:
    -   [Stripe.js](https://stripe.com/docs/js)
    -   [Braintree.js](https://developer.paypal.com/braintree/docs/guides/client-sdk/setup/javascript/v2)
    -   [Accept.js](https://developer.authorize.net/api/reference/features/acceptjs.html) (if you use [Authorize.Net](https://developer.authorize.net/api/reference/features/acceptjs.html))
    -   Adyen's [Client-Side Encryption](https://docs.adyen.com/online-payments/classic-integrations/api-integration-ecommerce/cse-integration-ecommerce) (if you use Adyen)
2.  Pass the payment method token using the `payment_method[reference_id]` or `payment_method[tmp_token]` parameter along with any additional parameters required by the payment gateway to create the payment source.

##### Using `card`[](#using-card)

If you are PCI compliant, you can pass raw card details via this API. Use the `card` parameter to pass the card details.

## Sample Request

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/subscriptions/__test__8asrKRrLKtirr/update_for_items \
     -X POST  \
     -u {site_api_key}:\
     -d "subscription_items[item_price_id][0]"="basic-USD" \
     -d "subscription_items[quantity][0]"=4 \
     -d "subscription_items[unit_price][0]"=1000 \
     -d invoice_immediately="true"
```

#### .NET

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

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = Subscription.UpdateForItems("__test__8asrKRrLKtirr")
		.SubscriptionItemItemPriceId(0, "basic-USD")
		.SubscriptionItemQuantity(0, 4)
		.SubscriptionItemUnitPrice(0, 1000)
		.InvoiceImmediately(true)
		.Request();

Subscription subscription = result.Subscription;
Customer customer = result.Customer;
Card card = result.Card;
Invoice invoice = result.Invoice;
List<UnbilledCharge> unbilledCharges = result.UnbilledCharges;
List<CreditNote> creditNotes = result.CreditNotes;
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    subscriptionAction "github.com/chargebee/chargebee-go/v3/actions/subscription"
    "github.com/chargebee/chargebee-go/v3/models/subscription"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := subscriptionAction.UpdateForItems("__test__8asrKRrLKtirr", &subscription.UpdateForItemsRequestParams{
        SubscriptionItems : []*subscription.UpdateForItemsSubscriptionItemParams{
            {
                ItemPriceId : "basic-USD",
                Quantity : chargebee.Int32(4),
                UnitPrice : chargebee.Int64(1000),
            },
        },
        InvoiceImmediately : chargebee.Bool(true),
    }).Request()
    if err != nil {
        fmt.Println(err)
    } else {
        Subscription := res.Subscription
        Customer := res.Customer
        Card := res.Card
        Invoice := res.Invoice
        UnbilledCharges := res.UnbilledCharges
        CreditNotes := res.CreditNotes
    }
}
```

#### Go

```go
package main

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

func main() {
  config := &chargebee.ClientConfig{
    SiteName: "{site}",
    ApiKey: "{site_api_key}",
  }    
  client := chargebee.NewClient(config)
  req := &chargebee.SubscriptionUpdateForItemsRequest{
    SubscriptionItems : []*chargebee.SubscriptionUpdateForItemsSubscriptionItem{
        {
            ItemPriceId : "basic-USD",
            Quantity : chargebee.Int32(4),
            UnitPrice : chargebee.Int64(1000),
        },
    },
    InvoiceImmediately : chargebee.Bool(true),
}
  res, err := client.Subscription.UpdateForItems("__test__8asrKRrLKtirr", req)
      if err != nil {
        fmt.Println(err)
    } else {
        Subscription := res.Subscription
        Customer := res.Customer
        Card := res.Card
        Invoice := res.Invoice
        UnbilledCharges := res.UnbilledCharges
        CreditNotes := res.CreditNotes
    }
}
```

#### Java

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

public class Sample {

    public static void main(String args[]) throws IOException, Exception {
        Environment.configure("{site}", "{site_api_key}");
        Result result = Subscription.updateForItems("__test__8asrKRrLKtirr")
            .subscriptionItemItemPriceId(0, "basic-USD")
            .subscriptionItemQuantity(0, 4)
            .subscriptionItemUnitPrice(0, 1000L)
            .invoiceImmediately(true)
            .request();

        Subscription subscription = result.subscription();
        Customer customer = result.customer();
        Card card = result.card();
        Invoice invoice = result.invoice();
        List<UnbilledCharge> unbilledCharges = result.unbilledCharges();
        List<CreditNote> creditNotes = result.creditNotes();
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.card.Card;
import com.chargebee.v4.models.creditNote.CreditNote;
import com.chargebee.v4.models.customer.Customer;
import com.chargebee.v4.models.invoice.Invoice;
import com.chargebee.v4.models.subscription.Subscription;
import com.chargebee.v4.models.subscription.params.SubscriptionUpdateForItemsParams;
import com.chargebee.v4.models.subscription.responses.SubscriptionUpdateForItemsResponse;
import com.chargebee.v4.models.unbilledCharge.UnbilledCharge;
import java.util.List;

public class SubscriptionUpdateForItems {

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

        SubscriptionUpdateForItemsParams.SubscriptionItemsParams subscriptionItem0 =
            SubscriptionUpdateForItemsParams.SubscriptionItemsParams.builder()
                .itemPriceId("basic-USD")
                .quantity(4)
                .unitPrice(1000L)
                .build();

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

        SubscriptionUpdateForItemsParams params = SubscriptionUpdateForItemsParams.builder()
            .subscriptionItems(subscriptionItemsList)
            .invoiceImmediately(true)
            .build();

        SubscriptionUpdateForItemsResponse response = client
            .subscriptions()
            .updateForItems("__test__8asrKRrLKtirr", params);

        Subscription subscription = response.getSubscription();
        Customer customer = response.getCustomer();
        Card card = response.getCard();
        Invoice invoice = response.getInvoice();
        List<UnbilledCharge> unbilledCharges = response.getUnbilledCharges();
        List<CreditNote> creditNotes = response.getCreditNotes();
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

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

try {
    const result = await chargebee.subscription.updateForItems("__test__8asrKRrLKtirr", {
        subscription_items: [
            {
                item_price_id: "basic-USD",
                quantity: 4,
                unit_price: 1000
            }
        ],
        invoice_immediately: true
    });

    console.log(result);
    const subscription = result.subscription;
    const customer = result.customer;
    const card = result.card;
    const invoice = result.invoice;
    const unbilledCharges = result.unbilled_charges;
    const creditNotes = result.credit_notes;
} catch (err) {
    console.log(err);
}
```

#### PHP

```php
<?php

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

use Chargebee\ChargebeeClient;

$chargebee = new ChargebeeClient(options: [
    "site" => "{site}",
    "apiKey" => "{site_api_key}",
]);
$result = $chargebee->subscription()->updateForItems("__test__8asrKRrLKtirr", [
    "subscription_items" => [
        [
            "item_price_id" => "basic-USD",
            "quantity" => 4,
            "unit_price" => 1000
        ]
    ],
    "invoice_immediately" => true
]);
$subscription = $result->subscription;
$customer = $result->customer;
$card = $result->card;
$invoice = $result->invoice;
$unbilledCharges = $result->unbilled_charges;
$creditNotes = $result->credit_notes;
```

#### Python

```python
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.Subscription.update_for_items("__test__8asrKRrLKtirr",
    cb_client.Subscription.UpdateForItemsParams(
        subscription_items=[
            cb_client.Subscription.UpdateForItemsSubscriptionItemParams(
              item_price_id="basic-USD",
              quantity=4,
              unit_price=1000
            )
        ],
        invoice_immediately=True
    )
)
subscription = response.subscription
customer = response.customer
card = response.card
invoice = response.invoice
unbilled_charges = response.unbilled_charges
credit_notes = response.credit_notes
```

#### Ruby

```ruby
require 'chargebee'

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

result = ChargeBee::Subscription.update_for_items("__test__8asrKRrLKtirr",{
  :subscription_items => [
    {
      :item_price_id => "basic-USD",
      :quantity => 4,
      :unit_price => 1000
    }
  ],
  :invoice_immediately => "true"
})

subscription = result.subscription
customer = result.customer
card = result.card
invoice = result.invoice
unbilled_charges = result.unbilled_charges
credit_notes = result.credit_notes
```

## Sample Response

```json
{
  "credit_notes": {},
  "customer": {
    "allow_direct_debit": false,
    "auto_collection": "off",
    "card_status": "no_card",
    "created_at": 1612890941,
    "deleted": false,
    "excess_payments": 0,
    "first_name": "John",
    "id": "__test__8asukSOXe1B5Sp",
    "last_name": "Doe",
    "net_term_days": 0,
    "object": "customer",
    "pii_cleared": "active",
    "preferred_currency_code": "USD",
    "promotional_credits": 0,
    "refundable_credits": 0,
    "resource_version": 1612890941000,
    "taxability": "taxable",
    "unbilled_charges": 0,
    "updated_at": 1612890941
  },
  "invoice": {
    "adjustment_credit_notes": {},
    "amount_adjusted": 0,
    "amount_due": 3000,
    "amount_paid": 0,
    "amount_to_collect": 3000,
    "applied_credits": {},
    "base_currency_code": "USD",
    "billing_address": {
      "first_name": "John",
      "last_name": "Doe",
      "object": "billing_address",
      "validation_status": "not_validated"
    },
    "credits_applied": 0,
    "currency_code": "USD",
    "customer_id": "__test__8asukSOXe1B5Sp",
    "date": 1612890942,
    "deleted": false,
    "due_date": 1612890942,
    "dunning_attempts": {},
    "exchange_rate": 1,
    "first_invoice": false,
    "has_advance_charges": false,
    "id": "__demo_inv__30",
    "is_gifted": false,
    "issued_credit_notes": {},
    "line_items": [
      {
        "amount": 3000,
        "customer_id": "__test__8asukSOXe1B5Sp",
        "date_from": 1612890942,
        "date_to": 1615310141,
        "description": "basic USD - Prorated Charges",
        "discount_amount": 0,
        "entity_id": "basic-USD",
        "entity_type": "plan_item_price",
        "id": "li___test__8asukSOXe1VTT0",
        "is_taxed": false,
        "item_level_discount_amount": 0,
        "object": "line_item",
        "pricing_model": "per_unit",
        "quantity": 3,
        "subscription_id": "__test__8asukSOXe1FHSs",
        "tax_amount": 0,
        "tax_exempt_reason": "tax_not_configured",
        "unit_amount": 1000
      },
      {..}
    ],
    "linked_orders": {},
    "linked_payments": {},
    "net_term_days": 0,
    "object": "invoice",
    "price_type": "tax_exclusive",
    "recurring": true,
    "resource_version": 1612890942000,
    "round_off_amount": 0,
    "status": "payment_due",
    "sub_total": 3000,
    "subscription_id": "__test__8asukSOXe1FHSs",
    "tax": 0,
    "term_finalized": true,
    "total": 3000,
    "updated_at": 1612890942,
    "write_off_amount": 0
  },
  "subscription": {
    "activated_at": 1612890941,
    "billing_period": 1,
    "billing_period_unit": "month",
    "created_at": 1612890941,
    "currency_code": "USD",
    "current_term_end": 1615310141,
    "current_term_start": 1612890941,
    "customer_id": "__test__8asukSOXe1B5Sp",
    "deleted": false,
    "due_invoices_count": 2,
    "due_since": 1612890941,
    "has_scheduled_changes": false,
    "id": "__test__8asukSOXe1FHSs",
    "mrr": 0,
    "next_billing_at": 1615310141,
    "object": "subscription",
    "remaining_billing_cycles": 1,
    "resource_version": 1612890942000,
    "started_at": 1612890941,
    "status": "active",
    "subscription_items": [
      {
        "amount": 4000,
        "billing_cycles": 1,
        "free_quantity": 0,
        "item_price_id": "basic-USD",
        "item_type": "plan",
        "object": "subscription_item",
        "quantity": 4,
        "unit_price": 1000
      },
      {..}
    ],
    "total_dues": 4100,
    "updated_at": 1612890942
  }
}
```

## URL Format

**POST** https://[site].chargebee.com/api/v2/subscriptions/{subscription-id}/update_for_items

## Input Parameters

- `mandatory_items_to_remove` (optional, string, max chars=100)
  A list of item IDs representing the [mandatorily attached addons](/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` (optional, boolean, default=false)
  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` (optional, integer)
  Updates [Net D](https://www.chargebee.com/docs/net_d.html) for the subscription. Net D is the number of days from [`invoice.date`](/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](/docs/api/customers/customer-object#net_term_days) is used instead.

- `invoice_date` (optional, timestamp(UTC) in seconds)
  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[]`](/docs/api/invoices#taxes) and [`line_item_taxes[]`](/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` (optional, timestamp(UTC) in seconds)
  The new start date of a `future` subscription.
  
  **Prerequisites**
  
  -   The subscription `status` must be `future`.

- `trial_end` (optional, timestamp(UTC) in seconds)
  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` (optional, integer, min=0)
  The number of billing cycles the subscription runs before canceling automatically.
  
  **Default value**
  
  -   The value set for the [plan-item price](/docs/api/item_prices#billing_cycles) is used when not provided.

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

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

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

- `auto_collection` (optional, enumerated string)
  Defines whether payments need to be collected automatically for this subscription. Overrides customer's auto-collection property.
  Possible enum values:
    - `on`
      Whenever an invoice is created for this subscription, an automatic charge will be attempted on the payment method available.
    - `off`
      Automatic collection of charges will not be made for this subscription. Use this for offline payments.

- `offline_payment_method` (optional, enumerated string)
  The preferred offline payment method for the subscription.
  Possible enum values:
    - `no_preference`
      No Preference
    - `cash`
      Cash
    - `check`
      Check
    - `bank_transfer`
      Bank Transfer
    - `ach_credit`
      ACH Credit
    - `sepa_credit`
      SEPA Credit
    - `boleto`
      Boleto
    - `us_automated_bank_transfer`
      US Automated Bank Transfer
    - `eu_automated_bank_transfer`
      EU Automated Bank Transfer
    - `uk_automated_bank_transfer`
      UK Automated Bank Transfer
    - `jp_automated_bank_transfer`
      JP Automated Bank Transfer
    - `mx_automated_bank_transfer`
      MX Automated Bank Transfer
    - `custom`
      Custom

- `po_number` (optional, string, max chars=100)
  Purchase order number for this subscription.

- `coupon_ids` (optional, string, max chars=100)
  The list of coupons to be applied to this subscription. You can provide [coupon IDs](/docs/api/coupons/coupon-object#id) or [coupon codes](/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` (optional, boolean, default=false)
  Determines whether the provided `coupon_ids` replace or add to the [existing coupons](/docs/api/subscriptions#coupons) on the subscription.
  
  **Default value**
  
  -   `false` (the provided coupons are added to the existing coupons)

- `prorate` (optional, boolean)
  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` (optional, boolean, default=false)
  **Deprecated**  
  
  -   This option is deprecated; use the [Create a ramp API](/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` (optional, boolean, default=false)
  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` (optional, boolean)
  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` (optional, string, max chars=40)
  The Chargebee payment token generated by [Chargebee JS](https://www.chargebee.com/checkout-portal-docs/3ds-helper-overview.html#using-gateway-s-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` (optional, string, max chars=2000)
  A customer-facing note added to all invoices associated with this subscription. This note is one among [all the notes](/docs/api/invoices/invoice-object#notes) displayed on the invoice PDF.

- `meta_data` (optional, jsonobject)
  A collection of [key-value pairs](/docs/api/advanced-features#metadata) that provides extra information about the subscription.
  
  **Constraints**
  
  -   There's a character limit of 65,535.

- `invoice_immediately` (optional, boolean)
  Determines whether charges raised immediately for the subscription are invoiced immediately or added to [unbilled charges](/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` (optional, boolean)
  If `true` , ignores the [hierarchy relationship](/docs/api/customers/customer-object#relationship) and uses customer as payment and invoice owner.

- `changes_scheduled_at` (optional, timestamp(UTC) in seconds)
  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](/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` (optional, enumerated string)
  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](/docs/api/advanced-features#custom-fields) parameters
  
  **See also**
  
  -   [Impacts on existing scheduled changes](/docs/api/subscriptions/update-subscription-for-items#impact-scheduled-changes).
  Possible enum values:
    - `immediately`
      The subscription change takes effect immediately.
    - `end_of_term`
      **Deprecated**  
      This option is deprecated; use the [Create a ramp API](/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](/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`.

- `contract_term_billing_cycle_on_renewal` (optional, integer, min=1, max=100)
  Number of billing cycles the new contract term should run for, on contract renewal. The default value is the same as `billing_cycles` or a custom value depending on the [site configuration](https://www.chargebee.com/docs/contract-terms.html#configuring-contract-terms) .

- `free_period` (optional, integer, min=1)
  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` (optional, enumerated string)
  The time unit for `free_period`.
  
  **Constraints**
  
  Must be equal to or lower than the [`period_unit`](/docs/api/item_prices#period_unit) of the plan [item price](/docs/api/subscriptions/create-subscription-for-items#subscription_items_item_price_id) of the subscription.
  Possible enum values:
    - `day`
      Charge based on day(s)
    - `week`
      Charge based on week(s)
    - `month`
      Charge based on month(s)
    - `year`
      Charge based on year(s)

- `create_pending_invoices` (optional, boolean)
  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` (optional, boolean)
  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` (optional, enumerated string)
  Applicable only when [End-of-trial Action](https://www.chargebee.com/docs/1.0/trial_periods_hidden.html#how-to-define-the-end-of-trial-actions-for-subscriptions) has been enabled for the site. Whenever the subscription has a trial period, this attribute (parameter) is returned (required) and specifies the operation to be carried out for the subscription once the trial ends.
  Possible enum values:
    - `site_default`
      This is the default value. The action [configured for the site](https://www.chargebee.com/docs/1.0/trial_periods_hidden.html#how-to-define-the-end-of-trial-actions-for-subscriptions) at the time when the trial ends, takes effect.
    - `plan_default`
      The action [configured for the site](https://www.chargebee.com/docs/1.0/trial_periods_hidden.html#how-to-define-the-end-of-trial-actions-for-subscriptions) at the time when the trial ends, takes effect.
    - `activate_subscription`
      The subscription activates and charges are raised for non-metered items.
    - `cancel_subscription`
      The subscription cancels.

- `payment_initiator` (optional, enumerated string)
  The type of initiator to be used for the payment request triggered by this operation.
  Possible enum values:
    - `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` (optional, boolean, default=false)
  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` (optional, string)
  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.
  - `gateway_account_id` (optional, string, max chars=50)
    The gateway account in which these card details are stored.
    
    **Required when**
    
    -   All of the following conditions are met together:
    -   Passing `card` parameter.
    -   There are multiple [payment gateway](https://www.chargebee.com/docs/payments/2.0/payment-gateways-and-configuration/gateway_settings) accounts configured for the site.
    -   [Smart Routing](https://www.chargebee.com/docs/payments/2.0/payment-gateways-and-configuration/gateway_settings#smart-routing) is not configured for card payments.
  - `first_name` (optional, string, max chars=50)
    Cardholder's first name
  - `last_name` (optional, string, max chars=50)
    Cardholder's last name
  - `number` (required if card provided, string, max chars=1500)
    The 16 digit credit card number.
    
    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` (required if card provided, integer, min=1, max=12)
    Card expiry month.
  - `expiry_year` (required if card provided, integer)
    Card expiry year.
  - `cvv` (optional, string, max chars=520)
    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` (optional, enumerated string)
    The customer's preferred card scheme for co-branded cards.
    
    **Note**: Currently, this parameter is only supported for Stripe.
    Possible enum values:
      - `cartes_bancaires`
        A Cartes Bancaires card scheme.
      - `mastercard`
        A MasterCard scheme.
      - `visa`
        A Visa card scheme.
  - `billing_addr1` (optional, string, max chars=150)
    Address line 1, as available in card billing address.
  - `billing_addr2` (optional, string, max chars=150)
    Address line 2, as available in card billing address.
  - `billing_city` (optional, string, max chars=50)
    City, as available in card billing address.
  - `billing_state_code` (optional, string, max chars=50)
    The [ISO 3166-2 state/province code](https://www.iso.org/obp/ui/#search/code) without the country prefix. Currently supported for USA, Canada, 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` (optional, string, max chars=50)
    The state/province name. Is set by Chargebee automatically for US, Canada, India and UAE, if `billing_state_code` is provided.
  - `billing_zip` (optional, string, max chars=20)
    Postal or Zip code, as available in card billing address.
  - `billing_country` (optional, string, max chars=50)
    The billing address country of the customer. Must be one of [ISO 3166 alpha-2 country code](https://www.iso.org/iso-3166-country-codes.html) .
    
    **Note**: If you enter an invalid country code, the system will return an error.
    
    **Brexit**
    
    If you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 or later, or have [manually enable](https://www.chargebee.com/docs/brexit.html#what-needs-to-be-done-in-chargebee) the Brexit configuration, then `XI` (the code for **United Kingdom - Northern Ireland**) is available as an option.
  - `additional_information` (optional, jsonobject)
    -   `checkout_com`: While adding a new payment method using [permanent token](/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

- `payment_method` (optional, enumerated string)
  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](/docs/api/subscriptions/update-subscription-for-items#use-cases) to learn more.
  - `type` (optional, enumerated string)
    The type of payment method. For more details refer [Update payment method for a customer](/docs/api/customers/update-payment-method-for-a-customer) API under Customer resource.
    Possible enum values:
      - `card`
        Card based payment including credit cards and debit cards. Details about the card can be obtained from the card resource.
      - `paypal_express_checkout`
        Payments made via PayPal Express Checkout.
      - `amazon_payments`
        Payments made via Amazon Payments.
      - `direct_debit`
        Represents bank account for which the direct debit or ACH agreement/mandate is created.
      - `generic`
        Payments made via Generic Payment Method.
      - `alipay`
        Payments made via Alipay.
        
        This payment source is deprecated.
      - `unionpay`
        Payments made via UnionPay.
      - `apple_pay`
        Payments made via Apple Pay.
      - `wechat_pay`
        Payments made via WeChat Pay.
        
        This payment source is deprecated.
      - `ideal`
        Payments made via iDEAL.
      - `google_pay`
        Payments made via Google Pay.
      - `sofort`
        Payments made via Sofort.
      - `bancontact`
        Payments made via Bancontact Card.
      - `giropay`
        Payments made via giropay.
      - `dotpay`
        Payments made via Dotpay.
      - `upi`
        UPI Payments.
      - `netbanking_emandates`
        Netbanking (eMandates) Payments.
      - `venmo`
        Payments made via Venmo
      - `pay_to`
        Payments made via PayTo
      - `faster_payments`
        Payments made via Faster Payments
      - `sepa_instant_transfer`
        Payments made via Sepa Instant Transfer
      - `automated_bank_transfer`
        Represents virtual bank account using which the payment will be done.
      - `klarna_pay_now`
        Payments made via Klarna Pay Now
      - `online_banking_poland`
        Payments made via Online Banking Poland
      - `payconiq_by_bancontact`
        Payments made via Payconiq by Bancontact.
      - `electronic_payment_standard`
        Electronic Payment Standard
      - `kbc_payment_button`
        KBC Payment Button
      - `pay_by_bank`
        Pay By Bank
      - `trustly`
        Trustly
      - `stablecoin`
        Payments made via Stablecoin.
      - `kakao_pay`
        Payments made via Kakao Pay.
      - `naver_pay`
        Payments made via Naver Pay.
      - `revolut_pay`
        Payments made via Revolut Pay.
      - `cash_app_pay`
        Payments made via Cash App Pay.
      - `twint`
        Payments made via Twint
      - `go_pay`
        Payments made via GoPay
      - `grab_pay`
        Payments made via GrabPay
      - `pay_co`
        Payments made via PayCo
      - `after_pay`
        Payments made via Afterpay
      - `swish`
        Payments made via Swish
      - `payme`
        Payments made via PayMe
      - `pix`
        Payments made via Pix
      - `klarna`
        Payments made via Klarna.
      - `alipay_hk`
        Payments made via Alipay HK.
      - `paypay`
        Payments made via PayPay
      - `gcash`
        Payments made via GCash.
      - `south_korean_cards`
        Payments made via South Korean Cards
      - `paynow`
      - `bizum`
      - `promptpay`
      - `dana`
        Payments made via Dana.
      - `touch_n_go`
        Payments made via Touch 'n Go.
      - `tamara`
        Payments made via Tamara.
      - `qpay`
        Payments made via Qpay.
      - `ovo`
      - `momo`
      - `mercado_pago`
      - `nequi`
      - `nupay`
      - `picpay`
      - `thai_qr`
      - `blik`
      - `fpx`
      - `wero`
      - `p24`
      - `affirm_pay`
      - `rakuten_pay`
  - `gateway_account_id` (optional, string, max chars=50)
    The gateway account in which this payment source is stored.
  - `reference_id` (optional, string, max chars=200)
    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 card this will be the identifier provided by the gateway/card vault for the specific payment method resource. **Note:** This is not the one-time temporary token provided by gateways like Stripe.
    
    For more details refer [Update payment method for a customer](/docs/api/customers/update-payment-method-for-a-customer) API under Customer resource.
  - `tmp_token` (required if reference_id not provided, string, max chars=65k)
    Single-use tokens 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` (optional, string, max chars=50)
    [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.
    
    If 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, then `XI` (the code for **United Kingdom - Northern Ireland** ) is available as an option.
  - `additional_information` (optional, jsonobject)
    -   `checkout_com`: While adding a new payment method using [permanent token](/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

- `payment_intent` (optional, string)
  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.
  - `id` (optional, string, max chars=150)
    Identifier for the [`payment_intent`](/docs/api/payment_intents) resource. If you provide this parameter, you do not need to pass other `payment_intent` parameters.
    
    **Prerequisites**
    
    -   The value of [`payment_intent.status`](/docs/api/payment_intents/payment_intent-object#status) must be `authorized`.
  - `gateway_account_id` (required if payment intent token provided, string, max chars=50)
    The gateway account used for performing the 3DS flow.
  - `gw_token` (optional, string, max chars=65k)
    Identifier for 3DS transaction/verification object at the gateway. Can be passed only after successfully completing the 3DS flow. Refer [3DS implementation in Chargebee](/docs/api/3ds_card_payments) to find out the gateway-specific gw\_token format. Applicable when you are using gateway APIs directly for completing the 3DS flow.
  - `payment_method_type` (optional, enumerated string)
    The payment method type.
    
    **Default value**
    
    -   `card`
    Possible enum values:
      - `card`
        card
      - `ideal`
        ideal
      - `sofort`
        sofort
      - `bancontact`
        bancontact
      - `google_pay`
        google\_pay
      - `dotpay`
        dotpay
      - `giropay`
        giropay
      - `apple_pay`
        apple\_pay
      - `upi`
        upi
      - `netbanking_emandates`
        netbanking\_emandates
      - `paypal_express_checkout`
        paypal\_express\_checkout
      - `direct_debit`
        direct\_debit
      - `boleto`
        boleto
      - `venmo`
        Venmo
      - `amazon_payments`
        Amazon Payments
      - `pay_to`
        PayTo
      - `faster_payments`
        Faster Payments
      - `sepa_instant_transfer`
        Sepa Instant Transfer
      - `klarna_pay_now`
        Klarna Pay Now
      - `online_banking_poland`
        Online Banking Poland
      - `payconiq_by_bancontact`
        Payments made via Payconiq by Bancontact.
      - `electronic_payment_standard`
        Electronic Payment Standard
      - `kbc_payment_button`
        KBC Payment Button
      - `pay_by_bank`
        Pay By Bank
      - `trustly`
        Trustly
      - `stablecoin`
        Payments made via Stablecoin.
      - `kakao_pay`
        Payments made via Kakao Pay.
      - `naver_pay`
        Payments made via Naver Pay.
      - `revolut_pay`
        Payments made via Revolut Pay.
      - `cash_app_pay`
        Payments made via Cash App Pay.
      - `wechat_pay`
        Payments made via WeChat Pay.
      - `alipay`
        Payments made via Alipay.
      - `twint`
        Payments made via Twint
      - `go_pay`
        Payments made via GoPay
      - `grab_pay`
        Payments made via GrabPay
      - `pay_co`
        Payments made via PayCo
      - `after_pay`
        Payments made via Afterpay
      - `swish`
        Payments made via Swish
      - `payme`
        Payments made via PayMe
      - `pix`
        Pix
      - `klarna`
        Payments made via Klarna.
      - `alipay_hk`
        Payments made via Alipay HK.
      - `paypay`
        PayPay
      - `gcash`
        Payments made via GCash.
      - `south_korean_cards`
        Payments made via South Korean Cards
      - `paynow`
      - `bizum`
      - `promptpay`
      - `dana`
        Payments made via Dana.
      - `touch_n_go`
        Payments made via Touch 'n Go.
      - `tamara`
        Payments made via Tamara.
      - `qpay`
        Payments made via Qpay.
      - `ovo`
      - `momo`
      - `mercado_pago`
      - `nequi`
      - `nupay`
      - `picpay`
      - `thai_qr`
      - `blik`
      - `fpx`
      - `wero`
      - `p24`
      - `affirm_pay`
      - `rakuten_pay`
  - `reference_id` (optional, string, max chars=65k)
    Identifier for Braintree permanent token. Applicable when you are using Braintree APIs for completing the 3DS flow.
  - `additional_information` (optional, jsonobject)
    -   `checkout_com`: While adding a new payment method using [permanent token](/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

- `billing_address` (optional, string)
  Parameters for billing\_address
  - `first_name` (optional, string, max chars=150)
    The first name of the billing contact.
  - `last_name` (optional, string, max chars=150)
    The last name of the billing contact.
  - `email` (optional, string, max chars=70)
    The email address.
  - `company` (optional, string, max chars=250)
    The company name.
  - `phone` (optional, string, max chars=50)
    The phone number.
  - `line1` (optional, string, max chars=150)
    Address line 1
  - `line2` (optional, string, max chars=150)
    Address line 2
  - `line3` (optional, string, max chars=150)
    Address line 3
  - `city` (optional, string, max chars=50)
    The name of the city.
  - `state_code` (optional, string, max chars=50)
    The [ISO 3166-2 state/province code](https://www.iso.org/obp/ui/#search/code) without the country prefix. Currently supported for USA, Canada, 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` (optional, string, max chars=50)
    The state/province name. Is set by Chargebee automatically for US, Canada, India and UAE, if `state_code` is provided.
  - `zip` (optional, string, max chars=20)
    Zip or postal code. The number of characters is validated according to the rules [specified here](https://chromium-i18n.appspot.com/ssl-address) .
  - `country` (optional, string, max chars=50)
    The billing address country of the customer. Must be one of [ISO 3166 alpha-2 country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) .
    
    **Brexit**
    
    If you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 or later, or have [manually enable](https://www.chargebee.com/docs/brexit.html#what-needs-to-be-done-in-chargebee) the Brexit configuration, then `XI` (the code for **United Kingdom - Northern Ireland**) is available as an option.
  - `validation_status` (optional, enumerated string, default=not_validated)
    The address verification status.
    Possible enum values:
      - `not_validated`
        Address is not yet validated.
      - `valid`
        Address was validated successfully.
      - `partially_valid`
        The address is valid for taxability but has not been validated for shipping.
      - `invalid`
        Address is invalid.

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

- `statement_descriptor` (optional, string)
  Parameters for statement\_descriptor
  - `descriptor` (optional, string, max chars=65k)
    Payment transaction descriptor text to help your customer easily recognize the transaction. When this value is passed this will override the [transaction descriptor](https://www.chargebee.com/docs/1.0/transaction_descriptors.html) text configured in the Chargebee site for all the subscription renewal transactions.

- `customer` (optional, string)
  Parameters for customer
  - `vat_number` (optional, string, max chars=20)
    The VAT/tax registration number for the customer. For customers with `[billing_address](/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](/docs/api/customers/customer-object#vat_number_prefix)` .
  - `vat_number_prefix` (optional, string, max chars=10)
    An overridden value for the first two characters of the [full VAT number](https://en.wikipedia.org/wiki/VAT_identification_number). Only applicable specifically for customers with `[billing_address](/docs/api/customers/customer-object#billing_address)`
    
    `country` as `XI` (which is **United Kingdom - Northern Ireland** ).
    
    When you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 or have [manually enabled](https://www.chargebee.com/docs/brexit.html#what-needs-to-be-done-in-chargebee) the Brexit configuration, you have the option of setting `[billing_address](/docs/api/customers/customer-object#billing_address)`
    
    `country` as `XI`. That's the code for **United Kingdom - Northern Ireland**. The first two characters of the VAT number in such a case is `XI` by default. However, if the VAT number was registered in UK, the value should be `GB`. Set `vat_number_prefix` to `GB` for such cases.
  - `entity_identifier_scheme` (optional, string, max chars=50)
    The Peppol BIS scheme associated with the `[vat_number](/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.
  - `is_einvoice_enabled` (optional, boolean)
    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` (optional, enumerated string)
    Determines whether to send einvoice manually or automatic.
    Possible enum values:
      - `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.
  - `entity_identifier_standard` (optional, string, default=iso6523-actorid-upis, max chars=50)
    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.
  - `business_customer_without_vat_number` (optional, boolean)
    Confirms that a customer is a valid business without an EU/UK VAT number.
  - `registered_for_gst` (optional, boolean)
    Confirms that a customer is registered under GST. If set to `true` then the [Reverse Charge Mechanism](https://www.chargebee.com/docs/australian-gst.html#reverse-charge-mechanism) is applicable. This field is applicable only when Australian GST is configured for your site.

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

- `billing_override` (optional, long)
  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) .
  - `max_excess_payment_usage` (optional, long, min=-1)
    Maximum amount of [excess payments](/docs/api/customers/customer-object#excess_payments) that can be automatically applied to a single invoice associated with this subscription.
    
    **Supported values:**
    
    -   `-1`: Set to `-1` to reset the subscription-level limit. In this case, the site-level configuration will apply, whether it is configured to Auto Apply or Do Not Auto Apply excess payments.
    -   `0`: Disable auto-application for the subscription. No excess payments will be automatically applied to invoices.
    -   Any positive value: Specifies the maximum amount of excess payments that can be automatically applied to a single invoice for this subscription.
  - `max_refundable_credits_usage` (optional, long, min=-1)
    Maximum amount of [refundable credits](/docs/api/customers/customer-object#refundable_credits) that can be automatically applied to a single invoice associated with this subscription.
    
    **Supported values:**
    
    -   `-1`: Set to `-1` to reset the subscription-level limit. In this case, the site-level configuration will apply, whether it is configured to Auto Apply or Do Not Auto Apply refundable credits.
    -   `0`: Disable auto-application for the subscription. No refundable credits will be automatically applied to invoices.
    -   Any positive value: Specifies the maximum amount of refundable credits that can be automatically applied to a single invoice for this subscription.

- `subscription_items` (optional, array)
  The list of item prices to add or update in the subscription.
  
  **Note** See `replace_items_list` for more details.
  - `item_price_id` (required, string, max chars=100)
    The unique identifier of the item price to add or update in the subscription.
    
    **Constraints**
    
    -   The [item price currency](item_prices#currency_code) must match the [subscription's currency](subscriptions#currency_code).
  - `quantity` (optional, integer)
    The quantity of the item price purchased.
    
    **Prerequisites**
    
    -   The item price `pricing_model` must be `per_unit`, `stairstep`, or `tiered`.
  - `quantity_in_decimal` (optional, string, max chars=33)
    The decimal representation of the quantity of the item purchased.
    
    **Prerequisites**
    
    -   The item price `pricing_model` must be `per_unit`, `stairstep`, or `tiered`.
    -   [Multi-decimal pricing](getting-started) must be enabled.
  - `unit_price` (optional, in cents)
    The price or per-unit price of the item. Overrides the price set for the item price.
    
    **Prerequisites**
    
    -   The `pricing_model` of the item price must be `flat_fee` or `per_unit`.
    -   [Price overriding](https://www.chargebee.com/docs/price-override.html) must be enabled for the site.
    
    **Default value**
    
    -   The value set for the [item price](item_prices/item-price-object) is used when not provided.
    -   If `changes_scheduled_at` is in the past and `unit_price` is not passed, the item price's current unit price is considered even if the item price did not exist on the date.
  - `unit_price_in_decimal` (optional, string, max chars=39)
    The decimal representation of the price or per-unit price of the item. Overrides the price set for the item price.
    
    **Prerequisites**
    
    -   [Price overriding](https://www.chargebee.com/docs/price-override.html) must be enabled for the site.
    -   [Multi-decimal pricing](getting-started) must be enabled.
    
    **Default value**
    
    -   The [value set for the item price](item_prices/item_price-object#price) is used when not provided.
    -   If `changes_scheduled_at` is in the past and `unit_price_in_decimal` is not passed, the item price's current unit price is considered even if the item price did not exist on the date.
    
    **Constraints**
    
    -   Provide the value as a decimal string in major units of the currency.
  - `billing_cycles` (optional, integer)
    For plan-item prices: The number of billing cycles the subscription runs before canceling automatically.
    
    For addon-item prices: The number of subscription billing cycles for which the addon is included. Only applicable when [addon billing cycles](https://www.chargebee.com/docs/2.0/addons-billingcycle.html) are enabled.
    
    **Default value**
    
    -   For plan-item prices: The value set for the [item price](item_prices/item-price-object) is used.
    -   For addon-item prices: The value set under [attached addons](attached_items/attached-item-object) is used. If that value is not provided, the value set for the [item price](item_prices/item-price-object) is used.
  - `trial_end` (optional, timestamp(UTC) in seconds)
    The date/time when the trial period of the item ends. Applies to plan-items and--when [enabled](https://www.chargebee.com/docs/2.0/addons-trial.html) --addon-items as well.
  - `service_period_days` (optional, integer)
    The service period of the item in days from the day of charge.
  - `charge_on_event` (optional, enumerated string)
    When `charge_on_option` option is set to `on_event` , this parameter specifies the event at which the charge-item is applied to the subscription. This parameter only applies to charge-items.
    Possible enum values:
      - `subscription_creation`
        the time of creation of the subscription.
      - `subscription_trial_start`
        the time when the trial period of the subscription begins.
      - `plan_activation`
        same as subscription activation, but also includes the case when the plan-item of the subscription is changed.
      - `subscription_activation`
        the moment a subscription enters an `active` or `non-renewing` state. Also includes reactivations of canceled subscriptions.
      - `contract_termination`
        when a contract term is [terminated](/docs/api/subscriptions/cancel-subscription-for-items#contract_term_cancel_option) .
  - `charge_once` (optional, boolean)
    Indicates if the charge-item is to be charged only once or each time the `charge_on_event` occurs. This parameter only applies to charge-items.
  - `charge_on_option` (optional, enumerated string)
    Indicates when the charge-item is to be charged. This parameter only applies to charge-items.
    Possible enum values:
      - `immediately`
        The item is charged immediately on being added to the subscription.
      - `on_event`
        The item is charged at the occurrence of the event specified as `charge_on_event` .
  - `description` (optional, string, max chars=500)
    **Limited availability**
    
    Subscription-level item descriptions are available only on sites where this feature is enabled. Please reach out to the Chargebee [support](https://www.chargebee.com/docs/billing/2.0/kb/getting-started/how-to-contact-chargebees-support-team?utm_source=docs_api&utm_medium=content&utm_campaign=support) to enable this feature.
    
    A description for this item that applies only to this subscription. When set, it is used on the customer-facing invoice instead of the description configured for the item price, and is returned as `entity_description` on the invoice [line item](/docs/api/invoices/invoice-object#invoice_line_items).
    
    Omit this parameter to retain the description currently stored for the item. Pass an empty value to remove it, after which the description configured for the item price is used.
    
    **Constraints**
    
    -   Maximum 500 characters.
    -   Whether a description is shown on the invoice at all continues to be controlled by the item price's [show\_description\_in\_invoices](/docs/api/item_prices#show_description_in_invoices) setting. This parameter determines which description is shown, not whether one is shown.
  - `proration_type` (optional, enumerated string)
    Specifies how to manage charges or credits for the addon item price during this subscription update.
    
    **Prerequisites**
    
    -   The item price must have `item_type` = `addon`.
    -   The item price must have `pricing_model` = `per_unit`.
    -   The change to the subscription must take effect [immediately](subscriptions/update-subscription-for-items#change_option).
    
    **Default value**
    
    -   If you don't provide a value, Chargebee determines the proration logic based on the following precedence: this parameter > [`prorate`](subscriptions/update-subscription-for-items#prorate) parameter > [`item_price.proration_type`](item_prices/item_price-object#proration_type) > [site-wide proration](https://www.chargebee.com/docs/2.0/proration.html#proration-for-subscription-change) setting.
    
    **Constraints**
    
    -   Once set, this parameter is saved as part of the [`subscription.subscription_items`](subscriptions/subscription-object#subscription_items) attributes and automatically applies to any additional changes to the addon during the current term. It's removed from the subscription attributes at the next term renewal. You can't alter this parameter's value within the current term via later API calls.
    Possible enum values:
      - `full_term`
        Charge the full price of the addon or give the full credit. Don't apply any proration.
      - `partial_term`
        Prorate the charges or credits for the rest of the current term.
      - `none`
        Don't apply any charges or credits for the addon.
  - `usage_accumulation_reset_frequency` (optional, enumerated string)
    Specifies the frequency at which the usage counter needs to be reset.
    Possible enum values:
      - `never`
        Accumulates usage without ever resetting it.
      - `subscription_billing_frequency`
        Accumulates usage until the subscription's billing frequency ends.

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

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

## Returns

- `subscription` (Subscription object)
  Resource object representing subscription

- `customer` (Customer object)
  Resource object representing customer

- `card` (Card object)
  Resource object representing card

- `invoice` (Invoice object)
  Resource object representing invoice

- `unbilled_charges` (optional)
  Resource object representing unbilled\_charge

- `credit_notes` (optional)
  Resource object representing credit\_note
