Introducing the Better Auth Chargebee plugin: Use it to handle subscriptions, billing, and auth seamlessly.
Chargebeechargebee API

Import contract term

Idempotency Supported

Imports an active or historical contract term for a subscription.

Use this operation to import contract terms when migrating subscriptions from another billing system, or to add historical contract term data for existing subscriptions. You can import both active contract terms (currently running) and historical contract terms (completed, canceled, or terminated).

Prerequisites & Constraints

  • The Contract Terms feature must be enabled on the site.
  • The Multi-Frequency Billing feature must not be enabled for the site.
  • The subscription must have a fixed billing cycle (the remaining_billing_cycles must be set).
  • The contract term period must not overlap with any existing contract terms for the subscription.

Impacts

Contract term

  • A new contract_term resource is created and associated with the subscription.
  • For active contract terms:
  • the total_contract_value is calculated as the sum of the contract estimate and the total_amount_raised parameter.
  • The contract_end date is calculated based on the contract_start date and the billing_cycle parameter.

Implementation Notes

  • Check the subscription's remaining_billing_cycles attribute. If it is not set, the subscription is set to forever renewal. Update the subscription to a fixed billing cycle before importing a contract term.
  • Check for existing contract terms for the subscription. Ensure that the the contract_start and contract_end dates don't overlap with any existing contract term for the subscription.

Sample Request

Sample Result[JSON]

URL Format

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

Input Parameters

contract_term_billing_cycle_on_renewal
optional, integer, min=1, max=100

The number of billing cycles the new contract term should run for when the contract term renews. This value is used when action_at_term_end is renew or renew_once.

Constraints

  • Should not be sent when action_at_term_end is cancel or evergreen.

Default value

  • Defaults to the value of billing_cycle or a custom value depending on the site configuration.
contract_term
Parameters for contract_term
pass parameters as contract_term[<param name>]

Returns

Contract term object
Resource object representing contract_term