Docs

Log in to read the version of docs relevant to your site, or use the dropdown versions

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

Scope

While using the Salesforce API to cancel subscriptions in Chargebee, you might encounter an issue where unpaid invoices are not automatically written off, even if you have enabled the site-wide setting for this purpose. This typically occurs when the API call does not include the necessary parameters to trigger the write-off process.

Solution

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

  1. Verify Site-wide Settings: Ensure that the site-wide 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."
  1. Modify API Call: Include the account_receivables_handling parameter in your Salesforce API call when canceling a subscription.
  • This parameter is crucial for triggering the write-off process.
  • Example API call snippet:
    {
      "subscription_id": "sub_123456",
      "contract_term": {
        "action_at_term_end": "cancel",
        "account_receivables_handling": "write_off"
      }
    }
    
  1. Test the API Call: After modifying the API call, perform a test to ensure that the unpaid invoices are written off as expected.
  • Use a test subscription to verify the behavior.
  1. Review API Documentation: Familiarize yourself with the Chargebee API documentation to understand all available parameters and their effects.

Important Notes

  • Ensure that your API integration is updated to include the account_receivables_handling parameter for all relevant calls.
  • Regularly review your integration settings and API calls to prevent similar issues.
  • If the issue persists after following these steps, contact Chargebee support for further assistance.

Was this article helpful?