Skip to main content

How to Set Up the Recurring/Lifetime Commissions (via REST API, Zapier, or Make)

If your integration does not support automatic handle of recurring/lifetime commissions, you can achieve the same automation level with this guide.

Sonya avatar
Written by Sonya
Updated this week

If you're running a SaaS business, you may want to reward affiliates with a recurring commission for each subscription renewal (either for a limited time or for a set number of renewals). If you're an owner of an e-commerce business, you can consider assigning lifetime commissions to the activities of customers referred by your affiliates. In both cases, you'll have to set up the Recurring/Lifetime Commissions tracking feature for your program in Tapfiliate.

Some Tapfiliate integrations natively support recurring/lifetime commission tracking (Stripe, WooCommerce, etc.), but you may have installed one that requires additional setup to handle the process. Tapfiliate offers several approaches to achieving this.

In this article, we'll discuss:


Getting Started with the Recurring/Lifetime commissions setup

  1. Enable recurring commissions in your program’s commission structure settings, and optionally set a cap.

  2. Track a Customer using our JavaScript tracking code or the REST API. Pass your own database's identifier for the customer, or your payment gateway’s customer ID, as the customer_id.

  3. Use the Create a conversion API endpoint to create new conversions for each subsequent payment, passing the same customer ID as in Step 1. This will automatically attribute the conversion to the customer's original referring affiliate.

✏️ Please note that this is an advanced feature, and you may need a developer's help to set it up.


Code sample for the hybrid integration (JavaScript + REST API)

  1. Add the following code to the Header section on all pages that affiliates will be sending the traffic to:

    <script src="https://script.tapfiliate.com/tapfiliate.js" type="text/javascript" async></script>
    <script type="text/javascript">
    (function(t,a,p){t.TapfiliateObject=a;t[a]=t[a]||function(){ (t[a].q=t[a].q||[]).push(arguments)}})(window,'tap');

    tap('create', 'YOUR ACCOUNT ID');
    tap('detect');
    </script>

    Don't forget to add your Account ID to the above script ☝️

  2. Create the сustomer with our JavaScript tracking code by adding the code below to your Thank You page. We’re choosing to create a customer status in the example, but other initial statuses are also available. You can read more about Customer statuses in this article.

    <script src="https://script.tapfiliate.com/tapfiliate.js" type="text/javascript" async></script>
    <script type="text/javascript">
    (function(t,a,p){t.TapfiliateObject=a;t[a]=t[a]||function(){ (t[a].q=t[a].q||[]).push(arguments)}})(window,'tap');

    var customerId = 'YOUR CUSTOMER’S ID'; // Get from your backend

    tap('create', 'YOUR ACCOUNT ID');
    tap('customer', customerId);
    </script>

    Don't forget to add your Account ID to the above script ☝️

  3. Whenever a recurring or new payment takes place for the customer, you can create a new conversion through the REST API:

    curl -X POST -H 'Content-Type: application/json' -H 'Api-Key: YOUR API KEY HERE' https://api.tapfiliate.com/1.6/conversions/ -d '
    {
    "customer_id": "YOUR CUSTOMER’S ID",
    "external_id": "((((PAYMENT ID))))",
    "amount": 10
    }'

Code sample (tracking the recurring/lifetime commissions via JavaScript + Zapier)

  1. Add the following code in the Header section of all pages that affiliates will be referring traffic to:

    <script src="https://script.tapfiliate.com/tapfiliate.js" type="text/javascript" async></script>
    <script type="text/javascript">
    (function(t,a,p){t.TapfiliateObject=a;t[a]=t[a]||function(){ (t[a].q=t[a].q||[]).push(arguments)}})(window,'tap');

    tap('create', 'YOUR ACCOUNT ID');
    tap('detect');
    </script>

    Don't forget to add your Account ID to the above script ☝️

  2. Create the customer with Tapfiliate's JavaScript tracking code by adding the code below to your “thank you page”. We’re choosing to create a customer status in the example below, but other initial statuses are also available. You can read more about Customer statuses in this article.

    <script src="https://script.tapfiliate.com/tapfiliate.js" type="text/javascript" async></script>
    <script type="text/javascript">
    (function(t,a,p){t.TapfiliateObject=a;t[a]=t[a]||function(){ (t[a].q=t[a].q||[]).push(arguments)}})(window,'tap');

    var customerId = '((((PAYMENT GATEWAY'S ID FOR THIS CUSTOMER))))'; // How to get this depends on your payment gateway

    tap('create', 'YOUR ACCOUNT ID');
    tap('customer', customerId);
    </script>

    Don't forget to add your Account ID to the above script ☝️

  3. In the Zapier app, create a new Zap. As the Trigger, choose the equivalent of “New Payment” for your preferred payment gateway.

  4. In the Action, choose the Tapfiliate app, then “Create Conversion”. As the Customer ID, hook up the customer id from the trigger step of the Zap. This should be the same property as you used in the JavaScript code. Optionally hook up the amount field and any other field you would like to pass.

  5. Hit Continue > Test, and you’re all done! Don't forget to publish the Zap you created.


Code sample (for automating via JavaScript + Make)

  1. Add the following code in the Header section of all pages that affiliates will be referring traffic to:

    <script src="https://script.tapfiliate.com/tapfiliate.js" type="text/javascript" async></script>
    <script type="text/javascript">
    (function(t,a,p){t.TapfiliateObject=a;t[a]=t[a]||function(){ (t[a].q=t[a].q||[]).push(arguments)}})(window,'tap');

    tap('create', 'YOUR ACCOUNT ID');
    tap('detect');
    </script>

    Don't forget to add your Account ID to the above script ☝️

  2. Create the customer with Tapfiliate's JavaScript tracking code by adding the code below to your “thank you page”. We’re choosing to create a customer status in the example below, but other initial statuses are also available. You can read more about Customer statuses in this article.

    <script src="https://script.tapfiliate.com/tapfiliate.js" type="text/javascript" async></script>
    <script type="text/javascript">
    (function(t,a,p){t.TapfiliateObject=a;t[a]=t[a]||function(){ (t[a].q=t[a].q||[]).push(arguments)}})(window,'tap');

    var customerId = '((((PAYMENT GATEWAY'S ID FOR THIS CUSTOMER))))'; // How to get this depends on your payment gateway

    tap('create', 'YOUR ACCOUNT ID');
    tap('trial', customerId);
    </script>

    Don't forget to add your Account ID to the above script ☝️

  3. In the Make app, create a new scenario. As the trigger, choose your payment gateway’s equivalent to a “New Payment” - this could also be called a “New Transaction” or “New Charge”, or similar.

  4. Next, attach a new module and pick Tapfiliate’s “Create a Conversion” action.

  5. In the affiliate attribution field, indicate the Customer ID from the trigger step of the Zap. This should be the same property that was tracked using your JavaScript code.

    It’s also recommended to attach an external ID (e.g., the transaction or charge ID) and the amount of the charge.

  6. Save your scenario, and you’re done!

Did this answer your question?