Integrate with Chargebee

Chargebee is a subscription billing and revenue management platform. impact.com B2B brands are often running affiliate programs to drive new subscription sign-ups and reward partners based on recurring payments from the sign-ups.

If you're using Chargebee, you can configure an integration to report subscription events and refunds directly to your program on impact.com.

How it works

  1. On your website (or store), you'll implement a script that captures an impact.com Click ID (irclickid) value from the user's landing page query string, then create a custom field in Chargebee account for the Click ID value.
  2. You'll then generate a read-only Chargebee API key for impact.com to use.
  3. You'll provide the Chargebee API key for impact.com via our partner integration portal, which will generate URLs for the webhooks.
  4. Once authenticated, the integration uses Event Webhooks to capture subscription events and refund events from Chargebee and send them to your impact.com account.
  5. Integration prerequisites

    This section covers the prerequisites to meet before connecting the impact.com app to your Chargebee account.

    ⚠️

    Note

    These steps serve as a guideline and you are not required to replicate them if another solution exists. Please reach out to your implementation specialist or contact support if you plan to pursue another solution.


    Implement UTT

    impact.com needs to generate and capture clickID values for visitors to your store, so you need to implement impact.com's Universal Tracking Tag (UTT). The UTT enables the capturing and handling of the clickID. To capture the ClickId, you must obtain your account’s UTT script from impact.com’s platform and set it up to load on every public page of your site.

    Accessing your UTT...
    1. From the left navigation, select   [Menu]Settings.
    2. Select General under the Tracking section

    Configure a Chargebee custom field for the Click ID

    Create an `impact_click_id` field and add it to the subscription as a custom field.
    1. Log in to your Chargebee account.
    2. In the left navigation menu, select Settings → Configure Chargebee.
    3. In the Advanced section, select Custom fields.
    4. At the top of the screen, use to dropdown to select Custom fields for your Subscription, then select Single line text.
    5. For Field Label, enter impact_click_id.
    6. Leave all other fields to their default values and select Save to site.

    :bulb: Example

    The example below indicates the JavaScript to add to your subscription checkout page to ensure that every >new subscription record gets the impact_click_id value added to the subscription custom field:

    1 <script type="text/javascript">
    2  (function() {
    3    const cbInstance = Chargebee.init({ site: "<site_subdomain>" });
    4    const checkoutButtonElement = document.querySelectorAll("[data-cb-type=checkout]")[0];  
    5    const product = cbInstance.getProduct(checkoutButtonElement);
    6    ire('generateClickId', function(clickId) {
    7      product.setCustomData({ cf_impact_click_id: clickId });
    8    });
    9 })();
    10</script>
    

    ⚠️

    Multiple checkout buttons?

    If you have multiple checkout buttons on the same page, you’ll have to loop through the array returned by document.querySelectorAll("[data-cb-type=checkout]") function instead of selecting the first position. In each iteration, you must set the impact_click_id for the product.

    Integration setup

    Step 1: Create a Chargebee API key


    📘

    Chargebee API Keys

    Refer to Chargebee Docs to learn how to create a read-only API key, or follow the steps below.

    1. In the left navigation menu of your Chargebee account, select Settings → Configure Chargebee.
    2. Next to API Keys and Webhooks, select API keys.
    3. On the API Keys and Webhooks screen, select Add API Key.
    4. In the Create an API Key modal, select Read-Only Key.
    5. For the next step, select All, name the key Impact, then select Create Key.

    Step 2: Configure the integration

    1. Access the impact.com impact.com Integration Partner Portal.
    2. On the dashboard under Platforms, select Chargebee.
    3. On the login screen, enter your impact.com API Account SID & Auth Token.
      • Refer to the callout below for your Account SID & Auth Token.

    4. Enter your impact.com info in the fields.
      • Refer to the callout below for your Account SID & Auth Token.

    5. Select Submit.
      • The portal will display the information you submitted and generate two Execution URLs — one for conversions, and other for refunds. Save your execution URLs somewhere safe — you'll need add these to your Chargebee account.

    📘

    impact.com Account Info Cheat Sheet

    Not sure what your account info is? Refer to the table below:

    Required infoimpact.com account infoDescription
    Account SIDMy Account UsernameIn impact.com, navigate to [Menu] → Settings → API to find your Account SID. Copy the full case-sensitive value.
    Auth TokenMy Auth TokenIn impact.com, navigate to [Menu] → Settings → API to find your Account SID. Copy the full case-sensitive value.
    Program IDMy Program IDYour impact.com Program/Campaign identifer.
    Event Type IDMy Sale Event IDYour impact.com Event/Action tracking identifier.
    Recurring Tracker IDMy Recurring Sale Event IDYour impact.com recurring subscription Event/Action tracking identifier.

    Step 3: Create Chargebee webhooks


    Create a webhook for "Payment Succeeded"

    1. In the Chargebee navigation menu, select Settings → Configure Chargebee.
    2. Go to the API Keys and Webhooks section, then select Webhooks.
    3. On the Webhooks screen, select Add Webhook.
    4. For Webhook Name, input Impact Conversion Webhook.
    5. For Webhook URL, input the Execution URL for Conversions you received from the integration partners portal.
    6. Ensure Protect webhook URL with basic authentication is [Off].
    7. For API version, select Version 2.
    8. For Events to Send, use the dropdown to select Payment Succeeded.
    9. Leave the remaining options [Off], then select Create.

    Create a webhook for "Payment Refunded"

    1. In the Chargebee navigation menu, select Settings → Configure Chargebee.
    2. Go to the API Keys and Webhooks section, then select Webhooks.
    3. On the Webhooks screen, select Add Webhook.
    4. For Webhook Name, input Impact Conversion Webhook.
    5. For Webhook URL, input the Execution URL for Refunds you received from the integration partners portal.
    6. Ensure Protect webhook URL with basic authentication is [Off].
    7. For API version, select Version 2.
    8. For Events to Send, use the dropdown to select Payment Refunded.
    9. Leave the remaining options [Off], then select Create.

    ⚠️

    Note

    You can enable the Exclude card information from webhook call as this will not impact the tracking integration.

    Conversion and Refund Reporting

    Payment Succeeded

    When a Payment Succeeded event takes place in Chargebee, the request is sent to impact.com with the following data mapping:

    impact.com ParameterChargebee
    CampaignIdtaken from integration settings
    ActionTrackerIdtaken from integration settings
    IntegrationSourceImpact_Chargebee_Plugin
    ClickIdcontent.subscription.cf_impact_click_id
    EventDatetimestampToISO(invoice.finalized_at)
    OrderIdcontent.invoice.id
    CustomerIdcontent.customer.id
    OrderPromoCodecontent.invoice.discounts[0]
    CurrencyCodecontent.transaction.currency_code
    CustomerEmailcontent.customer.email
    ItemSku{i}content.invoice.line_items[].entity_id
    ItemCategory{i}content.invoice.line_items[].quantity
    ItemQuantity{i}content.invoice.line_items[].description
    ItemSubTotal{i}Calculated from various attributes

    Payment Refunded

    When a Payment Refunded event takes place, a request will be sent to impact.com. After one hour has passed (to ensure a valid initial conversion), impact.com will process the refund request, with the following data mapping:

    impact.com ParameterChargebee charge.refund parameter
    EventTypeIdtaken from integration settings
    ReasonOTHER
    ItemSku{i}content.credit_note.line_items[].entity_id
    ItemQuantityCalculated from various attributes
    ItemSubtotalCalculated from various attributes
    OrderIdcontent.invoice.id