Overview
A Chargebee connection in Flexprice stores encrypted credentials that allow the system to interact with your Chargebee account for:- Creating item families, items, and item prices in Chargebee
- Synchronizing customers to Chargebee
- Syncing invoices to Chargebee for payment collection
- Receiving webhook notifications from Chargebee
Prerequisites
Before setting up your Chargebee connection, ensure you have:- Active Chargebee Account - Sign up at chargebee.com
- API Key - Available in your Chargebee Dashboard
- Webhook Endpoint - Configured in Chargebee Dashboard
- Flexprice Environment - Valid tenant and environment IDs
Step 1: Gather Chargebee Credentials
Required Credentials
Finding Your Credentials
-
Site Name:
- Go to Chargebee Dashboard → Settings → API & Webhooks
- Your site name is displayed at the top (e.g.,
acme-test)
-
API Key:
- Go to Chargebee Dashboard → Settings → API & Webhooks → API Keys
- Copy your API key (starts with your site name)
- Use test API keys for development
-
Webhook Credentials:
- Choose any username and password: Chargebee signs webhooks with HTTP Basic auth
- Enter the same pair on the Chargebee webhook and in Flexprice
Step 2: Configure Webhook Endpoint in Chargebee
Webhook URL Format
Required Webhook Events
Configure these events in your Chargebee webhook endpoint:Setting Up the Webhook
- Go to Chargebee Dashboard → Settings → API & Webhooks → Webhooks
- Click + Add New Webhook
- Enter your webhook URL
- Select the required events listed above
- Configure Basic Authentication with your webhook username and password
- Click Save
Step 3: Create Chargebee Connection
Using Flexprice Dashboard
1
Open Chargebee in Integrations
In the left sidebar, click Integrations, then click Connect on the Chargebee card.
2
Enter your credentials
Enter a Connection name, your Site (the part before 
.chargebee.com in your Chargebee address), and your API key, then click Continue. Keys are encrypted and never shown again.
3
Choose what syncs
Switch on Push invoices to send Flexprice invoices to Chargebee when they are finalised. Nothing syncs until you switch it on, and you can change it later. Click Continue.

4
Add the webhook
The Webhook step shows your Webhook URL and the 
payment_succeeded event. Enter a Webhook username and Webhook password, use the same pair for Basic Authentication on the Chargebee webhook (Step 2), and click Connect Chargebee.
API Request
Endpoint:POST /v1/connections
Headers:
Response
Editing an Existing Connection
Click Configure on the Chargebee card to edit the connection.
- Connection name: Update the friendly name for the connection
- Push invoices: Enable or disable invoice sync
- Webhook username and Webhook password: Enter new values to replace them, or leave them blank to keep the current ones
Security Best Practices
Credential Management
- Environment Separation: Use different API keys for test/production
- Key Rotation: Regularly rotate your Chargebee API keys
- Access Control: Limit API key permissions in Chargebee
- Encryption: All credentials are encrypted at rest in Flexprice
Webhook Security
- HTTPS Only: Always use HTTPS for webhook endpoints
- Basic Authentication: Use Basic Auth for webhook verification (recommended)
- Secret Management: Keep webhook credentials secure and rotate regularly
- Rate Limiting: Implement rate limiting on webhook endpoints
Troubleshooting
Common Issues
Debug Steps
- Check Chargebee Dashboard: Verify API key and site name
- Test API Key: Use Chargebee API to test key validity
- Monitor Webhooks: Check webhook delivery logs in Chargebee
- Review Logs: Check Flexprice application logs for errors
Next Steps
After setting up your Chargebee connection:- Create Item Family: Create an item family in Chargebee (required for plan sync)
- Sync Plans: Sync your Flexprice plans to Chargebee
- Test Invoice Sync: Create a test invoice and sync to Chargebee
- Monitor Webhooks: Ensure webhook events are being received
- Go Live: Switch to production credentials when ready

