Invopop’s Chargebee module lets you import invoices and credit notes from Chargebee and process them with a workflow in Invopop. This allows you to automatically transform, process and publish your invoices and credit notes to comply with local regulations and integrate with other systems.

How it works

Once set up, the module listens to events from Chargebee. When an invoice is generated (i.e. created and not in the pending state) or when a credit note is created, the module will create a new GOBL invoice and add it to your Invopop account. It will then create a job to process the GOBL invoice using the workflow of your choice.

How to set up

This guide assumes that you already have a Chargebee account configured to generate invoices and credit notes in the country where you operate. Please refer to the Chargebee documentation on how to do this.

1. Enter supplier details

First, you need to set up a supplier in Invopop to use when generating GOBL invoices from Chargebee. In the console, go to “Contacts” > “Suppliers”. There you can create a new one with the details (name, tax code, address, etc.) of the company that will issue the invoices. The required data and extensions depend on the tax regime. Please do not hesitate to contact Invopop support for assistance.

Note that when generating invoices, the module will merge the supplier information in Invopop with the business profile data in Chargebee when issuing the invoice, giving precedence to the data from Chargebee.

2. Prepare a workflow

Now, you need to set up the workflow in Invopop to process the invoices imported from Chargebee. Go to “Configure” > “Workflows” in the Invopop console and create a workflow.

The workflow should include the steps to convert and publish invoices as local regulations require. You can also add steps for any other automation you want to perform, such as emailing the invoices or storing them in a cloud service.

Be sure to add a “Chargebee” step at the end of the workflow to report back to Chargebee once the document has been processed.

3. Connect the Chargebee module

You are now ready to connect and configure the Chargebee module itself. Go to “Configure” > “Modules” in the Invopop console. Then click on “Connect” and “Configure”. You’ll see a form with the following fields:

  • Chargebee Site: The identifier of your Chargebee site. You can find it in the URL when you log in to Chargebee.
  • Chargebee API Key: The API key used to access Chargebee. Go to “Settings” > “Configure Chargebee” > “API Keys” in the Chargebee UI to create one.
  • Supplier: The supplier who will be issuing the invoices. You can select the one you created earlier.
  • Workflow: The workflow that will process the invoices. You can select the one you created earlier.
  • Ignore Chargebee’s invoice codes: If true, the module will ignore the invoice numbers set by Chargebee and let the workflow assign them instead.

Some countries require specific codes set on tax-exempt invoices. If you’re in one of these countries, you’ll see the following fields:

  • Exemption Code (Generic): The local code to be used by default on tax-exempt invoices.
  • Exemption Code (Exports): The local code to be used by default on tax-exempt invoices for exports.
  • Exemption Code (Reverse Charge): The local code to be used by default on tax-exempt invoices for reverse charge.

Please note that those are the default exemption codes that will be set depending on the Chargebe exemption reason. If you need specific codes used for specific tax-exempt items, item prices, subscriptions or customers, you can assign them as extensions.

4. Set up a webhook

After saving the configuration, the page will provide a URL to set up a webhook in Chargebee and trigger the import process. To do this, go to “Settings” > “Configure Chargebee” > “Webhooks” and create a new webhook with the provided URL.

5. Enter extension data

To generate valid invoices, most tax regimes require the issuer to provide custom data specific to that regime. GOBL supports this through extensions. Please refer to the specific regime documentation to determine which extensions are used in your regime.

You can enter the extension values in Chargebee by setting custom fields or metadata in the following entities: Customer, Plan Item, Plan Item Price, Action Item, Action Item Price, Charge Item, Charge Item Price, and Subscription.

If you want to use metadata, make sure that each metadata key matches the extension name. For example, to set the customer’s mx-cfdi-fiscal-regime extension, you could go to the customer’s JSON metadata to something like:

{
  "mx-cfdi-fiscal-regime": "601"
}

In the case of custom fields, you must first create them in “Settings” > “Configure Chargebee” > “Custom Fields” and make sure that each field’s API name maps to an extension name. For example, to set the mx-cfdi-fiscal-regime the custom field API name must be cf_mx_cfdi_fiscal_regime.

Setup is complete

You are now ready to start importing invoices and credit notes from Chargebee. The module will automatically create GOBL invoices and add them to your Invopop account. The invoices will then be processed using the workflow you set up.