Chargebee Integration (Only for Resellers to Setup Subscriptions for Their Customers)
Integrating Chargebee with your WhautoMail Reseller SaaS deployment provides advanced subscription management with support for multiple payment gateways. Chargebee acts as a unified billing platform that can work with various payment processors across different jurisdictions.
Why Integrate Chargebee?
- Support multiple payment gateways (Stripe, PayPal, Braintree, Authorize.Net, and more)
- Manage complex subscription billing scenarios
- Advanced revenue analytics and reporting
- Automated dunning management for failed payments
- Support for different tax jurisdictions
Prerequisites
Before you begin, ensure you have:
- A Chargebee account (test site for development, live site for production)
- At least one payment gateway configured in your Chargebee account
- Access to your backend server configuration
Chargebee Configuration for WhautoMail Reseller SaaS
🔹 Before App Installation
Pre-Installation Checklist
1. Chargebee Setup Guide (For WhautoMail Reseller SaaS License)
If you are using Chargebee for subscription billing inside your WhautoMail Reseller Plan, follow the steps below.
Step 0: Locate the Configuration File
Open the web-server.env file inside the installation package shared by the WhautoMail team. Fill in the Chargebee details in this section:
# Chargebee Integration (Only for Resellers who prefer Chargebee instead of Stripe)
CHARGEBEE_SITE="your_chargebee_site"
CHARGEBEE_APIKEY="your_chargebee_apikey"
CHARGEBEE_WEBHOOK_USERNAME="your_chargebee_webhook_username"
CHARGEBEE_WEBHOOK_PASSWORD="your_chargebee_webhook_password"
Note:
- This setup is only for resellers who want to use Chargebee instead of Stripe.
- Do not enable both unless your plan supports dual-billing providers.
Step 1: Log in or Create Your Chargebee Account
- If you already have a Chargebee account, log in at: https://app.chargebee.com/login
- If you are new, create an account from the Chargebee signup page.
Step 2: Find Your Chargebee Site ID
After logging in, your URL will look like:
https://whautomail-test.chargebee.com/
The part before .chargebee.com is your Site ID.
Example:
CHARGEBEE_SITE="whautomail-test"
Update this in your web-server.env file.
Step 3: Configure Chargebee Essentials
-
Open the Settings Panel
- Go to Settings
- Click Configure Chargebee
-
Set Up Billing Essentials Complete the important sections:
- Business Profile
- Tax information
- Billing rules
- Payment gateway setup
-
Required Configuration (Must Complete) Navigate to:
- Checkout & Self-Serve Portal → Configuration
- Checkout → Set to Single Sign On API
- Self-Serve Portal → Set to Via Single Sign On API
⚠️ These settings are required for WhautoMail to link users and subscriptions correctly. Other optional Chargebee settings (Revenue Recovery, Dunning, Emails, Branding) can be configured later based on your business needs.
Step 4: Create a Full-Access API Key
- Go to: Settings → Configure Chargebee → API Keys and Events → API Keys
- Click + Add API Key
- Select Full-Access Key
- Give it a name (Example: "WhautoMail Reseller API")
- Copy the generated key
- Update in
web-server.env:CHARGEBEE_APIKEY="your_full_access_api_key"
⚠️ Important: This API key is sensitive — treat it like a password and store it securely.
Step 5: Create Webhook Authentication Credentials
Choose any username and a strong password. These will be used when adding the webhook in Chargebee.
Example:
CHARGEBEE_WEBHOOK_USERNAME="wmaireseller"
CHARGEBEE_WEBHOOK_PASSWORD="xT78sdPp92Q"
Add these to your web-server.env file.
Why this is required: Chargebee webhooks must be protected with Basic Authentication before communicating with WhautoMail.
Step 6: Save Your Final Configuration
Your Chargebee section in web-server.env should look like this:
# Chargebee Integration
CHARGEBEE_SITE="whautomail-test"
CHARGEBEE_APIKEY="EAAJXUZABCDE123..."
CHARGEBEE_WEBHOOK_USERNAME="wmaireseller"
CHARGEBEE_WEBHOOK_PASSWORD="xT78sdPp92Q"
Save and close the file.
🔹 After App Installation
2. Configure Chargebee Webhooks (Required for SaaS Licensing)
⚠️ Important: If you skip this step, Chargebee events will NOT reach WhautoMail. This means customer upgrades, downgrades, cancellation, or renewal will fail to sync.
Steps to Add the Webhook
- Log in to your Chargebee account
- Go to: Settings → Configure Chargebee → API Keys and Events → Webhooks
- Click + Add Webhook
- Fill the fields as follows:
Webhook Configuration
- Webhook Name:
WhautoMail Server(example) - Webhook URL:
https://yourdomain.com/chargebee/webhook
Basic Authentication (Very Important)
- ☑ Protect webhook URL with basic authentication
- Username: Same as
CHARGEBEE_WEBHOOK_USERNAME - Password: Same as
CHARGEBEE_WEBHOOK_PASSWORD
Select These Events (Choose All Subscription Events)
- Subscription Created
- Subscription Created With Backdating
- Subscription Started
- Subscription Activated
- Subscription Activated With Backdating
- Subscription Changed
- Subscription Trial Extended
- Subscription Changed With Backdating
- Subscription Cancelled
- Subscription Cancelled With Backdating
- Subscription Reactivated
- Subscription Reactivated With Backdating
- Subscription Renewed
- Subscription Deleted
- Subscription Paused
- Subscription Resumed
Enable These Options
- Set this as primary
- Exclude card information from webhook call
- Click Create to save the webhook.
Testing Tip (Recommended)
Create a test plan inside your WhautoMail backend and check if the plan appears automatically in Chargebee. If it syncs correctly, your integration is working.
Troubleshooting
Webhook Events Not Received
- Verify your webhook URL is publicly accessible via HTTPS
- Check that your firewall allows incoming requests from Chargebee IPs
- Review webhook logs in Chargebee dashboard for delivery failures
API Authentication Errors
- Confirm your API key is correct and not expired
- Ensure you're using the correct site name
- Check that your API key has the necessary permissions
Payment Gateway Issues
- Verify each gateway is properly configured in Chargebee
- Check gateway-specific credentials and settings
- Review gateway status in Chargebee dashboard
Additional Resources
- Chargebee API Documentation
- Webhook Events Reference
- Payment Gateway Configuration
- Subscription Management Guide
Note: Chargebee integration is only required for Reseller deployments that need to manage customer subscriptions and payments. The multi-gateway support makes it ideal for businesses operating across multiple jurisdictions or requiring payment processor redundancy.
For further assistance, refer to Chargebee Support or the WhautoMail documentation.