> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cometly.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Chargebee integration

> Set up the Chargebee Cometly integration with webhooks to send payments, subscriptions and converted trials, and see which ad produced each sale.

The Chargebee Cometly integration connects [Chargebee](https://www.chargebee.com/) to Cometly using Cometly webhooks. A webhook sends data from one app to another in real time. Chargebee sends Cometly an event (an action Cometly tracks, such as a purchase) for every successful payment, new subscription and converted trial.

This matters because Cometly can only attribute the events it receives. Once Chargebee sends its payments and subscriptions, you can see which campaign, ad set and ad produced each paying customer.

The steps below set up a webhook that sends successful payments to Cometly. The other events you can send are covered at the end.

## Step 1: Create the event in Cometly and copy its webhook URL

Chargebee needs a Cometly webhook URL to send data to, so start in Cometly.

1. In Cometly, click **Events Manager** in the sidebar, then click **Create Event**.
2. Under **App / Integration**, select **Webhooks**.
3. Pick the event you want to track (for example **Purchase**), or choose **Create New Event**, then click **Create**.
4. On the next page, click **Copy** next to **Your webhook URL**.

Keep this page open. You come back to it in step 3. For the full walkthrough, see the [Cometly webhooks guide](https://docs.cometly.com/integrations/webhooks.md).

## Step 2: Add the webhook in Chargebee

1. In Chargebee, go to **Settings** > **Configure Chargebee** > **API Keys and Webhooks**, then switch to the **Webhooks** tab.

2. Click **Add Webhook**.

   ![Chargebee Webhooks tab with an arrow pointing to the Add Webhook button](https://mintcdn.com/cometly/2fSDFk1g6ELl9hsV/images/integrations/platforms/chargebee/02.webp?fit=max\&auto=format\&n=2fSDFk1g6ELl9hsV\&q=85\&s=b3465f14b274192b3b7f23311e6ff629)

3. Fill in the webhook:

   * **Webhook Name**: enter any name.
   * **Webhook URL**: paste the webhook URL you copied from Cometly in step 1.

   ![Chargebee Create a Webhook dialog with Webhook Name, Webhook URL, Events to Send and Create numbered](https://mintcdn.com/cometly/2fSDFk1g6ELl9hsV/images/integrations/platforms/chargebee/03.webp?fit=max\&auto=format\&n=2fSDFk1g6ELl9hsV\&q=85\&s=2e5d8d32eddca0241a17fed0b8b14e2a)

4. For **Events to Send**, choose **Payment Succeeded**. This sends every new successful payment in Chargebee to Cometly.

   ![Chargebee Events to Send dropdown with a search for Payment Succeeded](https://mintcdn.com/cometly/2fSDFk1g6ELl9hsV/images/integrations/platforms/chargebee/04.webp?fit=max\&auto=format\&n=2fSDFk1g6ELl9hsV\&q=85\&s=4768687ee204c2818ced48199c2eb7b0)

5. Click **Create**.

> [!NOTE]
>
> Each webhook you set up with Cometly should send only **one event**. To track more than one Chargebee event, create a separate webhook in Chargebee and a separate webhook event in Cometly for each.

## Step 3: Finish the webhook in Cometly

Go back to the Cometly page from step 1 and click **Check for Data**. Once Chargebee has sent an event, follow the [Cometly webhooks guide](https://docs.cometly.com/integrations/webhooks.md) to:

* Select the record Cometly received.
* Map the Chargebee data to Cometly fields. Email and Event Time are required.
* Add filters so that only the data you want is tracked.
* Activate the event.

## Additional Chargebee events (recommended)

We recommend setting up the events below as separate webhooks, each with its own event in Cometly. You can [view the full list of Chargebee event types](https://apidocs.chargebee.com/docs/api/events?prod_cat_ver=2#event_types).

| Chargebee event | When Chargebee sends it | What to track in Cometly |
| - | - | - |
| **Subscription Created** | A new subscription is created. | An event for new subscriptions. |
| **Subscription Activated** | A subscription moves from the "Trial" state to the "Active" state. | An event for trials that converted to paying customers. |

## Check it worked

In Cometly, open **Events Manager**. Your Chargebee webhook event shows a switch that is turned on in the **Status** column. After the next successful payment in Chargebee, open the **Events Log** tab: the event appears there within 60 seconds, with **SUCCESS** in the **Details** column.

## Frequently asked questions

### Does Cometly have a native Chargebee integration?

No. Chargebee connects to Cometly through Cometly webhooks, as shown in the steps above. If you would rather build the connection another way, you can also use [Zapier](https://docs.cometly.com/integrations/zapier.md) or the [Cometly API](https://docs.cometly.com/integrations/api.md).

### How long does it take for a Chargebee payment to show up in Cometly?

The event shows in the Events Log within 60 seconds of Chargebee sending it. It can take up to 15 minutes to appear in the reporting areas, such as the Report Builder or Ads Manager.

### Why is my Chargebee test payment missing from my Cometly reports?

Test data sent before the webhook event was activated is not processed and does not appear in your reports. Activate the event in Cometly first, then send a new payment from Chargebee.

## Next steps

* [Follow the full Cometly webhooks guide](https://docs.cometly.com/integrations/webhooks.md)
* [Use the Events Log to check incoming events](https://docs.cometly.com/support/troubleshooting/general/event-log.md)
* [Learn how events work in Cometly](https://docs.cometly.com/guides/events/how-events-work.md)
* [Plan which events to track](https://docs.cometly.com/getting-started/tracking-plan.md)

Still have questions or need a hand? We're happy to help. Reach our team at [support@cometly.com](mailto:support@cometly.com).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.