POST /subscriptions/{subscription-id}/cancel_for_items

Cancels the specified subscription.

Subscription ramps

If ramps are scheduled for the subscription, this operation deletes any ramps that are set to become effective on or after the subscription's cancellation time.

Contract terms

If the subscription has contract terms, it can only be canceled by terminating the contract using the contract_term_cancel_option. The contract term and the subscription are canceled together.

Contract terms parameters

Servers

Path parameters

Name Type Required Description
subscription-id String Yes

Request headers

Name Type Required Description
chargebee-request-origin-device String No

The device from which the customer has made the request

Content-Type String Yes The media type of the request body.

Default value: "application/x-www-form-urlencoded"

chargebee-event-webhook String No

skip only webhooks

Possible values:

  • "all-disabled"
chargebee-business-entity-id String No

If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation.

chargebee-event-actions String No

skip all actions to be done on the events

Possible values:

  • "all-disabled"
chargebee-request-origin-user String No

The email address of your customer/user. Use this when the email address has only ASCII characters.

chargebee-request-origin-ip String No

The IP address of the customer where the request originated

chargebee-request-origin-user-encoded String No

The Base64-encoded email address of your customer/user. Use this if the email address has UTF-8 characters. When this header is provided, the header chargebee-request-origin-user is ignored.

chargebee-event-email String No

skip only emails

Possible values:

  • "all-disabled"

Request body fields

Name Type Required Description
cancel_option String No
If the subscription does not have a contract term:

Determines when to cancel the subscription.

If the subscription has a contract term:

This parameter is not applicable. * end_of_billing_term - This is used to cancel a subscription either at the end of the advance term, if it's billed for future renewals or at the end of its current billing cycle * end_of_term - This is used to cancel a subscription at the end of the current billing cycle * immediately - This is used to cancel the subscription with immediate effect * specific_date - This is used to cancel a subscription on a specified date. The change occurs as of the date/time defined in cancel_at

Possible values:

  • "end_of_term"
  • "immediately"
  • "specific_date"
  • "end_of_billing_term"
end_of_term Boolean No

(Deprecated) Use cancel_option instead.

Applicable only when the subscription does not have contract terms.

Set this to true if you want to cancel the subscription at the end of the current subscription billing cycle. The subscription status changes to non_renewing.

Default value: false

cancel_reason_code String No

Reason code for canceling the subscription. Must be one from a list of reason codes set in the Chargebee app in Settings > Configure Chargebee > Reason Codes > Subscriptions > Subscription Cancellation. Must be passed if set as mandatory in the app. The codes are case-sensitive.

refundable_credits_handling String No
If the subscription does not have a contract term:

Specifies how to handle refundable credits when canceling immediately (i.e., cancel_option is immediately). If not specified, the site-level setting is used.

If the subscription has a contract term:

Specifies how to handle refundable credits when contract_term_cancel_option is terminate_immediately. If not specified, the site-level setting is used. * schedule_refund - Refunds remaining credits after applying them to any past due invoices. * no_action - No action is taken.

Possible values:

  • "schedule_refund"
  • "no_action"
unbilled_charges_option String No
If the subscription does not have a contract term:

Specifies how to handle unbilled charges when canceling immediately (i.e., cancel_option is immediately). If not specified, the site-level setting is used.

If the subscription has a contract term:

Specifies how to handle unbilled charges when contract_term_cancel_option is terminate_immediately. If not specified, the site-level setting is used. * invoice - An invoice is generated immediately with the unbilled charges. * delete - The unbilled charges are deleted.

Possible values:

  • "delete"
  • "invoice"
account_receivables_handling String No
If the subscription does not have a contract term:

Specifies how to handle past due invoices when canceling immediately (i.e., cancel_option is immediately). If not specified, the site-level setting is used.

If the subscription has a contract term:

Specifies how to handle past due invoices when contract_term_cancel_option is terminate_immediately. If not specified, the site-level setting is used. * no_action - No action is taken. * write_off - Applies excess payments and refundable credits to past due invoices. Any remaining balance is written off.
Note: The credit note for the write-off is not included in the API response. * schedule_payment_collection - Applies excess payments and refundable credits to past due invoices. If any amount remains and auto_collection is on, the remaining amount is automatically charged to the available payment method.

