Building Integrations & Workflows with iPaaS

This guide will walk you examples of building integrations and workflows using iPaaS (Integration Platform as a Service). When you're finished, you'll understand how to integrate Chargify to another system, create Chargify workflows, and more.

Zapier Cyclr

Important

Chargify does not assist in building, debugging, maintaining, or supporting anything you or a developer builds with iPaaS. However, based on your plan, Chargify can assist with helping you determine which Chargify Webhooks and Chargify APIs to use.


Summary

Feature
Webhooks and API
You Need
1. Completed Design Your Integration
2. Person(s) with technical experience building (but not coding) integrations, handling data modification, and knowledge of APIs and Webhooks.
3. An iPaaS software
Code
No-code to low-code
Difficulty
◉◎◎◎◎ (can increase based on your integration's complexity)

Introduction to Zapier

Zapier is the ideal iPaaS solution for low-complexity integration needs.

Watch the example implementation of a 1way integration from Chargify → Slack. The Trigger/Action is: When a new subscription is created in Chargify, post a message to a Slack Channel. This video highlights important concepts, such as Zapier Webhooks, Zapier Filters, Triggers, and Actions.


Example 1 - Connect to a 3rd Party System Diagram

In this example, we'll listen for a signup_success webhook event in Chargify, and perform an action in a 3rd party system.

1. Setup webhook
In this step, we'll configure Zapier to listen for a Chargify webhook.

  1. In Zapier, configure Webhooks by Zapier
    In Zapier select Webhooks by Zapier, set trigger event as Catch Hook, click Continue, copy the Webhook URL.

  2. In Chargify, configure the webhook URL
    In Chargify, go to Config > Settings > Webhooks, and add the Webhook URL in your webhook settings: Checkmark Signup Success, checkmark "Send Webhooks to my Webhook Endpoint(s)", click Save Changes.

  3. In Chargify, create a test subscription
    Create a test subscription. 

  4. In Zapier, test the trigger
    In Zapier, click Continue, then click Test Trigger. You should see test data showing the test was successful. When you're done, click Continue.

    zapier-step-1.gif
2. Add filter
Sometimes you may want to isolate for specific scenarios. In this case, let's filter for the signup_success webhook.

  1. In Zapier, add Filter by Zapier
    In Zapier, select Filter by Zapier.

  2. In Zapier, configure the filter
    Set the filter to only continue if: Event  | (Text) Exactly Matches | signup_success

    zapier-step2.gif
3. Connect to a system & map data
Next, let's connect to any 3rd party system. The only requirement is that Zapier has a connector to the system, and supports the action(s) you need.

 

  1. In Zapier, add the 3rd party system & authenticate
    In Zapier, select the 3rd party system. Select any options Zapier asks for, and authenticate.

  2. In Zapier, map the data
    Start mapping your data. This step is the most important.


4. Test
Finally, test your workflow.

1. Once you save your changes from the previous step, click "Test & Continue". 
2. Optional - Didn't work? View your Zap accordingly. Zapier will show any errors.

Note: Chargify does not help debug Zapier workflows.


Example 2: Perform an Action in Chargify Diagram

In this example, we'll update a subscription in Chargify after it's created. This is best used when the final step of your workflow is an API request to Chargify (this is the most common Zapier use case).

1. Setup webhook
In this step, we'll configure Zapier to listen for a Chargify webhook.

  1. In Zapier, Configure Webhooks by Zapier
    In Zapier select Webhooks by Zapier, set trigger event as Catch Hook, click Continue, copy the Webhook URL.

  2. In Chargify, configure the webhook URL
    In Chargify, go to Config > Settings > Webhooks, and add the Webhook URL in your webhook settings: Checkmark Signup Success, checkmark "Send Webhooks to my Webhook Endpoint(s)", click Save Changes.

  3. In Chargify, create a test subscription
    Create a test subscription. 

  4. In Zapier, test the trigger
    In Zapier, click Continue, then click Test Trigger. You should see test data showing the test was successful. When you're done, click Continue.

    zapier-step-1.gif

2. Add filter
Sometimes you may want to isolate for specific scenarios. In this case, let's filter for the signup_success webhook.

  1. In Zapier, add Filter by Zapier
    In Zapier, select Filter by Zapier.

  2. In Zapier, configure the filter
    Set the filter to only continue if: Event  | (Text) Exactly Matches | signup_success

    zapier-step2.gif
3. Configure the Chargify Action
In Zapier, search for Code by Zapier, and set the Action Event to Run Javascript.

zapiercode1.gif

4. Set variable
This is where you define a variable and map it to data from the webhook. You'll usually want the subscription ID. So in this step, we'll create a variable called "sub_id" and map it to the real subscription ID. Tip: It's hard to search in this step, so take your time to make sure you pull the correct data (see screencast).

zapier-code2.gif



5. Write custom API request Javascript API
Next, make an API request to Chargify. 

 

  1. Copy this sample code into Zapier (see screencast below if needed)
    //**
    //**CONFIG
    //**
    
    //Chargify Credentials
    var chargify_subdomain = 'subdomain';
    var chargify_api_key = 'apikey';
     
    //API Request
    var http_method = 'POST'; //Use POST, PUT, or DELETE
    var endpoint = '/subscriptions/' + inputData.sub_id + '/price_points.json'; //Example of updating a subscription price point
     
    //JSON body. Example of components below:
    var json = {"components": [
                  {
                    "component_id": 1506141,
                    "price_point": "second-price-point"
                  }
                ]
              };
    //**
    //**ZAPIER API REQUEST
    //**
    
    fetch('https://' + chargify_subdomain + '.chargify.com' + endpoint, {
      method: http_method, 
      headers: {
        'Content-Type': 'application/json',
        "Accept": "application/json",
        'authorization': 'Basic '  + Buffer.from(chargify_api_key + ":x").toString('base64')
      },
      body: JSON.stringify(json)
      })
      .then(function(res) {
        var text = res.json();
        callback(null, text);
      })
      .then(function(body) {
        var output = {"body": body};
        callback(null, output);
      })
      .catch(callback);

  2. In Zapier, within the code, edit the CONFIG section
    Start mapping your data. This step is the most important.

    Chargify Credentials
    - Replace your subdomain and API key (*Keep in mind, you are entering an API key into Zapier. You might want to create a brand new API key just for Zapier).

    API Request
    - Replace the http_method (POST, PUT, or DELETE)
    - Edit the API endpoint as needed (keep the structure as is, and notice how the sub_id variable is already included)

    JSON Body
    - Add your json

    In this example, since we want to update the next billing date, we use PUT and /subscription/id endpoint (it comes from this endpoint). Our JSON sets the next billing date to July 1, 2023.

    zapier-code3.gif

6. Test

Finally, test your workflow.

1. Once you save your changes from the previous step, click "Test & Continue".
2. Optional - Didn't work? View your Zap accordingly. Zapier will show any errors.

Note: Chargify does not help debug Zapier workflows.

Introduction to Cyclr

Cyclr is the ideal iPaaS solution for medium to large businesses who want to integrate Chargify with other systems.

Watch the example implementation using Webhooks and Chargify API, with no code. The Trigger/Action is: When a new subscription is created in Chargify, update the subscription’s next billing date in Chargify. This video highlights important concepts, such as the Cyclr Webhook Method and Cyclr’s Chargify API Connector.


Example 1: Perform an Action in Chargify Diagram

In this example, update a subscription in Chargify after it's created, using Cyclr. Cyclr is the ideal iPaaS solution for medium to large businesses who want to integrate Chargify with other systems, especially when the integration is complex. The following example is simple, but can be extrapolated to actions in any 3rd party systems, any actions in Chargify, with multiple steps of complexity.

1. Create new Cycle
A "Cycle" means an integration or workflow. 

  1. In Cyclr, click "Design New Cycle"
    Click "Design New Cycle" and name the Cycle.

  2. In Cyclr, add the Chargify connector
    1. Click "+ Add Application", search for Chargify, and click "Install".
    2. On the Name & Description screen, click "Next".
    3. On the Connector Setup screen, add your Chargify Subdomain and click "Next".
    4. On the next screen, add your Chargify API Key in the Username field, and leave the Password field blank. When you're done, click "Next". Tip: Create a new API key in Chargify, just for Cyclr.

  3. In Cyclr, add the "Generic Webhook" connector
    You're now back on the main Cycle screen.

    1. On the right, click "+ Add Utility", search for webhook.
    2. Find Generic Webhook, and click "Install".
    3. On the Name & Description screen, click "Next".

    cyclr1.gif

2. Setup webhook
Sometimes you may want to isolate for specific scenarios. In this case, let's filter for the signup_success webhook.

  1. In Cyclr, drag Webhook on to your Cycle
    In Cyclr, on the main Cycle screen, click Generic Webhook, and drag the method called "Webhook" on to the Cycle template.

  2. In Cyclr, get the webhook URL
    On the Webhook method, click the cog wheel, and copy the webhook URL.

  3. In Chargify, add the webhook URL
    In Chargify, add the Webhook URL in your webhook settings: Checkmark Signup Success, checkmark "Send Webhooks to my Webhook Endpoint(s)", click Save Changes.

  4. In Cyclr, perform field discovery
    1. In Cyclr, click "Close" on the webhook URL screen.
    2. Click the bar icon bar.png to open Field Discovery.
    3. While Field Discovery is on, go to Chargify and create a test subscription.
    4. After the subscription is created, wait a bit (10-30 seconds) for Cyclr to discover the fields.

  5. In Cyclr, confirm field discovery success
    In Cyclr, you should see a green success message in the top right hand corner when fields are discovered.

    cyclr2.gif

3. Configure the Chargify action
In this case, we'll do one Chargify Action. But you can have as many as you need, with as many systems as you need. You can add filter steps, read data from Chargify or other systems, perform actions in multiple systems, etc.

 

  1. In Cyclr, drag Chargify on to the Cycle
    On the main Cycle screen, click Chargify on the right hand side, and find the action you want to use. Drag it on to the template, and connect the Webhook Box to the Chargify Box.

  2. In Cyclr, map data
    1. Click the cog icon cog.png to open the Chargify Action.
    2. Map your data.
    3. Repeat this for as many steps as you'll use.

    cyclr3.gif

4. Test
Finally, test your workflow.

1. Turn on the Cycle, by clicking the Run icon  run.png.
2. Go to Chargify and simulate your real action.). Flip back to Cyclr, wait up to 1 minute, and you will see it work in real time, when it shows a spinning icon on a step. Go to Chargify, refresh the page you're on (eg: subscription page), and you'll see the update.

