Introducing the Chargebee CLI

Why aren't unpaid invoices written off for canceled subscriptions via API?

Scope

When using the Salesforce API to cancel subscriptions in Chargebee, you may find that unpaid invoices are not automatically written off even though the site-wide setting is enabled. This usually happens when the API call does not include the required parameter to trigger the write-off process.

Solution

To ensure unpaid invoices are automatically written off when a subscription is canceled through the Salesforce API, follow these steps:

  1. Verify site-wide settings: Make sure the setting to automatically write off unpaid invoices for canceled subscriptions is enabled.
    • Navigate to Settings > Configure Chargebee > Billing Rules.
    • Check the option for Automatically write off unpaid invoices for canceled subscriptions.
  2. Modify the API call: Include the account_receivables_handling parameter in your Salesforce API call when canceling a subscription.
    • This parameter is required to trigger the write-off workflow.
    • Example API call:
{
  "subscription_id": "sub_123456",
  "contract_term": {
    "action_at_term_end": "cancel",
    "account_receivables_handling": "write_off"
  }
}
  1. Test the API call: After updating the request, run a test to confirm the unpaid invoices are written off as expected.
    • Use a test subscription to verify the behavior.
  2. Review the API documentation: Familiarize yourself with the Chargebee API documentation to understand all available parameters and their effects.

Important notes

  • Ensure your API integration includes the account_receivables_handling parameter in all relevant calls.
  • Review your integration settings and API calls regularly to avoid similar issues.
  • If the issue continues after following these steps, contact Chargebee support for additional help.