Possible values:

  • "write_off"
  • "schedule_payment_collection"
  • "no_action"
contract_term_cancel_option String No

Required when the subscription has a contract term. Determines when to cancel the subscription along with the contract term. * terminate_immediately -

Cancels the subscription and contract term immediately. Sets the contract term's status to terminated and collects any termination fee, if applicable.
To specify the termination fee, include a single object in the subscription_items array. If not specified, the default termination fee is applied (if configured). * end_of_contract_term -

Prevents the contract term from renewing and schedules the subscription for cancellation at the end of the contract term. * specific_date -

Cancels the subscription and contract term on the date specified by cancel_at. Sets action_at_term_end to cancel.
Note : Contact Chargebee Support to enable this option for your Chargebee site. * end_of_subscription_billing_term -

Cancels the subscription and contract term at the end of the current billing cycle. Sets action_at_term_end to cancel.
Note : Contact Chargebee Support to enable this option for your Chargebee site.

Possible values:

  • "terminate_immediately"
  • "end_of_subscription_billing_term"
  • "end_of_contract_term"
  • "specific_date"
cancel_at Integer No
If the subscription does not have a contract term:

Specifies the date and time when the subscription should be canceled. Do not use this parameter when end_of_term is set to true.

If the subscription has a contract term:

Applicable only when contract_term_cancel_option is specific_date. Specifies the date and time to cancel the subscription and contract term.

Backdating

You can set a past date to backdate the cancellation. Backdating is allowed only if the following conditions are met:

  • Backdating is enabled for subscription cancellation.
  • The current date does not exceed the backdating limit configured in Chargebee Billing.
  • The date is on or after the current_term_start.
  • The date is on or after the most recent change involving:
    • Addition/change/removal of plan or addon item prices.
    • Addition of charge item prices.
  • The date is not more than one billing period into the past. For example, if the plan's billing period is two months and today is April 14, cancel_at cannot be earlier than February 14.
invoice_date Integer No

The document date displayed on the invoice PDF. The default value is the current date. Provide this value to backdate the invoice. Backdating an invoice is done for reasons such as booking revenue for a previous date or when the subscription is effective as of a past date. Moreover, if create_pending_invoices is true, and if the site is configured to set invoice dates to date of closing, then upon invoice closure, this date is changed to the invoice closing date. taxes and line_item_taxes are computed based on the tax configuration as of invoice_date. When passing this parameter, the following prerequisites must be met:

  • invoice_date must be in the past.
  • invoice_date is not more than one calendar month into the past. For example, if today is 13th January, then you cannot pass a value that is earlier than 13th December.
  • It is not earlier than cancel_at. .
credit_option_for_current_term_charges String No
If the subscription does not have a contract term:

Specifies how to handle credits for current term charges when canceling immediately (i.e., cancel_option is immediately). If not specified, the site-level setting is used.

If the subscription has a contract term:

Specifies how to handle credits for current term charges when contract_term_cancel_option is terminate_immediately. If not specified, the site-level setting is used. * none - No credits notes are created. * full - Credits are issues for the full value of the current term charges. * prorate - Prorated credits are issued.

Possible values:

  • "prorate"
  • "full"
  • "none"
subscription_items Object No

Parameters for subscription_items

subscription_items.unit_price[] Array No

The termination fee. In case it is quantity-based, this is the fee per unit.

subscription_items.unit_price_in_decimal[] Array No

When price overriding is enabled for the site, the price or per-unit price of the item can be set here. The value set for the item price 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.

subscription_items.item_price_id[] Array No

The unique id of the charge item_price that represents the termination fee.

subscription_items.quantity[] Array No

The quantity associated with the termination fee. Applicable only when the item_price for the termination charge is quantity-based.

subscription_items.quantity_in_decimal[] Array No

The decimal representation of the quantity of the item purchased. Can be provided for quantity-based item prices and only when multi-decimal pricing is enabled.

subscription_items.service_period_days[] Array No

The service period of the termination fee---expressed in days---starting from the current date.

How to start integrating

  1. Add HTTP Task to your workflow definition.
  2. Search for the API you want to integrate with and click on the name.
    • This loads the API reference documentation and prepares the Http request settings.
  3. Click Test request to test run your request to the API and see the API's response.