processing.png

3. When you're done testing, click the Stop icon stop.png.
4. Optional - add new steps, edit steps, map data, etc. Continue until you're done.

Note: Chargify does not help debug Cyclr workflows.

cyclr4.gif


Example 2: Create a Multi-step & Multi-system Integration Diagram

In this example, update a subscription in Chargify after it's created, using Cyclr. Cyclr is the ideal iPaaS solution for medium to large businesses who want to integrate Chargify with other systems, especially when the integration is complex. The following example is simple, but can be extrapolated to actions in any 3rd party systems, any actions in Chargify, with multiple steps of complexity.

1. Create new Cycle
A "Cycle" means an integration or workflow. 

  1. In Cyclr, click "Design New Cycle"
    Click "Design New Cycle" and name the Cycle.

  2. In Cyclr, add the Chargify connector
    1. Click "+ Add Application", search for Chargify, and click "Install".
    2. On the Name & Description screen, click "Next".
    3. On the Connector Setup screen, add your Chargify Subdomain and click "Next".
    4. On the next screen, add your Chargify API Key in the Username field, and leave the Password field blank. When you're done, click "Next". Tip: Create a new API key in Chargify, just for Cyclr.

  3. In Cyclr, add the "Generic Webhook" connector
    You're now back on the main Cycle screen.

    1. On the right, click "+ Add Utility", search for webhook.
    2. Find Generic Webhook, and click "Install".
    3. On the Name & Description screen, click "Next".

    cyclr1.gif

