Skip to main content

Overview

Connect Chargebee to automatically track subscription payments and manage recurring commissions for your partners.

Features

  • Subscription tracking - Full subscription lifecycle support
  • Recurring commissions - Automatic commission on renewals
  • Invoice tracking - Track all invoice payments
  • Refund handling - Automatic commission adjustments

Setup

Step 1: Get API Credentials

  1. Log in to your Chargebee dashboard
  2. Go to Settings → Configure Chargebee → API Keys
  3. Create a Full Access API key (or Read Only for tracking only)

Step 2: Configure in Partnero

  1. Go to Program Settings → Integrations
  2. Select Chargebee
  3. Enter your Site name and API key

Step 3: Set Up Webhook

Configure webhook in Chargebee:
  1. Go to Settings → Configure Chargebee → Webhooks
  2. Add webhook URL: https://api.partnero.com/v1/integrations/chargebee/{your_program_id}/webhook
  3. Select events:
    • Invoice Created
    • Invoice Updated
    • Payment Succeeded
    • Payment Refunded
    • Subscription Created
    • Subscription Renewed
    • Subscription Cancelled

Step 4: Configure Webhook Security

Set up webhook verification:
  1. Copy your webhook username and password from Chargebee
  2. Enter credentials in Partnero integration settings

How It Works

Payment Flow

Customer Attribution

Customers are linked via:
  1. Customer ID matching - Chargebee customer ID synced to Partnero
  2. Email matching - Customer email used for attribution
  3. Metadata - Partner info in Chargebee metadata

Passing Partner Data

Include partner attribution in Chargebee:
// When creating a subscription
chargebee.subscription.create({
  plan_id: "pro-plan",
  customer: {
    email: "[email protected]",
    cf_partnero_partner: "PARTNER_CODE" // Custom field
  }
});
Or via hosted pages:
chargebee.openCheckout({
  hostedPage: function() {
    return $.ajax({
      url: "/api/create-checkout",
      type: "POST",
      data: {
        plan_id: "pro-plan",
        partner_code: "PARTNER_CODE"
      }
    });
  }
});

Subscription Lifecycle

New Subscriptions

When a subscription is created:
  • First invoice payment creates transaction
  • Commission calculated for partner
  • Subscription linked for future tracking

Renewals

On each subscription renewal:
  • New transaction created automatically
  • Commission calculated (if recurring enabled)
  • Partner continues earning

Upgrades/Downgrades

Plan changes are tracked:
  • Prorated amounts handled correctly
  • Commission adjusted based on new amount

Cancellations

When subscription is cancelled:
  • Future renewals stop
  • No new commissions generated
  • Historical data preserved

Refund Handling

Chargebee refunds are processed automatically:
  1. Credit note or refund issued in Chargebee
  2. Webhook notification sent
  3. Transaction marked as refunded
  4. Commission reversed

Custom Fields

Create custom fields in Chargebee to store partner data:
  1. Go to Settings → Configure Chargebee → Custom Fields
  2. Add field cf_partnero_partner to Customer
  3. Pass partner code when creating customers

Testing

Test Site

Use Chargebee’s test site:
  1. Create test site in Chargebee
  2. Configure webhook for test site
  3. Use test card numbers

Test Cards

CardResult
4111111111111111Success
4000000000000002Declined

Troubleshooting

  • Check webhook URL in Chargebee settings
  • Verify webhook is enabled
  • Check Chargebee webhook logs
  • Verify API key is correct
  • Ensure site name matches exactly
  • Check API key permissions
  • Ensure custom field is passed correctly
  • Check customer has referral cookie
  • Verify email matching is working

Next Steps