Note:
This endpoint optionally supports 3DS. To use it create
a payment_intent
and provide it via this endpoint.
Creates a new subscription for an existing customer in Chargebee. Any available credits and excess payments for the customer are automatically applied on the invoice.
Sample Request
URL Format
Input Parameters
A unique and immutable identifier for the subscription. If not provided, it is autogenerated.
The unique ID of the business entity this subscription should be linked to. Applicable only when multiple business entities have been created for the site. This must be the same as the business entity of the {"customer_id"} for the operation to be successful.
Note
An alternative way of passing this parameter is by means of a custom HTTP header.
End of the trial period for the subscription. This overrides the trial period set for the plan-item. The value must be later than start_date.
Set it to 0
to have no trial period.
Specifies the number of billing cycles for the subscription. The behavior of the subscription after the billing cycles have completed depends on whether the subscription is on a contract term or not.
- When the subscription is not on a contract term: if
billing_cyclesis not provided, then the billing cycles set for the plan-item price is used. Moreover, once thebilling_cycleshave completed, the subscription cancels. - When the subscription is on a contract term: Providing
billing_cyclesis mandatory. Moreover, once thebilling_cycleshave completed, the behavior of the subscription is determined by thecontract_term[action_at_term_end]parameter.
Item ids of mandatorily attached addons that are to be removed from the subscription.
Defines Net D for the subscription. Net D is the number of days within which any invoice raised for the subscription must be paid.
- If a value is provided: Net D is set explicitly for the subscription to the value provided. The value must be one among those defined in the site configuration.
- If not provided: The attribute is not set and therefore not returned by the API. In this case, when an invoice is raised - whether now or later - the
net_term_daysdefined at the customer level is considered. .
The date/time at which the subscription is to start. If not provided, the subscription starts immediately. You can provide a value in the past as well. This is called backdating the subscription creation and is done when the subscription has already been provisioned but its billing has been delayed. Backdating is allowed only when the following prerequisites are met:
- Backdating is enabled for subscription creation operations.
- The current day of the month does not exceed the limit set in Chargebee for backdating such operations. This day is typically the day of the month by which the accounting for the previous month must be closed.
- The date is not more than duration X into the past, where X is the billing period of the plan. For example, if the period of the plan in the subscription is 2 months and today is 14th April,
start_datecannot be earlier than 14th February. .
The number of subscription billing cycles (including the first one) to invoice in advance .
Override the billing alignment mode for Calendar Billing. Only applicable when using Calendar Billing. The default value is that which has been configured for the site.
Subscription period will be aligned with the configured billing date immediately, with credits or charges raised accordingly..
Subscription period will be aligned with the configured billing date at the next renewal.
The preferred offline payment method for the subscription.
No Preference
Cash
Check
Bank Transfer
ACH Credit
List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes.
Id of the payment source to be attached to this subscription.
If true
, ignores the hierarchy relationship
and uses customer as payment and invoice owner.
A customer-facing note added to all invoices associated with this subscription. This note is one among all the notes displayed on the invoice PDF.
The document date displayed on the invoice PDF. The default value is the current date. Provide this value to backdate the invoice. Backdating an invoice is done for reasons such as booking revenue for a previous date or when the subscription is effective as of a past date. Moreover, if create_pending_invoices
is set to true
, and if the site is configured to set invoice dates to the date of closing, then upon invoice closure, this date is changed to the invoice closing date. taxes
and line_item_taxes
are computed based on the tax configuration as of invoice_date.
When passing this parameter, the following prerequisites must be met:
invoice_datemust be in the past.- It is not earlier than
start_date. - It is not more than one calendar month into the past. Eg. If today is 13th January, then you cannot pass a value that is earlier than 13th December.
invoice_immediatelyis true. .
A collection of key-value pairs that provides extra information about the subscription.
Note: There's a character limit of 65,535.
If there are charges raised immediately for the subscription, this parameter specifies whether those charges are to be invoiced immediately or added to unbilled charges. The default value is as per the site settings .
Note:
invoice_immediately
only affects charges that are raised at the time of execution of this API call. Any charges scheduled to be raised in the future are not affected by this parameter.
.
Indicates whether the primary payment source should be replaced with this payment source. In case of Create Subscription for Customer endpoint, the default value is True. Otherwise, the default value is False.
The period of time by which the first term of the subscription is to be extended free-of-charge. The value must be in multiples of free_period_unit.
The unit of time in multiples of which the free_period parameter is expressed. The value must be equal to or lower than the period_unit attribute of the plan chosen.
Charge based on day(s)
Charge based on week(s)
Charge based on month(s)
Charge based on year(s)
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
.
Indicates whether the invoices for this subscription are generated with a pending status. This attribute is set to true automatically when the subscription has item prices that belong to metered items.
You can also set this to true explicitly using the create/update subscription operations. This is useful in the following scenarios:
- When tracking usages and calculating usage-based charges on your end. You can then add them to the subscription as a one-time charge at the end of the billing term.
- When you need to inspect all charges before closing invoices for this subscription. Applicable only when Metered Billing is enabled for the site .
Set to false
to override for this subscription, the site-level setting
for auto-closing invoices. Only applicable when auto-closing invoices has been enabled for the site. This attribute has a higher precedence than the same attribute at the customer level
.
If you want to bill the usages from the previous billing cycle, set this parameter to true. This is useful if the subscription has moved from another system into Chargebee and you haven't closed the previous cycle's invoice yet. This creates a pending invoice immediately on subscription creation, to which you can add usages for the previous cycle.
If any non-metered items are present for the current term, they're also added to this pending invoice. As with all pending invoices, this invoice is also closed automatically or via an API call. This parameter can be passed only when the create_pending_invoices is true
.
Applicable only when End-of-trial Action 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.
This is the default value. The action configured for the site at the time when the trial ends, takes effect.
The action configured for the site at the time when the trial ends, takes effect.
The subscription activates and charges are raised for non-metered items.
The subscription cancels.
The type of initiator to be used for the payment request triggered by this operation.
Pass this value to indicate that the request is initiated by the customer
Pass this value to indicate that the request is initiated by the merchant
Specify limits on how credits and payments are applied to individual invoices for the subscription. Contact Support to enable this feature. Note: These limits do not apply to consolidated invoices .
Returns
Resource object representing subscription
Resource object representing customer
Resource object representing card
Resource object representing invoice
Resource object representing unbilled_charge