younifyd
Menu

Cancel Subscription For Items Estimate

Cancel subscription for items estimate

POST/subscriptions/{subscription-id}/cancel_subscription_for_items_estimate

Use it in a workflow

  1. Add a step and choose the Chargebee connector.
  2. Pick the Cancel Subscription For Items Estimate action (under Chargebee API).
  3. Fill in the fields below, then reference the result from later steps as {{cancelSubscriptionForItemsEstimate.response.data}}.

Request

Path parameters

subscription-idstringrequired

Headers

chargebee-request-origin-devicestring

The device from which the customer has made the request

chargebee-request-origin-userstring (email)

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

chargebee-request-origin-user-encodedstring (email)

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-request-origin-ipstring

The IP address of the customer where the request originated

chargebee-event-actionsstring

skip all actions to be done on the events

One ofall-disabled

chargebee-event-emailstring

skip only emails

One ofall-disabled

chargebee-event-webhookstring

skip only webhooks

One ofall-disabled

chargebee-business-entity-idstring

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.

Request body

Enter the body as JSON in the step's Body field.

cancel_optionstring

<h5>If the subscription does not have a contract term:</h5> <p class="mb-2">Determines when to cancel the subscription.</p> <h5>If the subscription has a contract term:</h5> <p class="mb-2">This parameter is not applicable.</p> * end_of_billing_term - <p class="mb-2">This is used to cancel a subscription either at the end of the advance term, if it&#x27;s billed for future renewals or at the end of its current billing cycle</p> * end_of_term - <p class="mb-2">This is used to cancel a subscription at the end of the current billing cycle</p> * immediately - <p class="mb-2">This is used to cancel the subscription with immediate effect</p> * specific_date - <p class="mb-2">This is used to cancel a subscription on a specified date. The change occurs as of the date/time defined in <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">cancel_at</code></p>

One ofimmediatelyend_of_termspecific_dateend_of_billing_term

end_of_termboolean

<p class="mb-2"><strong class="font-semibold">(Deprecated)</strong> Use <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">cancel_option</code> instead. Applicable only when the subscription does not have <a href="/docs/api/contract_terms">contract terms</a>. Set this to <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">true</code> if you want to cancel the subscription at the end of the current subscription billing cycle. The subscription <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">status</code> changes to <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">non_renewing</code>.</p>

Default false

cancel_atinteger (unix-time)

<h5>If the subscription does not have a contract term:</h5> <p class="mb-2">Specifies the date and time when the subscription should be canceled. Do not use this parameter when <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">end_of_term</code> is set to <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">true</code>.</p> <h5>If the subscription has a contract term:</h5> <p class="mb-2">Applicable only when <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">contract_term_cancel_option</code> is <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">specific_date</code>. Specifies the date and time to cancel the subscription and contract term.</p> <h5>Backdating</h5> <p class="mb-2">You can set a past date to backdate the cancellation. Backdating is allowed only if the following conditions are met:</p> <ul class="list-disc list-outside ml-6 my-4 space-y-2"> <li class="text-base leading-relaxed"><a href="https://www.chargebee.com/docs/2.0/backdating.html" target="_blank">Backdating</a> is enabled for subscription cancellation.</li> <li class="text-base leading-relaxed">The current date does not exceed the <a href="https://www.chargebee.com/docs/2.0/backdating.html#configuring-backdated-subscription-actions-and-invoicing" target="_blank">backdating limit configured in Chargebee Billing</a>.</li> <li class="text-base leading-relaxed">The date is on or after the <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">current_term_start</code>.</li> <li class="text-base leading-relaxed">The date is on or after the most recent change involving: <ul class="list-disc list-outside ml-6 my-4 space-y-2"> <li class="text-base leading-relaxed">Addition/change/removal of plan or addon item prices.</li> <li class="text-base leading-relaxed">Addition of charge item prices.</li> </ul> </li> <li class="text-base leading-relaxed">The date is not more than one billing period into the past. For example, if the plan&#x27;s billing period is two months and today is April 14, <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">cancel_at</code> cannot be earlier than February 14.</li> </ul>

credit_option_for_current_term_chargesstring

<h5>If the subscription does not have a contract term:</h5> <p class="mb-2">Specifies how to handle credits for current term charges when canceling immediately (i.e., <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">cancel_option</code> is <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">immediately</code>). If not specified, the <a href="https://www.chargebee.com/docs/2.0/cancellations.html#configure-subscription-cancellation">site-level setting</a> is used.</p> <h5>If the subscription has a contract term:</h5> <p class="mb-2">Specifies how to handle credits for current term charges when <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">contract_term_cancel_option</code> is <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">terminate_immediately</code>. If not specified, the <a href="https://www.chargebee.com/docs/2.0/contract-terms.html#configuring-contract-terms">site-level setting</a> is used.</p> * none - <p class="mb-2">No credits notes are created.</p> * full - <p class="mb-2">Credits are issues for the full value of the current term charges.</p> * prorate - <p class="mb-2">Prorated credits are issued.</p>

