Recurring / Lifetime commissions through the API or Zapier

Whether you are operating a subscription service or just want to offer a great incentive to your affiliates, recurring commissions are widely loved in the affiliate marketing world.

Although we offer a simple, automatic recurring commissions feature that automatically adds a commission each week, month or year after the original conversion has taken place, there is nothing like the flexibility and fine-grained control that both our API and Zapier offer for logging both recurring and lifetime commissions.

The gist of the process for adding recurring and lifetime commissions is as follows:

  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 id for the customer, or your payment gateway’s customer id as the customer_id
  3. Use the create conversion api to create new conversions on each subsequent payment, by passing the same customer id as in step 1. This will automatically attribute the conversion to the original referring affiliate of the customer.

Please note that this is an advanced feature and that you may need the help of a developer to set this up for you.

Code sample (Javascript + REST API)

  1. Add the following code in the head of all pages 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>
    
  2. Create the Customer with our javascript tracking code, by adding the code below to your “thank you page”. We’re choosing to create a “trial” customer here, but other intial 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('trial', customerId);
    </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 (Javascript + Zapier)

  1. Add the following code in the head of all pages 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>
    
  2. Create the Customer with our javascript tracking code, by adding the code below to your “thank you page”. We’re choosing to create a “trial” customer here, but other intial 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>
    
  3. In Zapier, create a new Zap. As the trigger, choose your favourite payment gateway’s equivalent to “New Payment”.

    Screen Shot 2019-07-18 at 13 48 37

  4. As the action choose the Tapfiliate app and then “Create Conversion”. As the Customer ID, hook up the customer id from the trigger stap 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.

    Screen Shot 2019-07-18 at 13 50 06

5 Hit “save” and you’re all done!