Introducing the Chargebee CLI

How to prorate credit when canceling contract terms via API?

Scope

How do I prorate a refund when I cancel a contract term immediately through the API?

Why can I prorate a refund when I cancel a contract term in the UI, but not through the API?

Summary

You can cancel a subscription that is in a contract term from the UI, the API, and the portal. Prorated credits for an immediate cancellation are available in the UI and the API. The portal does not offer that option. To prorate credit on an immediate cancellation, pass these parameters:

contract_term_cancel_option=terminate_immediately

credit_option_for_current_term_charges=prorate

refundable_credits_handling=schedule_refund

Solution

A contract-term subscription is meant to run for its billing cycles. You can still cancel it immediately from the UI or the API and prorate the credits. If the customer cancels from the portal, the subscription ends at the end of the contract term.

Contract cancellation through the portal:

If the contract has a default termination fee, contract_term_cancel_option=terminate_immediately applies that fee unless you override it in the request. Review the fee before you cancel.

To cancel immediately and prorate credits, call the API with:

--data-urlencode 'contract_term_cancel_option=terminate_immediately' \ --data-urlencode 'credit_option_for_current_term_charges=prorate' \ --data-urlencode 'refundable_credits_handling=schedule_refund' \

See Cancel a subscription for items.