Introducing the Chargebee CLI

How do I manage draft invoices in Chargebee with Snowflake?

  • How to handle draft invoices in Chargebee when using Snowflake for data management
  • Understanding the lifecycle of draft invoices in Chargebee
  • Configuring Snowflake to exclude draft invoices from reports

Solution

When using Chargebee's delayed invoice collection feature, invoices are initially created in a draft (pending) status. These draft invoices are not automatically deleted from your Snowflake database.

During metered billing or delayed invoicing runs, Chargebee first creates a draft invoice with a status of Pending and an invoice number prefixed with draft_inv_.

When the invoice is closed (manually, auto-closed, or through the API), Chargebee hard-deletes that draft row from its own database and creates a new final invoice record with the next number in the production sequence.

This deletion event is not surfaced through the public API, so downstream tools such as Fivetran, Snowflake, or Hightouch never receive a delete signal. They therefore retain the original draft row alongside the final invoice.

  1. Create a view in Snowflake:

    • Create a view that filters out any row where the invoice number matches draft_inv_%.
    • Point downstream dashboards to the view instead of the raw table. You can also filter on invoice status to exclude entries marked PENDING.
  2. Close pending invoices in Chargebee:

    • Navigate to Invoices in your Chargebee dashboard.
    • Locate the draft invoices you want to close.
    • Select the invoices and click Close Invoice.
    • Once closed, Chargebee creates the final invoice, and that record appears in Snowflake.

Important notes

  • Draft invoices in Chargebee are not automatically deleted; they must be manually closed to become final invoices.
  • Ensure your Snowflake view is updated regularly to reflect the latest invoice status.
  • Review your Chargebee invoice settings regularly to align with your reporting and business processes.
  • For more detailed guidance, refer to our Snowflake setup guide.