# Chargebee

Connect a Chargebee site so its paid invoices count on the ad campaigns that brought them, with refunds taken off.

Connect a Chargebee site and each paid invoice becomes a `Purchase`, counted on the ad campaign that brought the buyer. New customers can reach your ad platforms too.

A connected account uses `platform: "chargebee"`.

## Quick reference

| Property | Value |
|----------|-------|
| Platform value | `chargebee` |
| What arrives | A `Purchase` event for each paid invoice, one-off or from a subscription |
| Refunds | A refund lowers the sale's value; a full refund retracts it |
| Event source | `chargebee` in `GET /v1/events` |
| Tied to its ad | When the subscription or customer carries the Zernio visitor id, a click id or a UTM tag in its `meta_data` |
| Auth | Site name and a Full-Access API key |
| Accounts per profile | One |
| Subscriptions | `Subscribe` on a subscription's first invoice |
| Forwarded to ad platforms | Optional, off by default: one-off sales and new subscribers, never renewals |
| Social posting | No |

## Before you start

You need a Chargebee site and a user who can create API keys in **Settings > Configure Chargebee > API Keys**. A site holds at most five webhook endpoints; Zernio adds one.

## Connect

Send the site name and the API key to `POST /v1/connect/chargebee/credentials` with the profile. Zernio checks them and adds its own webhook endpoint to the site. See [Connect](/platforms/chargebee/connect).

## Common errors

| Error | Cause | Fix |
|---|---|---|
| `401 invalid_credentials` | Chargebee refused the site name or the key, or the key is read-only | Check the site name and create a Full-Access key. |
| `502 platform_api_error` | Chargebee did not accept the webhook endpoint, often because the site already holds five | Remove an unused endpoint in Chargebee and connect again. |

## In this section

<PlatformPages platform="chargebee" />

## Related

- [Connect a Chargebee site](/connect/connect-chargebee-credentials)
- [Conversions API](/products/conversions-api)
- [Campaign results](/guides/campaign-results)
- [Connecting accounts](/guides/connecting-accounts)