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

# Chargebee Webhook

> Send signup and purchase events to Cello using Chargebee Webhook

Cello makes it easy to **connect securely to your Chargebee payment provider** to automate transaction events, attribution, and payouts. Transactions are monitored and used to pay out referrers based on your campaign reward rules.

# Overview

A notification event is securely sent to Cello through the webhook endpoint every time a customer makes a purchase or a customer record is created or updated. Cello checks these events to perform the following actions:

* Determine if a reward for the referrer needs to be created and paid out
* Inform the referrer about new signups and rewards
* Cancel recurring rewards if a subscription is cancelled

> [!WARNING]
>
> If the automation of Cello detects unclear cases the automation will be paused and Cello will reach out to you to clarify the case.

> [!TIP]
>
> After setting up the webhook, ask your coding tool for a Cello [integration health check](https://docs.cello.so/mcp/developers/integration-status.md) to confirm Cello is receiving events from Chargebee. If a component shows a warning or error, open [Developers → Events](https://app.cello.so/developers/events) to drill into individual events and see which fields are failing validation.

# Endpoint URLs

You will find the webhook endpoint URL for both **Sandbox** and **Production** environments in [Developers → Webhooks](https://app.cello.so/developers/webhooks).

# Securing the webhook

To secure the webhook in Step 5, you will find credentials for both **Sandbox** and **Production** environments in [Developers → Webhooks](https://app.cello.so/developers/webhooks).

# Connecting Chargebee

## Prerequisites

Before configuring webhooks, ensure your Chargebee customers include the required Cello attribution fields. These information enables proper attribution and reward tracking.

> [!NOTE]
>
> **When to add additional fields:**
>
> * If you create Chargebee customers at signup → You would have already added metadata or custom fields to the customer during the [Setup Step "Track Signups"](https://docs.cello.so/attribution/tracking-signups.md)
> * If you create Chargebee customers at purchase → Make sure to add metadata or custom fields when creating the customer

### Required Chargebee Customer attribution fields

> [!NOTE]
>
> You can also choose to use **Chargebee custom fields (CF\_)** to add referral data to the event. Learn more about custom fields in the [**Chargebee documentation**](https://www.chargebee.com/docs/billing/2.0/site-configuration/custom_fields)

Pass the following fields during checkout in the [Customer Object](https://apidocs.chargebee.com/docs/api/customers) to `meta_data` attribute or as a `cf_` custom field.

| Field | Description | Chargebee Object |
| - | - | - |
| `cello_ucc` | Referral code identifying the referrer | [Customer Object](https://apidocs.chargebee.com/docs/api/customers) to `meta_data` attribute or as a `cf_` custom field |
| `new_user_id` | Your system's unique user ID. Same as `productUserId` used in [Referral Component](https://docs.cello.so/referral-component/introduction.md) when booting the SDK | [Customer Object](https://apidocs.chargebee.com/docs/api/customers) to `meta_data` attribute or as a `cf_` custom field |
| `new_user_organization_id` | Organization ID (optional). Required only for organization-level referrals and rewards | [Customer Object](https://apidocs.chargebee.com/docs/api/customers) to `meta_data` attribute or as a `cf_` custom field |
| `coupon` | New user discount code. Learn how to apply discounts in this [guide](https://docs.cello.so/attribution/apply-discounts.md). | [Customer Object](https://apidocs.chargebee.com/docs/api/customers) to `meta_data` attribute or as a `cf_` custom field |

## Steps

You will add a webhook to your Chargebee configuration to connect Chargebee and Cello. This can be done in both test and production environments separately.

![Chargebee webhook configuration in Cello Portal](https://mintcdn.com/cello/6Zr08teY9AER0ncF/integrations/webhooks/integrations-chargebee-webhook-1.png?fit=max\&auto=format\&n=6Zr08teY9AER0ncF\&q=85\&s=5145a0ff810ec3c0b2433c927380fb6d)

**1. Log into your Chargebee Dashboard**

**2. Add a new Webhook**

From the sidebar, select Settings > Configure Chargebee and click on "Webhooks". Next Click on "+ Add Webhook".

**3. Enter the Endpoint URL**

Choose the Endpoint URL corresponding to the environment you are setting up: **Sandbox** or **Production**.

**4. Select the events to send**

Select the events you want to send under "Events to Send":

1. `Customer Created`, `Customer Changed`, `Customer Deleted`
2. `Payment Succeeded`, `Payment Refunded`, `Payment Failed`

**5. Secure the webhook**

Select "Protect webhook URL with basic authentication" and add the `product_id` and `secret` provided in the Cello Portal.

> [!WARNING]
>
> Be sure to select **Exclude card Information from webhook call**

**6. Click "Create" to enable the webhook**

&#x20; Webhook created!


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