2. Setup webhook
Sometimes you may want to isolate for specific scenarios. In this case, let's filter for the signup_success webhook.

  1. In Cyclr, drag Webhook on to your Cycle
    In Cyclr, on the main Cycle screen, click Generic Webhook, and drag the method called "Webhook" on to the Cycle template.

  2. In Cyclr, get the webhook URL
    On the Webhook method, click the cog wheel, and copy the webhook URL.

  3. In Chargify, add the webhook URL
    In Chargify, add the Webhook URL in your webhook settings: Checkmark Signup Success, checkmark "Send Webhooks to my Webhook Endpoint(s)", click Save Changes.

  4. In Cyclr, perform field discovery
    1. In Cyclr, click "Close" on the webhook URL screen.
    2. Click the bar icon bar.png to open Field Discovery.
    3. While Field Discovery is on, go to Chargify and create a test subscription.
    4. After the subscription is created, wait a bit (10-30 seconds) for Cyclr to discover the fields.

  5. In Cyclr, confirm field discovery success
    In Cyclr, you should see a green success message in the top right hand corner when fields are discovered.

    cyclr2.gif

3. Configure Chargify actions and 3rd party system actions
In this case, we'll do several actions. Let's do: 1) read the subscription, 2) read the custom fields for the subscription, read the company from Hubspot, and then update the company in Hubspot.

