Note: This operation optionally supports 3DS verification flow. To achieve the same, create the Payment Intent and pass it as input parameter to this API.
Creates a new subscription for an existing customer. You can attach a plan, plan quantity, one or more addons and coupon while creating this subscription.
If the plan does not have a trial period and if any of the recurring-item has charges, then the customer is charged immediately if auto_collection is turned 'on'. In that case, subscription is created only if the customer has a payment method on file and attempted payment is successful.
If an invoice gets generated during this operation, available Credits and Excess Payments will be automatically applied.
Sample Request
URL Format
Input Parameters
A unique and immutable identifier for the subscription. If not provided, it is autogenerated.
The decimal representation of the quantity of the plan purchased. Can be provided for quantity-based plans and only when multi-decimal pricing is enabled.
Amount that will override the Plan's default price. The unit depends on the type of currency .
When price overriding is enabled for the site, the price or per-unit price of the plan can be set here. The value set for the plan is used by default. Provide the value as a decimal string in major units of the currency. Can be provided only when multi-decimal pricing is enabled.
Amount that will override the default setup fee. The unit depends on the type of currency .
The time at which the trial ends for this subscription. Can be specified to override the default trial period.If '0' is passed, the subscription will be activated immediately.
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 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.
List of addons IDs that are mandatory to the plan and has to be removed from the subscription.
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. .
Defines whether payments need to be collected automatically for this subscription. Overrides customer's auto-collection property.
Whenever an invoice is created for this subscription, an automatic charge will be attempted on the payment method available.
Automatic collection of charges will not be made for this subscription. Use this for offline payments.
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
.
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. 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
Returns
Resource object representing subscription
Resource object representing customer
Resource object representing card
Resource object representing invoice
Resource object representing unbilled_charge