One ofnoneproratefull

unbilled_charges_optionstring

<h5>If the subscription does not have a contract term:</h5> <p class="mb-2">Specifies how to handle unbilled charges when canceling immediately (i.e., <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">cancel_option</code> is <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">immediately</code>). If not specified, the <a href="https://www.chargebee.com/docs/2.0/cancellations.html#configure-subscription-cancellation">site-level setting</a> is used.</p> <h5>If the subscription has a contract term:</h5> <p class="mb-2">Specifies how to handle unbilled charges when <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">contract_term_cancel_option</code> is <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">terminate_immediately</code>. If not specified, the <a href="https://www.chargebee.com/docs/2.0/contract-terms.html#configuring-contract-terms">site-level setting</a> is used.</p> * invoice - <p class="mb-2">An invoice is generated immediately with the unbilled charges.</p> * delete - <p class="mb-2">The unbilled charges are deleted.</p>

One ofinvoicedelete

account_receivables_handlingstring

<h5>If the subscription does not have a contract term:</h5> <p class="mb-2">Specifies how to handle past due invoices when canceling immediately (i.e., <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">cancel_option</code> is <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">immediately</code>). If not specified, the <a href="https://www.chargebee.com/docs/2.0/cancellations.html#configure-subscription-cancellation">site-level setting</a> is used.</p> <h5>If the subscription has a contract term:</h5> <p class="mb-2">Specifies how to handle past due invoices when <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">contract_term_cancel_option</code> is <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">terminate_immediately</code>. If not specified, the <a href="https://www.chargebee.com/docs/2.0/contract-terms.html#configuring-contract-terms">site-level setting</a> is used.</p> * no_action - <p class="mb-2">No action is taken.</p> * write_off - <p class="mb-2">Applies excess payments and refundable credits to past due invoices. Any remaining balance is written off. <em class="italic">Note: The credit note for the write-off is not included in the API response.</em></p> * schedule_payment_collection - <p class="mb-2">Applies excess payments and refundable credits to past due invoices. If any amount remains and <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">auto_collection</code> is <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">on</code> , the remaining amount is automatically charged to the available payment method.</p>

One ofno_actionschedule_payment_collectionwrite_off

refundable_credits_handlingstring

<h5>If the subscription does not have a contract term:</h5> <p class="mb-2">Specifies how to handle refundable credits when canceling immediately (i.e., <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">cancel_option</code> is <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">immediately</code>). If not specified, the <a href="https://www.chargebee.com/docs/2.0/cancellations.html#configure-subscription-cancellation">site-level setting</a> is used.</p> <h5>If the subscription has a contract term:</h5> <p class="mb-2">Specifies how to handle refundable credits when <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">contract_term_cancel_option</code> is <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">terminate_immediately</code>. If not specified, the <a href="https://www.chargebee.com/docs/2.0/contract-terms.html#configuring-contract-terms">site-level setting</a> is used.</p> * schedule_refund - <p class="mb-2">Refunds remaining credits after applying them to any past due invoices.</p> * no_action - <p class="mb-2">No action is taken.</p>

One ofno_actionschedule_refund

contract_term_cancel_optionstring

<p class="mb-2">Required when the subscription has a contract term. Determines when to cancel the subscription along with the contract term.</p> * terminate_immediately - <p class="mb-2">Cancels the subscription and contract term immediately. Sets the contract term&#x27;s <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">status</code> to <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">terminated</code> and collects any termination fee, if applicable. To specify the termination fee, include a single object in the <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">subscription_items</code> array. If not specified, the <a href="/docs/api/contract_terms">default termination fee</a> is applied (if configured).</p> * end_of_contract_term - <p class="mb-2">Prevents the contract term from renewing and schedules the subscription for cancellation at the end of the contract term.</p> * specific_date - <p class="mb-2">Cancels the subscription and contract term on the date specified by <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">cancel_at</code>. Sets <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">action_at_term_end</code> to <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">cancel</code>. <strong class="font-semibold">Note</strong>: Contact <a href="https://www.chargebee.com/docs/billing/2.0/kb/getting-started/how-to-contact-chargebees-support-team?utm_source=docs_api&amp;utm_medium=content&amp;utm_campaign=support" target="_blank" rel="noopener noreferrer" class="text-blue-600 hover:text-blue-800 underline">Chargebee Support</a> to enable this option for your <a href="https://www.chargebee.com/docs/2.0/sites-intro.html">Chargebee site</a>.</p> * end_of_subscription_billing_term - <p class="mb-2">Cancels the subscription and contract term at the end of the current billing cycle. Sets <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">action_at_term_end</code> to <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">cancel</code>. <strong class="font-semibold">Note</strong>: Contact <a href="https://www.chargebee.com/docs/billing/2.0/kb/getting-started/how-to-contact-chargebees-support-team?utm_source=docs_api&amp;utm_medium=content&amp;utm_campaign=support" target="_blank" rel="noopener noreferrer" class="text-blue-600 hover:text-blue-800 underline">Chargebee Support</a> to enable this option for your <a href="https://www.chargebee.com/docs/2.0/sites-intro.html">Chargebee site</a>.</p>

