> For the complete documentation index, see [llms.txt](https://docs-vnext.kiflo.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-vnext.kiflo.com/integrations/billing/chargebee.md).

# Chargebee

Seamlessly integrate Kiflo with Chargebee to collect end-users payments into Kiflo and generate rewards for your partners.

## Overview

Turn on the integration when you want to convert leads or deals and generate rewards automatically on successful payments from Chargebee.

There are three actions that can be automated:

**Convert lead to customer**

It converts a lead to a new customer in Kiflo matching the customer's email from Chargebee.

**Associate customer on deal**

It associates an existing customer or create a new one to an existing deal in Kiflo using the customer's email from Chargebee.

**Create transaction from succeeded payment**

It creates a new transaction in Kiflo for each successful payment from Chargebee if the payment is made by a known customer. Kiflo uses the Chargebee Customer ID to find the customer, and add the new transaction to it.

The transaction is also associate with the customer's source partner allowing rewards to be given to the partner on successful payments.

## Enable Chargebee integration

Go to:

* Manage
* Integrations
* Chargebee

Then click the **Add to Kiflo** button.

When turned on, the options on the Settings tab become selectable:

![](https://3041514930-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKkJn82Qo5a0Y4fOsoQzo%2Fuploads%2Fgit-blob-8c3470b374bfd36000e352db60e75ff7066b5c4f%2F66a623449638c36b868f1d0d.png?alt=media)

### Step 1: Enable options

Choose the options to turn on based on your business requirements.

**Convert lead to customer**

Turn it on when you work with leads and expect them to convert in Chargebee. On successful payment, Kiflo uses the new customer's email in Chargebee to find an existing lead in Kiflo.

If a lead is found Kiflo converts it to a new customer, otherwise nothing happens.

**Associate customer on deal**

Turn it on when you work with deals and expect them to be associated with customers when you receive the first payment from Chargebee. Kiflo uses the contact's email on the deal to match the new customer's email from Chargebee.

If the customer already exists in Kiflo it is associate with all deals matching the same email address. If the customer does not exist yet a new one is created.

**Create transaction from succeeded payment**

Turn it on when you want to capture payments to generate rewards. It creates a new transaction in Kiflo, associates it with the right customer and source partner.

{% hint style="info" %}
When enabling this option you must enable at least one of the previous two options, either *Convert lead to customer* or *Associate customer on dea*l.
{% endhint %}

### Step 2: Configure Chargebee

You must configure a new webhook in your Chargebee account to listen to successful payments.

Official documentation: [Webhook Settings](https://www.chargebee.com/docs/2.0/webhook_settings.html)

Copy the Webhook URL from Kiflo:

![](https://3041514930-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKkJn82Qo5a0Y4fOsoQzo%2Fuploads%2Fgit-blob-5b673ac8d7514063bd6faab2f204a0850516319d%2F66a6235f6eb51e63b8f9de7f.png?alt=media)

In Chargebee, go to:

* Settings
* Configure Chargebee
* Webhooks

Then, click on **Add Webhook** and fill the form:

* Webhook Name: Give a meaningful name like "Kiflo Chargebee integration"
* Webhook URL: Paste the URL you copied from Kiflo
* Events to Send: Select **Payment Succeeded** and **Subscription Canceled**

Optionally check the "Exclude card information from webhook call" option and click Create:

![](https://3041514930-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKkJn82Qo5a0Y4fOsoQzo%2Fuploads%2Fgit-blob-6b6be10141bbaf215a1f01eb2f420b6251d647e9%2F66a624906eb51e63b8f9de80.png?alt=media)

## Chargebee Properties

When the integration is turned on, new properties are automatically added to enrich customers and transactions.

| Object      | Property                 | Description                                                                          |
| ----------- | ------------------------ | ------------------------------------------------------------------------------------ |
| Customer    | ChargeBee Customer ID    | Stores the identifier of the customer from Chargebee.                                |
| Transaction | Chargebee Transaction ID | Stores the identifier of the transaction from Chargebee.                             |
| Transaction | Chargebee Invoice ID     | Stores the identifier of the invoice associated with the transaction from Chargebee. |

## Advanced configuration

If the above options are not enough to handle your use cases, you can configure advanced options:

Click the **Show advanced options** link:

![](https://3041514930-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKkJn82Qo5a0Y4fOsoQzo%2Fuploads%2Fgit-blob-be223442c46790677ca27c299a0efbff47629edb%2F6a142c82925ce487c3d9cb72.png?alt=media)

#### How to match Kiflo's leads and deals with Chargebee's customers?

| Option             | Description                                                                                                                                                                                                                | Examples                                                                                                                                                                           |
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Full email address | When a new payment is received from Chargebee, Kiflo uses the email address on the Chargebee customer to find the corresponding lead or deal. Then it creates a Kiflo *Customer* and save a new *Transaction*.             | Perfect for B2C. When the lead submitted in Kiflo is the same person who will pay in Chargebee.                                                                                    |
| Email domain only  | When a new payment is received from Chargebee, Kiflo uses the domain from the Chargebee customer's email address to find the corresponding lead or deal. Then it creates a Kiflo *Customer* and saves a new *Transaction*. | Perfect for B2B. When you sell to companies, and the email address on the Lead in Kiflo (ex: <john@foobar.com>) is not the same as the email in Stripe (ex: <billing@foobar.com>). |

#### How transactions must be created?

| Option                             | Description                                                         | Examples                                                                                                                                                                               |
| ---------------------------------- | ------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| One transaction per invoice/charge | Create one transaction for the entire invoice or charge             | <p>If an invoice contains 2 line items:<br>- Kiflo PRM - Premier<br>- Onboarding services<br>Only one transaction will be created. The amount will be the sum of the 2 line items.</p> |
| One transaction per line item      | Create one transaction for each individual line item in the invoice | <p>If an invoice contains 2 line items:<br>- Kiflo PRM - Premier<br>- Onboarding services<br>Two transactions are created.</p>                                                         |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs-vnext.kiflo.com/integrations/billing/chargebee.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
