Skip to main content

Chargebee Integration (Only for Resellers to Setup Subscriptions for Their Customers)

Integrating Chargebee with your WhautoChat 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

How to Set Up Chargebee Integration

1. Configure Your Chargebee Account

  1. Create or log in to your Chargebee account.
  2. Set up your payment gateway(s) in Chargebee:
    • Go to Settings > Configure Chargebee > Payment Gateways
    • Add and configure your preferred payment gateway(s) (e.g., Stripe, PayPal, Braintree)
    • Complete the gateway-specific authentication and configuration

2. Set Up Webhooks

  1. Create a webhook endpoint in your Chargebee dashboard:
    • Go to Settings > Configure Chargebee > Webhooks
    • Click "Add Webhook"
    • Set the webhook URL to: https://your-backend-server-url/chargebee/webhook
    • Select the following events:
      • subscription_created
      • subscription_started
      • subscription_activated
      • subscription_changed
      • subscription_cancelled
      • subscription_reactivated
      • subscription_paused
      • subscription_resumed
      • subscription_deleted
    • Save the webhook

3. Obtain API Credentials

  1. Go to Settings > Configure Chargebee > API Keys and Webhooks
  2. Copy your API Key (keep this secure)
  3. Note your Site Name (e.g., yourcompany-test or yourcompany)

5. Update Environment Variables

Update your web-server.env file in your installation folder with the following configuration:

# Chargebee Integration for Subscription Billing
CHARGEBEE_SITE='your_chargebee_site_name'
CHARGEBEE_APIKEY='your_chargebee_apikey'
CHARGEBEE_WEBHOOK_USERNAME='your_webhook_username'
CHARGEBEE_WEBHOOK_PASSWORD='your_webhook_password'

Configuration Details:

  • CHARGEBEE_SITE: Your Chargebee site name (e.g., yourcompany-test or yourcompany)
  • CHARGEBEE_APIKEY: Your Chargebee API key from the dashboard
  • CHARGEBEE_WEBHOOK_USERNAME: A username you create for webhook authentication (optional but recommended)
  • CHARGEBEE_WEBHOOK_PASSWORD: A secure password for webhook authentication (optional but recommended)

For enhanced security, configure basic authentication for your webhook endpoint:

  1. In your Chargebee webhook settings, expand "Advanced Settings"
  2. Enable "Basic Authentication"
  3. Enter the username and password that match your environment variables
  4. Save the configuration

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


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 WhautoChat documentation.