One ofterminate_immediatelyend_of_contract_termspecific_dateend_of_subscription_billing_term

invoice_dateinteger (unix-time)

<p class="mb-2">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 <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">create_pending_invoices</code> is <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">true</code> , 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. <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">taxes</code> and <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">line_item_taxes</code> are computed based on the <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">tax</code> configuration as of <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">invoice_date</code>. When passing this parameter, the following prerequisites must be met:</p> <ul class="list-disc list-outside ml-6 my-4 space-y-2"> <li class="text-base leading-relaxed"><code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">invoice_date</code> must be in the past.</li> <li class="text-base leading-relaxed"><code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">invoice_date</code> 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.</li> <li class="text-base leading-relaxed">It is not earlier than <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">cancel_at</code>. .</li> </ul>

cancel_reason_codestring

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.

subscription_itemsobject

Parameters for subscription_items

item_price_idarray<string>

<p class="mb-2">The unique <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">id</code> of the charge item_price that represents the termination fee.</p>

quantityarray<integer (int32)>

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

quantity_in_decimalarray<string>

The decimal representation of the quantity of the item purchased. Can be provided for quantity-based item prices and only when [multi-decimal pricing](/docs/api/getting-started) is enabled.

unit_pricearray<integer (int64)>

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

unit_price_in_decimalarray<string>

When [price overriding](https://www.chargebee.com/docs/2.0/price-override.html) 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](/docs/api/item_prices/item_price-object#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](/docs/api/getting-started) is enabled.

service_period_daysarray<integer (int32)>

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

json
{
  "cancel_option": null,
  "end_of_term": null,
  "cancel_at": null,
  "credit_option_for_current_term_charges": null,
  "unbilled_charges_option": null,
  "account_receivables_handling": null,
  "refundable_credits_handling": null,
  "contract_term_cancel_option": null,
  "invoice_date": null,
  "cancel_reason_code": null,
  "subscription_items": null
}

Response

Returns 200 with an object. Read it in later steps with {{cancelSubscriptionForItemsEstimate.response.data.<field>}}.

estimateobject

During the process of signing up customers to subscriptions, use the Estimates API to evaluate the details of the purchase before actually signing them up. The details returned by the API include the invoice amounts, next billing date and unbilled charges. For example, consider that you are creating a new subscription or update an existing one. Use the Estimates API before that to deduce the details such as the amount the customer would be charged, the state the subscription would be in after creation or updation, and so on. If you have configured the [Avalara integration](https://www.chargebee.com/docs/2.0/avalara.html), Chargebee retrieves the tax amount from Avalara for the invoice. This counts against your Avalara API limits.

created_atinteger (unix-time)required

The time at which this estimate got generated

subscription_estimateobject9 fields

Represents the subscription details when the 'estimate' operations are invoked.

subscription_estimatesarray<object>9 fields

Is a list of estimated subscriptions i.e., an array of *subscription_estimate* objects. It is generated when 'Create an estimate for purchase' operation is invoked

invoice_estimateobject18 fields

Represents the preview of the invoice generated immediately when the 'estimate' operations are invoked.

invoice_estimatesarray<object>18 fields

Is a list of estimated invoices i.e., an array of *invoice_estimate* objects. It is generated when 'Create an estimate for unbilled charges' operation is invoked

payment_schedule_estimatesarray<object>7 fields

<p class="mb-2"><code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">payment_schedule_estimate</code> is used to hold the details related to payment schedules for an invoice. It will contain a list of <code class="bg-gray-100 text-gray-800 font-medium border border-gray-300 rounded px-1.5 py-0.5 mx-1 text-sm font-mono whitespace-nowrap">payment_schedules</code> resources.</p> <span featureId="cb-payment-schedules" isMicro="true"></span>

next_invoice_estimateobject18 fields

Represents the preview of the invoice generated at term end when the 'estimate' operations are invoked.

credit_note_estimatesarray<object>16 fields

Represents the preview of the credit-notes generated during 'estimate' operation. Currently applicable only for the 'Update Subscription Estimate' operation.

unbilled_charge_estimatesarray<object>25 fields

Represents the preview of the unbilled charges generated during 'estimate' operation. Currently not applicable for the 'Subscription renewal estimate' operation.

json
{
  "estimate": null
}

Need more? See the Chargebee guide for connection setup and behaviour shared by every action.