4. Test
Finally, test your workflow.

1. Turn on the Cycle, by clicking the Run icon  run.png.
2. Go to Chargify and simulate your real action.). Flip back to Cyclr, wait up to 1 minute, and you will see it work in real time, when it shows a spinning icon on a step. Go to Chargify, refresh the page you're on (eg: subscription page), and you'll see the update.

processing.png

3. When you're done testing, click the Stop icon stop.png.
4. Optional - add new steps, edit steps, map data, etc. Continue until you're done.

Note: Chargify does not help debug Cyclr workflows.

cyclr4.gif


Example 3: Schedule a Workflow with Batch Processing

In this example, instead of using webhooks, we'll create a batch job that runs on a schedule and performs a task.

1. Create new Cycle
A "Cycle" means an integration or workflow. 

  1. In Cyclr, click "Design New Cycle"
    Click "Design New Cycle" and name the Cycle.

  2. In Cyclr, add the Chargify connector
    1. Click "+ Add Application", search for Chargify, and click "Install".
    2. On the Name & Description screen, click "Next".
    3. On the Connector Setup screen, add your Chargify Subdomain and click "Next".
    4. On the next screen, add your Chargify API Key in the Username field, and leave the Password field blank. When you're done, click "Next". Tip: Create a new API key in Chargify, just for Cyclr.

  3. In Cyclr, add the "Generic Webhook" connector
    You're now back on the main Cycle screen.

    1. On the right, click "+ Add Utility", search for webhook.
    2. Find Generic Webhook, and click "Install".
    3. On the Name & Description screen, click "Next".

    cyclr1.gif

2. Add the batch job and action
Cyclr has many options to read Chargify objects with the API. In this example, let's use "List New Subscriptions". This will read all new subscriptions since the last run. Cyclr is smart enough to remember the most recent subscription read, and will resume where it left off, each time the batch runs.

  1. Use Cyclr's prebuilt batch actions (eg: List new subscriptions)
    In Cyclr, on the main Cycle screen, click "List New Subscriptions" and drag it on to the template.

  2. Set the Cycle to run at a specific interval (eg: 3 hours, 4 hours, etc)
    In this example, we'll set it to 3 hours.

    batch-data.gif

3. Set the action
The action can be a single step, or a series of steps, with any combination of systems. In this example, we'll keep it simple and just point to a database step.

Screen_Shot_2022-06-21_at_11.31.59_AM.png

4. Test
Finally, test your workflow.

1. Turn on the Cycle, by clicking the Run icon  run.png.
2. Go to Chargify and simulate your real action (eg: a subscription signup). Flip back to Cyclr, wait up to 1 minute, and you will see it work in real time, when it shows a spinning icon on a step. Go to Chargify, refresh the page you're on (eg: subscription page), and you'll see the update.

processing.png

3. When you're done testing, click the Stop icon stop.png.
4. Optional - add new steps, edit steps, map data, etc. Continue until you're done.

Note: Chargify does not help debug Cyclr workflows.

cyclr4.gif


FAQs

  1. How much do iPaaS solutions cost, which one should I use?
    Review Design Your Integration > Part 4.

  2. Can Chargify help me build my integration?
    No. We can, however, answer any questions you have about which Chargify Webhooks or Chargify API Endpoints you need.

  3. Can Chargify help me configure an iPaaS?
    No. We can, however, answer any questions you have about which Chargify Webhooks or Chargify API Endpoints you need, but the iPaaS implementation is your responsibility.
Was this article helpful?
1 out of 1 found this helpful