---
title: "Connect Chargebee"
description: "Show a customer's Chargebee subscriptions and invoices next to the conversation, and let Kai answer billing questions."
url: https://help.gleap.ai/en/articles/353-connect-chargebee
collection: "Apps and integrations"
updated: 2026-11-16
language: en
---

# Connect Chargebee

Show a customer's Chargebee subscriptions and invoices next to the conversation, and let Kai answer billing questions.

Chargebee works like the other billing integrations: the customer's subscriptions and invoices appear next to the ticket you're answering, and Kai can answer billing questions from the same data. Only project admins can connect it, and it needs the Team plan or higher. Each project takes one Chargebee site.

### Connect it

1.  Go to **Settings → Apps** and click **Add app**.
    
2.  Pick **Chargebee**. Under **What should Chargebee do?**, keep **Inbox panel** and **Kai answers billing questions** ticked and click **Continue with Chargebee**.
    
3.  Paste your **Chargebee API key**.
    
4.  Enter your **Site**: the name in your Chargebee address, the `acme` in `acme.chargebee.com`.
    
5.  Click **Connect**.
    

Gleap checks the key against that site before saving, so a site that doesn't exist, or a key from another site, is refused with a message. If you run a test site alongside a live one, take the key from the site you named. Once it's connected, click **Done**.

![Chargebee uses selection in the Pied Piper demo project.](https://staticfiles.gleap.io/p613b5dd730aed737108f87ab/pIwPpp9V4julaezXqUnOhmJ6kAIGo3DrR6Aeyj0A0mWgKLtrlSRNpn1OwaHftbVsvXQj8mihkL9.png)

![Chargebee setup using a fictional site and no API key in the Pied Piper demo project.](https://staticfiles.gleap.io/p613b5dd730aed737108f87ab/KAJjUYdnn6Gua17Ln9jfDTHlDQfATy4yaou79xZbGkI5Ew2L4z6UvewdoJ01a5glwJdPVLEv62y.png)

> **Warning:** A read-only key is enough for the card and for Kai's answers. Billing actions that change something in Chargebee, such as retrying a payment or cancelling a subscription, need a key that can write.

### How a contact is matched

If the contact carries `chargebeeCustomerId` (a claim of the signed identity token, or custom data), that customer is used. Otherwise Gleap searches Chargebee for a customer with exactly the contact's email address.

The reliable route is to put the customer id in the signed identity token your backend creates for the logged-in user, as the `chargebeeCustomerId` claim. Kai then finds the customer directly, and the browser can't change it.

```javascript
// On your server, after the user logged in
const token = jwt.sign(
  { userId: String(user.id), email: "ada@example.com", chargebeeCustomerId: "16BdBpSAaFTZ4dc" },
  process.env.GLEAP_IDENTITY_SECRET,
  { algorithm: "HS256", keyid: process.env.GLEAP_IDENTITY_KEY_ID, expiresIn: "1h" }
);

// In your app
await Gleap.setUserJwt(token);
```

There's no domain-level fallback here, so without the id the email has to match. In B2B, where the person writing in often isn't the billing contact, sending the customer id is what makes the card work. How to create the key and sign the token is in [Identify users and send attributes and events](https://help.gleap.ai/en/articles/230-identify-users-and-send-attributes-and-events.md).

### What you see

The customer, a failed payment if there is one, their subscriptions and their latest invoices. That's enough to answer "what am I paying for" and "did my last invoice go through" without leaving the ticket. **Open in Chargebee** jumps to the customer there.

The card also offers the billing actions you allow, such as **Portal link**, **Retry payment** or **Cancel at period end**. Each change goes through a confirm dialog and is logged on the ticket.

### Decide what Kai and your team may do

1.  Go to **Settings → Apps** and open Chargebee.
    
2.  Under **Billing actions**, click **Open Apps** and set each action to **Allow**, **Ask first** or **Never**.
    
3.  If your Chargebee customer ids are the user ids you pass to Gleap, turn on **Customer ids are user ids**.
    

Every action that changes something starts as **Ask first**: the customer confirms on a card in the chat, or a teammate approves. Refunds can also take an **up to** limit. With **Allow** and a limit, Kai refunds on its own up to that amount and never more.

### Who counts as verified

Kai shows billing details in the chat only to a verified customer who is tied to their Chargebee customer. Everyone else gets the billing portal link by email, sent to the billing email on file. Kai never matches on details the customer typed.

With signed sessions on, you choose what verifies a customer under **Settings → Security → Customer identity → Customer authentication**. Each channel has one rule for identified users and one for leads and visitors. A channel set to **Default** follows the default rule:

-   **Messenger, identified users:** by default a signed login (the identity token your app sends) counts, and anyone without one can confirm an email code. You can require the signed login only.
    
-   **Leads and visitors, and every other channel:** they carry no signature, so the default rule applies, which is the email code unless you change it.
    

A verified customer is tied to their Chargebee customer by the signed `chargebeeCustomerId`, by the signed user id when **Customer ids are user ids** is on, or by the exact email they confirmed with the code.

Without signed sessions, only signed-in users whose user id Gleap verifies count, through the `chargebeeCustomerId` claim or **Customer ids are user ids**. The email code doesn't unlock billing details there.

### The email code

When the rule allows the code, Kai asks for it in the conversation and Gleap sends 6 digits to the email on the contact. With no email on file, Kai can't verify the customer. The code is valid for 10 minutes, allows 3 attempts, and a new one can be sent every 30 seconds. How the customer enters it depends on the channel:

-   **Messenger:** a **Verify email** card in the chat.
    
-   **Email, WhatsApp, Instagram, Facebook, Slack and Telegram:** the customer replies in the thread with the 6 digits.
    
-   **Phone and Discord:** not supported yet.
    

Once confirmed, the customer stays verified for 30 minutes, as long as the contact's email doesn't change.

### When nothing shows

Check that the contact has an email address and that the same address is on a Chargebee customer. If your customers use a different address in your product than in billing, put `chargebeeCustomerId` in the identity token.

Data is read from Chargebee when the card loads and kept for up to five minutes per contact; the reload button on the card fetches it again.

### Related

-   [Connect Stripe](https://help.gleap.ai/en/articles/352-connect-stripe.md)
    
-   [Identify users and send attributes and events](https://help.gleap.ai/en/articles/230-identify-users-and-send-attributes-and-events.md)
    
-   [Browse every integration and what it does](https://help.gleap.ai/en/articles/351-browse-every-integration-and-what-it-does.md)
