OSI Affiliate Software can easily be integrated with Moonclerk.

Step 1. Login to your OSI admin account, under Set Up Software click Settings. And then enable Include Parameters in affiliates URL.

Step 2. Landing Page Code

Place this code within the <body> section of the landing page designated for your referral program.

<script defer type="text/javascript" src="https://www.ositracker.com/js/url-params.js"></script>

<script> document.addEventListener("DOMContentLoaded", function() { setCookie("affiliate_id", urlParams['affiliate_id'], 60); setCookie("prodgroup", urlParams['prodgroup'], 60); }); function setCookie(cname, cvalue, exdays) { const d = new Date(); d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); let expires = "expires="+d.toUTCString(); document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; } </script>

Note: The code above should be added to the page set as the landing page for the referral program.

Webhook Setup

Step 3. Login to your Moonclerk admin account, click on Account, select Settings, and then Webhooks at the left corner.

Step 4. Click on +Create Webhook Endpoint.

Step 5. Add a new webhook with the following URL https://www.ositracker.com/Moonclerk/webhooks Select Payment Successful. And then click SAVE.

Step 6. Embed Payment Form. 

Go to Forms, click the three dots beside it, and select "USE". Copy the embedded payment form code and place the code on your website.

Step 7. Payment Form Code

Edit embed payment form code as follows, newer code is marked as bold/red. FORM_ID is used here as a placeholder, No need to put any ID here, it would be there in the code from Moonclerk.


Note: The code in red is the new code that needs to be added to the existing form embed code.

<div id="mcFORM_ID"><a href="https://app.moonclerk.com/pay/FORM_ID">test</a></div>

<script type="text/javascript">var mcFORM_ID;(function(d,t) {var s=d.createElement(t),opts={"checkoutToken":"FORM_ID","width":"100%","cid":getCookie("affiliate_id")+'-'+getCookie("prodgroup")};s.src='https://d2l7e0y6ygya2s.cloudfront.net/assets/embed.js';s.onload=s.onreadystatechange = function() {var rs=this.readyState;if(rs) if(rs!='complete') if(rs!='loaded') return;try {mcFORM_ID=new MoonclerkEmbed(opts);mcFORM_ID.display();} catch(e){console.error('[MC]', e)}};var scr=d.getElementsByTagName(t)[0];scr.parentNode.insertBefore(s,scr);})(document,'script');

function getCookie(cname) { let name = cname + "="; let decodedCookie = decodeURIComponent(document.cookie); let ca = decodedCookie.split(';'); for(let i = 0; i < ca.length; i++) { let c = ca[i]; while (c.charAt(0) == ' ') { c = c.substring(1); } if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); } } return ""; }